瀏覽代碼

精简定时任务至 7 个并修复 SQL 库名迁移语法错误

仅保留 yesDailyAccountReport/yesHourAccountReport/bytedanceRefreshToken/retryReport/getAdminAdvertiserList/yesMaterialReportDaily/getAdvertiserFundGet;删除其余任务及关联代码;修复 media_api→nuojing_data 替换引入的关键字粘连与三段式表名;移除百度云与小程序 token 刷新逻辑
yumeng 4 周之前
父節點
當前提交
e2b3b55d3f
共有 91 個文件被更改,包括 162 次插入 和 7095 次删除
  1. 1 1
      nj_job-bytedance/pom.xml
  2. 0 233
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AdvertiserApplet.java
  3. 0 120
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AdvertiserAvatar.java
  4. 0 65
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AdvertiserNameInfo.java
  5. 0 120
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AdvertiserToolsSite.java
  6. 0 39
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AigcProductAlbum.java
  7. 0 37
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AigcProductPlatform.java
  8. 0 20
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/DianzhongDistributorConfig.java
  9. 0 24
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/DianzhongMovieConfig.java
  10. 0 20
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtActionLog.java
  11. 0 48
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicy.java
  12. 0 16
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicyAction.java
  13. 0 18
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicyCondition.java
  14. 0 26
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicyConfig.java
  15. 0 22
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicyRunInfo.java
  16. 0 20
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicyTargetFilter.java
  17. 0 16
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicyTargetIds.java
  18. 0 28
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtTargetRunInfo.java
  19. 1 1
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/AdvertiserFundGetMapper.xml
  20. 0 21
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceAppletTokenRefreshMapper.java
  21. 0 48
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceProductUpdateMapper.java
  22. 0 8
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceRefreshTokenMapper.java
  23. 0 23
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/CPSReportMapper.java
  24. 0 21
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/DianzhongConfigMapper.java
  25. 1 1
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/DynamicInsertMapper.java
  26. 0 15
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/PromoteLinkRefreshMapper.java
  27. 0 49
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/ToolsSiteMapper.java
  28. 0 85
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/ZtPolicyMapper.java
  29. 3 3
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/AdminAdvertiserListMapper.xml
  30. 6 6
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceAccountReportMapper.xml
  31. 0 33
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceAppletTokenRefreshMapper.xml
  32. 28 28
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceCdpProjectListMapper.xml
  33. 3 3
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceMiniAppMapper.xml
  34. 8 8
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceProductReportMapper.xml
  35. 0 160
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceProductUpdateMapper.xml
  36. 6 6
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedancePromoterReportMapper.xml
  37. 2 48
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceRefreshTokenMapper.xml
  38. 15 15
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceXingTuMapper.xml
  39. 0 458
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/CPSReportMapper.xml
  40. 1 1
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/ChannelMapper.xml
  41. 4 4
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/DianZhongMapper.xml
  42. 0 104
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/DianzhongConfigMapper.xml
  43. 0 85
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/PromoteLinkRefreshMapper.xml
  44. 0 385
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/ToolsSiteMapper.xml
  45. 0 518
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/ZtPolicyMapper.xml
  46. 0 10
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/BytedanceAppletTokenRefreshService.java
  47. 0 21
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IBytedanceProductUpdateService.java
  48. 0 17
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IBytedancePromoteRefreshService.java
  49. 0 8
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IBytedanceRefreshTokenService.java
  50. 0 9
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/ICPSReportService.java
  51. 0 13
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IDianzhongConfigService.java
  52. 0 6
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IHealthCheckService.java
  53. 0 35
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IToolsSiteService.java
  54. 0 10
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IZtPolicyRunService.java
  55. 5 8
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceAccountReportServiceImpl.java
  56. 0 72
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceAppletTokenRefreshServiceImpl.java
  57. 6 6
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceCdpProjectServiceImpl.java
  58. 0 676
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceProductUpdateServiceImpl.java
  59. 0 209
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedancePromoteRefreshServiceImpl.java
  60. 0 81
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceRefreshTokenServiceImpl.java
  61. 0 54
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/CPSReportServiceImpl.java
  62. 0 144
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/DianzhongConfigServiceImpl.java
  63. 0 106
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/HealthCheckServiceImpl.java
  64. 0 343
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ToolsSiteServiceImpl.java
  65. 0 621
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ZtPolicyRunServiceImpl.java
  66. 0 43
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/AdminAdvertiserListJob.java
  67. 0 31
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BaiduYunJob.java
  68. 0 81
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceFlowDetailsReportJob.java
  69. 0 41
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAppletTokenRefreshJob.java
  70. 0 204
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCdpProjectJob.java
  71. 0 37
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceMiniAppJob.java
  72. 0 41
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceProductUploadJob.java
  73. 0 112
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePromoterReportJob.java
  74. 0 10
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceRefreshTokenJob.java
  75. 1 165
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceReportRetryJob.java
  76. 0 32
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceTestJob.java
  77. 0 79
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceUniProjectJob.java
  78. 0 73
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceXingTuJob.java
  79. 0 55
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/CLMaterialTaskJob.java
  80. 0 72
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/CPSReportJob.java
  81. 0 65
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ChangDuJob.java
  82. 0 23
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/DeepthinkHealthCheckJob.java
  83. 0 55
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/DianZhongJob.java
  84. 0 35
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/DianzhongConfigJob.java
  85. 0 113
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/PromoteLinkRefreshJob.java
  86. 0 135
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ToolsSiteJob.java
  87. 0 31
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/TrackJob.java
  88. 0 95
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ZtPolicyKob.java
  89. 66 3
      nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/utils/RedisConfig.java
  90. 2 2
      nj_job-bytedance/src/main/resources/application.yml
  91. 3 3
      nj_job-bytedance/src/main/resources/custom-report-config.json

+ 1 - 1
nj_job-bytedance/pom.xml

@@ -174,7 +174,7 @@
         <dependency>
             <groupId>redis.clients</groupId>
             <artifactId>jedis</artifactId>
-            <version>3.1.0</version>
+            <version>3.3.0</version>
         </dependency>
         <dependency>
             <groupId>org.redisson</groupId>

+ 0 - 233
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AdvertiserApplet.java

@@ -1,233 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-
-import java.util.Date;
-
-/**
- * 小程序对象 AdvertiserApplet
- *
- * @author ruoyi
- * @date 2025-03-07
- */
-@Data
-public class AdvertiserApplet {
-
-    /**
-     * 广告主ID
-     */
-    private Long advertiserId;
-
-    /**
-     * 小程序资产ID
-     */
-    private Long instanceId;
-
-    /**
-     * 小程序名称
-     */
-    private String appName;
-
-    /**
-     * 字节小程序备注名称
-     */
-    private String remark;
-
-    /**
-     * 小程序appid
-     */
-    private String appId;
-
-    /**
-     * 小程序原始ID,获取方式:小程序后台>设置>基本设置>账号信息>原始ID,例如“gh_”,最大长度不超过20
-     */
-    private String originalAppId;
-
-    /**
-     * 小程序类型:1-字节,2-微信
-     */
-    private String platType;
-
-    /**
-     * 审核状态: AUDIT_ACCEPTED 审核成功,AUDITING 审核中,AUDIT_REJECTED审核失败
-     */
-    private String auditStatus;
-
-    /**
-     * 小程序类型:1-字节,2-微信
-     */
-    private String reason;
-
-    /**
-     * (bytedance)小程序链接,以 sslocal://microapp 开头 。生效优先级大于 启动页面 和 启动参数  ,详细内容见接口说明
-     */
-    private String link;
-
-    /**
-     * (bytedance)链接备注
-     */
-    private String linkRemark;
-
-    /**
-     * (wx)小程序路径参数,如有跳转指定页面或自定义参数监测广告效果数据诉求,需填写。获取方式:登录关联的公众号后台>素材管理>新建图文素材>小程序>选择小程序>获取更多路径
-     */
-    private String path;
-
-    /**
-     * (wx)资产备注信息,最大长度不超过15
-     */
-    private String remarkMessage;
-
-    /**
-     * (wx)小程序icon图片的url,尺寸60*60px,大小不超2MB,图片格式要求jpeg、png或gif
-     */
-    private String iconImageUrl;
-
-    /**
-     * (wx)顶部头图的url,大小不超过5MB的图片,推荐尺寸2:1,图片格式要求jpeg、png或gif
-     */
-    private String headerImageUrl;
-
-    /**
-     * (wx)小程序标签,每个标签长度不超过6,最多支持6个标签
-     */
-    private String labels;
-
-    /**
-     * (wx)引导文案,最大长度不超过14
-     */
-    private String guideText;
-
-    /**
-     * (wx)竖图的url地址,要求尺寸必须为3:5,否则报错;最少3张,最多8张,大小不超过5MB;图片格式要求jpeg、png或gif,竖图和横图不能同时传
-     */
-    private String imagesVerticalUrl;
-
-    /**
-     * (wx)横图的url地址,要求尺寸必须为3:5,否则报错;最少3张,最多8张,大小不超过5MB;图片格式要求jpeg、png或gif,竖图和横图不能同时传
-     */
-    private String imagesHorizontalUrl;
-
-    /**
-     * (wx)小程序简介,最大长度不超过50
-     */
-    private String introduction;
-
-    /**
-     * 细分类型,填写细分类型的末级分类ID category_id
-     */
-    private String tagInfo;
-
-    /**
-     * (bytedance)启动页面,形如:page/home/xxx。不得以反斜线开头,不得以反斜线结尾,请避免参数中出现特殊字符
-     */
-    private String startPage;
-
-    /**
-     * (bytedance)启动参数,形如:name=zhangsan&age=25。不得以问号、连接符等特殊字符开头,请确保各参数间仅使用一个连接符
-     */
-    private String startParam;
-    /**
-     * 是否共享1是,0否
-     */
-    private String appShare;
-    /**
-     * 共享源广告主ID
-     */
-    private Long shareAdvertiserId;
-    /**
-     * 小程序创建时间
-     */
-    private String appCreateTime;
-    /**
-     * 小程序更新时间
-     */
-    private String appUpdateTime;
-    /**
-     * 任务ID
-     */
-    private String taskId;
-
-    /**
-     * 入参,排查问题
-     */
-    private String parameters;
-    /**
-     * 创建时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date createTime;
-
-    /**
-     * 更新时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date updateTime;
-
-    public AdvertiserApplet() {
-    }
-
-    public AdvertiserApplet(Long advertiserId, JSONObject entity, String platType) {
-        this.advertiserId = advertiserId;
-        this.appName = entity.getString("name");
-        this.appId = entity.getString("app_id");
-        this.originalAppId = entity.getString("user_name");
-        this.path = entity.getString("path");
-        this.instanceId = entity.getLong("instance_id");
-        this.auditStatus = entity.getString("audit_status");
-        this.reason = entity.getString("reason");
-        this.appCreateTime = entity.getString("create_time");
-        this.appUpdateTime = entity.getString("modify_time");
-        this.headerImageUrl = entity.getString("header_image_url");
-        this.imagesVerticalUrl = entity.getString("images_vertical_url");
-        this.iconImageUrl = entity.getString("icon_image_url");
-        this.introduction = entity.getString("introduction");
-        this.labels = entity.getString("labels");
-        this.remarkMessage = entity.getString("remark_message");
-        this.tagInfo = entity.getString("tag_info");
-        this.guideText = entity.getString("guide_text");
-        this.remark = entity.getString("remark");
-        this.platType = platType;
-    }
-
-    public AdvertiserApplet(String taskId, Long advertiserId, String appName, String appId, String tagInfo, String startPage, String startParam) {
-        this.taskId = taskId;
-        this.advertiserId = advertiserId;
-        this.appName = appName;
-        this.appId = appId;
-        this.tagInfo = tagInfo;
-        this.startPage = startPage;
-        this.startParam = startParam;
-    }
-
-    public AdvertiserApplet(AdvertiserApplet one) {
-        this.advertiserId = one.getAdvertiserId();
-        this.instanceId = one.getInstanceId();
-        this.platType = one.getPlatType();
-        this.appName = one.getAppName();
-        this.appId = one.getAppId();
-        this.remark = one.getRemark();
-        this.auditStatus = one.getAuditStatus();
-        this.originalAppId = one.getOriginalAppId();
-        this.reason = one.getReason();
-        this.link = one.getLink();
-        this.linkRemark = one.getLinkRemark();
-        this.path = one.getPath();
-        this.remarkMessage = one.getRemarkMessage();
-        this.iconImageUrl = one.getIconImageUrl();
-        this.headerImageUrl = one.getHeaderImageUrl();
-        this.labels = one.getLabels();
-        this.guideText = one.getGuideText();
-        this.imagesVerticalUrl = one.getImagesVerticalUrl();
-        this.imagesHorizontalUrl = one.getImagesHorizontalUrl();
-        this.introduction = one.getIntroduction();
-        this.tagInfo = one.getTagInfo();
-        this.startPage = one.getStartPage();
-        this.startParam = one.getStartParam();
-        this.appCreateTime = one.getAppCreateTime();
-        this.appUpdateTime = one.getAppUpdateTime();
-        this.taskId = one.getTaskId();
-    }
-}

+ 0 - 120
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AdvertiserAvatar.java

@@ -1,120 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-
-import java.util.Date;
-
-/**
- * 【广告主账户头像】对象 advertiser_avatar
- *
- * @author ruoyi
- * @date 2025-03-03
- */
-@Data
-public class AdvertiserAvatar {
-    /**
-     * 广告主id
-     */
-    private Long advertiserId;
-
-    /**
-     * 头像审核状态 0-未设置,1-审核中,2-审核被拒,3-审核通过
-     */
-    private String avatarStatus;
-
-    /**
-     * 头像被拒原因
-     */
-    private String avatarReason;
-
-    /**
-     * 品牌审核状态 0-未设置,1-审核中,2-审核被拒,3-审核通过
-     */
-    private String sourceStatus;
-
-    /**
-     * 品牌信息
-     */
-    private String sourceInfo;
-
-    /**
-     * 品牌信息被拒原因
-     */
-    private String sourceReason;
-
-    /**
-     * 当前头像的uri
-     */
-    private String webUri;
-
-    /**
-     * 审核中头像的uri
-     */
-    private String auditWebUri;
-
-    /**
-     * 审核中头像的高度
-     */
-    private Long height;
-
-    /**
-     * 审核中头像的宽度
-     */
-    private Long width;
-
-    /**
-     * 当前头像的预览链接,有效期1h
-     */
-    private String webUrl;
-
-    /**
-     * oss路径
-     */
-    private String ossUrl;
-    /**
-     * 原因
-     */
-    private String reason;
-    /**
-     * 入参,排查问题
-     */
-    private String parameters;
-
-    /**
-     * 审核中头像的预览链接,有效期1h
-     */
-    private String auditWebUrl;
-
-    /**
-     * 创建时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date createTime;
-
-    /**
-     * 更新时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date updateTime;
-
-    public AdvertiserAvatar() {
-    }
-
-    public AdvertiserAvatar(JSONObject data) {
-        this.advertiserId = data.getLong("advertiser_id");
-        this.avatarStatus = data.getString("avatar_status");
-        this.avatarReason = data.getString("avatar_reason");
-        this.sourceStatus = data.getString("source_status");
-        this.sourceInfo = data.getString("source_info");
-        this.sourceReason = data.getString("source_reason");
-        JSONObject avatarInfo = data.getJSONObject("avatar_info");
-        this.webUri = avatarInfo.getString("web_uri");
-        this.auditWebUri = avatarInfo.getString("audit_web_uri");
-        this.height = avatarInfo.getLong("height");
-        this.width = avatarInfo.getLong("width");
-        this.webUrl = avatarInfo.getString("web_url");
-        this.auditWebUrl = avatarInfo.getString("audit_web_url");
-    }
-}

+ 0 - 65
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AdvertiserNameInfo.java

@@ -1,65 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-
-import java.util.Date;
-
-/**
- * 【广告主账户名称】对象 advertiser_name_info
- */
-@Data
-public class AdvertiserNameInfo {
-    /**
-     * 广告主id
-     */
-    private Long advertiserId;
-
-    /**
-     * 广告主名称
-     */
-    private String advertiserName;
-
-    /**
-     * 头像审核状态:STATUS_PENDING_CONFIRM:审核中;STATUS_PENDING_CONFIRM:审核失败;STATUS_ENABLE:审核通过;STATUS_CONFIRM_FAIL_END:审核失败;FAIL:创建失败
-     */
-    private String advertiserStatus;
-
-    /**
-     * 原因
-     */
-    private String reason;
-    /**
-     * 入参,排查问题
-     */
-    private String parameters;
-
-    /**
-     * 创建时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date createTime;
-
-    /**
-     * 更新时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date updateTime;
-
-    public AdvertiserNameInfo() {
-    }
-
-    public AdvertiserNameInfo(Long advertiserId, String advertiserName, String advertiserStatus) {
-        this.advertiserId = advertiserId;
-        this.advertiserName = advertiserName;
-        this.advertiserStatus = advertiserStatus;
-    }
-
-    public AdvertiserNameInfo(Long advertiserId, String reason, String advertiserStatus, String parameters) {
-        this.advertiserId = advertiserId;
-        this.reason = reason;
-        this.advertiserStatus = advertiserStatus;
-        this.parameters = parameters;
-    }
-
-}

+ 0 - 120
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AdvertiserToolsSite.java

@@ -1,120 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-
-import java.util.Date;
-
-/**
- * 落地页建站站点对象 advertiser_tools_site
- *
- * @date 2025-03-03
- */
-@Data
-public class AdvertiserToolsSite {
-
-    /**
-     * 建站id
-     */
-    private String siteId;
-
-    /**
-     * 广告主ID
-     */
-    private Long advertiserId;
-
-    /**
-     * 建站名称
-     */
-    private String name;
-
-    /**
-     * 站点缩略图
-     */
-    private String thumbnail;
-
-    /**
-     * 建站状态 AUDIT_ACCEPTED:通过,AUDIT_REJECTED:拒绝,
-     */
-    private String status;
-
-    /**
-     * 建站类型 :UNIVERSAL:默认
-     */
-    private String siteType;
-
-    /**
-     * 建站类别
-     */
-    private String functionType;
-
-    /**
-     * 创建类型 1-橙子建站
-     */
-    private String createType;
-    /**
-     * 原因
-     */
-    private String reason;
-    /**
-     * 任务批次ID
-     */
-    private String taskId;
-
-    /**
-     * 入参
-     */
-    private String parameters;
-    /**
-     * 创建时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date createTime;
-
-    /**
-     * 更新时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date updateTime;
-
-    public AdvertiserToolsSite() {
-    }
-
-    public AdvertiserToolsSite(Long advertiserId, String siteId, String status, String taskId) {
-        this.advertiserId = advertiserId;
-        this.siteId = siteId;
-        this.status = status;
-        this.taskId = taskId;
-    }
-
-    public AdvertiserToolsSite(Long advertiserId, String siteId, String reason, String name, String parameters, String taskId) {
-        this.advertiserId = advertiserId;
-        this.siteId = siteId;
-        this.reason = reason;
-        this.name = name;
-        this.parameters = parameters;
-        this.taskId = taskId;
-    }
-
-    public AdvertiserToolsSite(JSONObject data, Long advertiserId, String createType) {
-        this.advertiserId = advertiserId;
-        this.siteId = data.getString("siteId");
-        this.name = data.getString("name");
-        this.thumbnail = data.getString("thumbnail");
-        this.status = data.getString("status");
-        this.siteType = data.getString("siteType");
-        this.createType = createType;
-    }
-
-    public AdvertiserToolsSite(JSONObject data, Long advertiserId, String name, String createType, String taskId) {
-        this.advertiserId = advertiserId;
-        this.siteId = data.getString("id");
-        this.name = name;
-        this.thumbnail = data.getString("thumbnail");
-        this.status = data.getString("status");
-        this.siteType = data.getString("site_type");
-        this.createType = createType;
-        this.taskId = taskId;
-    }
-}

+ 0 - 39
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AigcProductAlbum.java

@@ -1,39 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import lombok.Data;
-
-@Data
-public class AigcProductAlbum {
-    /*
-    third.album_id, third.platform_type, detail.platform_config, video.id as video_id, detail.id as video_detail_id, video.name as name, video.cover_img as img,ifnull(category.name, '其他') as 'theme', video.play_platform,
-        '天津星链视界信息技术有限公司' as copyright_owner, '5' as membership_types, '2' as has_motivation_types,
-        payinfo.maxpay as max_charge, payinfo.minpay as min_charge, maxpay as recommended_charge, maxpay as price,
-         1 as has_motivation_content
-     */
-    private String albumId;
-    private String platformType;
-    private String platformConfig;
-    private Long videoId;
-    private Long videoDetailId;
-    private String name;
-    private String img;
-    private String theme;
-    private String playPlatform;
-    private String copyrightOwner;
-    private String membershipTypes;
-    private String hasMotivationTypes;
-    private Integer maxCharge;
-    private Integer minCharge;
-    private Integer recommendedCharge;
-    private Integer price;
-    private Integer hasMotivationContent;
-
-    private Integer startingUnlockEpisode;
-
-    private Integer source;
-
-    private String albumLink;
-    private String businessMethod;
-
-    private String productId;
-}

+ 0 - 37
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/AigcProductPlatform.java

@@ -1,37 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import lombok.Data;
-
-@Data
-public class AigcProductPlatform {
-    private String platformId;//商品库ID
-    private String advertiserId;//所属主账户ID
-    private Integer type;//商品库类型 1:免费 2:付费
-    private Integer platformType;//商品库定位分类 1:抖音小程序(+微信小程序) 2:仅微信小程序 3:端原生
-    private String platformName;//商品库名称
-    private String miniInstanceId;//字节小程序实例ID
-    private String updateTime;//更新时间
-    private String createTime;//创建时间
-    private String miAppid;//使用的小程序ID
-    private Integer membershipTypes;//设置的字节会员类型
-    private Double maxCharge;//最大充值金额
-    private Double minCharge;//最小充值金额
-    private Double recommendedCharge;//推荐充值金额
-    private Double singlePrice;//单价
-    private Integer status;//状态 0:使用中 1:废弃
-    private String socialCreditCode;//管家账号社会信用代码
-    private Integer movieAuthStatus;//剧目认证状态,0-未认证,1-已认证
-    private Integer isBytedance;//投放载体-字节小程序 1:开启 0:关闭
-    private Integer isWechat;//投放载体-微信小程序 1:开启 0:关闭
-    private Integer isDys;//投放载体-端原生 1:开启 0:关闭
-    private Integer source;//短剧来源:1-自投;2-穿山甲,3-爱奇艺
-    private String accessToken;//商品库主账户access_token
-
-    private String miniAppAdvertiserId;//小程序主账户ID
-
-    private String copyrightOwner;
-
-    private String devAppId;//开发者应用ID
-
-
-}

+ 0 - 20
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/DianzhongDistributorConfig.java

@@ -1,20 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import lombok.Data;
-
-@Data
-public class DianzhongDistributorConfig {
-    private String distributorId;//渠道账号ID
-    private String distributorName;//渠道账号名称
-    private String nickName;//渠道昵称
-    private String dianzhongAccountId;
-    private String channelCreateTime;//渠道端创建时间
-    private String jumpType;//1:单端 2:双端
-    private String ofAppid;//公众号(小程序)appid
-    private String ofName;//公众号名称
-    private String remark;//备注
-    private String createBy;//创建者
-    private String createTime;//创建时间
-    private String updateBy;//更新者
-    private String updateTime;//修改时间
-}

+ 0 - 24
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/DianzhongMovieConfig.java

@@ -1,24 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import lombok.Data;
-
-@Data
-public class DianzhongMovieConfig {
-
-    private String movieId; //剧目ID
-    private String movieName; //剧目名称
-    private String coverImgUrl; //封面图链接
-    private Integer chapterCount;
-    private Integer freeChapterCount;
-    private String type1; //男频/女频
-    private String type2; //二级分类
-    private String type3; //三级分类
-    private String firstShelfTime; //上架时间
-    private String remark; //备注
-    private String createBy; //创建者
-    private String createTime; //创建时间
-    private String updateBy; //更新者
-    private String updateTime; //修改时间
-    private String infoJson;//原始json
-
-}

+ 0 - 20
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtActionLog.java

@@ -1,20 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import lombok.Data;
-
-@Data
-public class ZtActionLog {
-    String id;
-    String runId;
-    Long policyId;
-    Integer targetType;//触发目标类型:1=账号 2=项目 3=计划
-    String targetId;
-    Long actionId;
-    Integer actionType;//操作类型:1=调整巨量账号预算 2=调整巨量项目预算 3=调整巨量计划预算 10=发送飞书
-    Integer executed;//是否实际执行:1=是 0=否
-    Integer skipReason;//未执行原因(executed=0时);1:不在发送时段 2:触发频控 3:动作未启用 4:参数校验失败 5:当前版本不支持 9:其他
-    Integer resultStatus = 1;
-    String errorMessage;
-
-
-}

+ 0 - 48
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicy.java

@@ -1,48 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import lombok.Data;
-
-import java.util.List;
-import java.util.Map;
-
-@Data
-public class ZtPolicy {
-
-    private Integer id;
-    private String name;
-    private Integer status;//1开启 0停用
-    private Integer mediaId;
-    private String mediaName;
-    private Integer scheduleType;//1半小时 2小时 3天
-    private Integer managedDimension;//托管目标维度 1账号 2项目 3计划
-    private Integer targetScope;//1所有广告账号 2选定广告账号 3选定广告项目 4选定广告计划
-    private Integer conditionLogic;//判断条件组合 1且 2或
-    private String createdBy;
-    private String createdAt;
-    private String updatedBy;
-    private String updatedAt;
-    private Long createUserId;//归属人,用这个判断权限和飞书推送发给谁
-    private Integer isDeleted;
-
-    //托管目标过滤条件
-    private List<Integer> businessLine;
-    private String businessLineName;
-    private List<String> appId;
-    private List<String> appName;
-    private List<String> businessMethod;
-    private List<Long> optimizerId;
-    private List<Long> deptId;
-    private List<String> movieId;
-
-    //目标范围ID(维度为targetScope定义的,不一定是托管目标的维度)
-    private List<String> targetScopeIds;
-
-    //最终托管目标ID,运行任务目标以这个+managedDimension为准
-    private List<String> targetResIds;
-
-    private List<ZtPolicyCondition> conditions;
-    private List<ZtPolicyAction>  actions;
-    private boolean saveAsTemplate = false;
-
-    private Map<String, String> targetFromAdvertiserId;//目标ID所属的广告账号ID
-}

+ 0 - 16
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicyAction.java

@@ -1,16 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
-
-@Data
-public class ZtPolicyAction {
-
-    private Long id;
-    private Integer ownerType;
-    private Long ownerId;
-    private Integer actionType;
-    private String actionRuleJson;
-    private JSONObject actionRuleJsonObject;
-    private String descriptionZh;
-}

+ 0 - 18
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicyCondition.java

@@ -1,18 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
-
-@Data
-public class ZtPolicyCondition {
-
-    private Long id;
-    private Integer ownerType;
-    private Long ownerId;
-    private Long indicatorId;
-    private String operator;
-    private Integer timeType;
-    private String compareValueJson;
-    private JSONObject compareValueJsonObject;
-    private String descriptionZh;
-}

+ 0 - 26
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicyConfig.java

@@ -1,26 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class ZtPolicyConfig {
-    private Long id;
-    private Integer mediaId;
-    private String name;
-    private Integer status;
-    private Integer scheduleType;
-    private Integer managedDimension;
-    private Integer targetScope;
-    private Integer conditionLogic;
-    private String createdBy;
-    private String updatedBy;
-    private Long createUserId;
-
-    private String createdAt;
-    private String updatedAt;
-    private Integer isDeleted;
-}

+ 0 - 22
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicyRunInfo.java

@@ -1,22 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import lombok.Data;
-
-import java.util.Date;
-
-/**
- * 策略一次运行的整体信息
- */
-@Data
-public class ZtPolicyRunInfo {
-
-    private String runId;
-    private Long policyConfigId;
-    private Date scheduledTime;
-    private Date startTime;
-    private Date endTime;
-    private Integer triggered;
-    private Integer triggerNum;
-    private Integer resultStatus;
-    private String errorMessage;
-}

+ 0 - 20
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicyTargetFilter.java

@@ -1,20 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import lombok.Data;
-
-@Data
-public class ZtPolicyTargetFilter {
-
-    private Long policyConfigId;
-    //目标维度:1=广告账号(当前仅支持账号)
-    private Integer targetDimension;
-    //筛选字段:1=app 2=businessLine 3=businessMethod 4=optimizerId 5=deptId 6=movieId
-    private Integer filterKey;
-    private String filterValue;
-
-    public ZtPolicyTargetFilter(Integer targetDimension, Integer filterKey, String filterValue) {
-        this.targetDimension = targetDimension;
-        this.filterKey = filterKey;
-        this.filterValue = filterValue;
-    }
-}

+ 0 - 16
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtPolicyTargetIds.java

@@ -1,16 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import lombok.Data;
-
-@Data
-public class ZtPolicyTargetIds {
-
-    private Long policyConfigId;
-    private Integer targetType;//目标类型:1=广告账号 2=广告项目 3=广告计划
-    private String targetId;//目标ID(账号/项目/计划ID)
-
-    public ZtPolicyTargetIds(Integer targetType, String targetId) {
-        this.targetType = targetType;
-        this.targetId = targetId;
-    }
-}

+ 0 - 28
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/ZtTargetRunInfo.java

@@ -1,28 +0,0 @@
-package cn.com.ctop.job.bytedance.data.entity;
-
-import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
-
-import java.util.Date;
-
-@Data
-public class ZtTargetRunInfo {
-
-    String uuid;
-    String runId;
-    Long advertiserId;
-    Long policyId;
-    Integer managedDimension;//托管目标维度 1账号 2项目 3计划
-    String targetId;//目标ID
-    ZtPolicyCondition condition;
-    JSONObject indicatorInfo;
-    String currentValue;//实际值
-    Long conditionId;
-
-    Boolean isExecute;//是否触发操作
-    Date triggerTime;
-    JSONObject matchedConditionJson;
-    String matchedConditionJsonStr;
-    String matchedConditionDesc;
-
-}

+ 1 - 1
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/AdvertiserFundGetMapper.xml

@@ -4,7 +4,7 @@
 
 
     <insert id="insertData">
-        replace INTO media_api.bytedance_advertiser_fund (
+        replace INTO nuojing_data.bytedance_advertiser_fund (
             advertiser_id,
             stat_date,
             wallet_total_balance_valid,

+ 0 - 21
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceAppletTokenRefreshMapper.java

@@ -1,21 +0,0 @@
-package cn.com.ctop.job.bytedance.data.mapper;
-
-
-import com.alibaba.fastjson.JSONObject;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * 头条项目列Mapper接口
- *
- * @author ruoyi
- * @date 2025-04-23
- */
-public interface BytedanceAppletTokenRefreshMapper {
-
-    List<JSONObject> queryAppletList();
-
-    void refreshAppletTokens(@Param("list") List<JSONObject> list);
-
-}

+ 0 - 48
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceProductUpdateMapper.java

@@ -1,48 +0,0 @@
-package cn.com.ctop.job.bytedance.data.mapper;
-
-import cn.com.ctop.job.bytedance.data.entity.AigcProductAlbum;
-import cn.com.ctop.job.bytedance.data.entity.AigcProductPlatform;
-import com.alibaba.fastjson.JSONObject;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface BytedanceProductUpdateMapper {
-
-    List<String> allPlatform();
-
-    List<AigcProductPlatform> getPlatformInitList(@Param("businessMethod") String businessMethod);
-    List<AigcProductPlatform> getPlatformList(@Param("businessMethod") String businessMethod, @Param("platformId") String platformId);
-    List<JSONObject> getProductTypeEnums(@Param("businessMethod") String businessMethod);
-
-    List<AigcProductAlbum> getIAPVideoList();
-    List<AigcProductAlbum> getIAAVideoList();
-
-
-    int updateInstanceId(@Param("advertiserId") String advertiserId, @Param("instanceId") String instanceId, @Param("source") Integer source);
-
-    JSONObject getVideoInfo(@Param("videoId") Long videoId);
-    List<JSONObject> getVideoDetail(@Param("videoId") Long videoId);
-
-
-    List<JSONObject> getUploadList();
-
-    JSONObject getDeveloperAccount();
-
-    int insertAlbumInfo(@Param("albumId") String albumId,
-                        @Param("videoId") Long videoId);
-
-    List<JSONObject> selectWaitingAlbums();
-
-    int updateAlbumInfo(@Param("albumId") String albumId,
-                        @Param("canPromotion") int status,
-                        @Param("cannotReason") String failReason);
-
-    List<JSONObject> getDouyinMovieAuthList();
-
-    int updateMovieAuthStatus(@Param("platformId") String platformId);
-
-
-    int batchInsertPlatform(List<AigcProductPlatform> platformList);
-
-}

+ 0 - 8
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceRefreshTokenMapper.java

@@ -12,17 +12,9 @@ public interface BytedanceRefreshTokenMapper {
 
     void updateTokenByAdminAdvertiserId(@Param("adminAdvertiserId") Long adminAdvertiserId, @Param("updateAccessToken") String updateAccessToken, @Param("updateRefreshToken") String updateRefreshToken);
 
-    List<JSONObject> getBaiduYunTokenList();
-
-    void updateBaiduYunToken(@Param("obj") JSONObject obj);
-
     String onlyGetToken(@Param("advertiserId") Long advertiserId);
 
     JSONObject getAuthConfig(@Param("advertiserId") Long advertiserId);
 
     String onlyGetADQToken(@Param("advertiserId") Long advertiserId);
-
-    List<JSONObject> queryOfficialAccounts();
-
-    void refreshAppletTokens(@Param("list") List<JSONObject> list);
 }

+ 0 - 23
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/CPSReportMapper.java

@@ -1,23 +0,0 @@
-package cn.com.ctop.job.bytedance.data.mapper;
-
-import com.alibaba.fastjson.JSONObject;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface CPSReportMapper {
-
-    boolean cleanCPSPayDailyReports(@Param("nowDate") String nowDate);
-
-    List<JSONObject> queryCPSIaaDaily(@Param("nowDate") Integer nowDate, @Param("dateStr") String dateStr);
-
-    boolean cleanCPSIaaDailyReportsDS(@Param("list") List<JSONObject> list);
-
-    int runCPSIapSettlementData(@Param("dateStr") String dateStr, @Param("dateLong") String dateLong, @Param("st") Long st);
-    List<JSONObject> runCPSIaaDySettlementData(@Param("dateStr") String dateStr, @Param("dateLong") String dateLong, @Param("st") Long st);
-
-    int saveIaaDySettlementData(List<JSONObject> list);
-
-
-
-}

+ 0 - 21
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/DianzhongConfigMapper.java

@@ -1,21 +0,0 @@
-package cn.com.ctop.job.bytedance.data.mapper;
-
-import cn.com.ctop.job.bytedance.data.entity.DianzhongDistributorConfig;
-import cn.com.ctop.job.bytedance.data.entity.DianzhongMovieConfig;
-
-import java.util.List;
-
-public interface DianzhongConfigMapper {
-
-    int insertConfigSelective(DianzhongMovieConfig config);
-
-    int insertDistributorConfigSelective(DianzhongDistributorConfig config);
-
-    List<String> getAllMovieIds();
-
-    int updateMovieImage(DianzhongMovieConfig config);
-
-    List<DianzhongMovieConfig> toUploadImageList();
-
-
-}

+ 1 - 1
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/DynamicInsertMapper.java

@@ -16,7 +16,7 @@ public interface DynamicInsertMapper {
     /**
      * 动态列插入
      *
-     * @param table 目标表名(可带库名前缀,如 media_api.bytedance_uni_project_list)
+     * @param table 目标表名(可带库名前缀,如 nuojing_data.bytedance_uni_project_list)
      * @param data  列名与值的键值对(如 JSONObject),按遍历顺序生成列与值
      */
     int insertDynamic(@Param("table") String table, @Param("data") Map<String, Object> data);

+ 0 - 15
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/PromoteLinkRefreshMapper.java

@@ -1,15 +0,0 @@
-package cn.com.ctop.job.bytedance.data.mapper;
-
-import com.alibaba.fastjson.JSONObject;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface PromoteLinkRefreshMapper {
-
-    List<JSONObject> refreshList(@Param("expireTime") Long expireTime);
-
-    int updateLink(@Param("uuid") String uuid, @Param("url") String url, @Param("expireTime") Long expireTime);
-
-    int updateRunStatus(@Param("startTime") String startTime, @Param("endTime") String endTime);
-}

+ 0 - 49
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/ToolsSiteMapper.java

@@ -1,49 +0,0 @@
-package cn.com.ctop.job.bytedance.data.mapper;
-
-import cn.com.ctop.job.bytedance.data.entity.AdvertiserApplet;
-import cn.com.ctop.job.bytedance.data.entity.AdvertiserAvatar;
-import cn.com.ctop.job.bytedance.data.entity.AdvertiserNameInfo;
-import cn.com.ctop.job.bytedance.data.entity.AdvertiserToolsSite;
-import com.alibaba.fastjson.JSONObject;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface ToolsSiteMapper {
-
-    void replaceAdvertiserToolsSite(@Param("siteList") List<AdvertiserToolsSite> siteList);
-
-    List<Long> getAvatarAdvertiserIds();
-
-    public boolean updateAdvertiserAvatar(AdvertiserAvatar advertiserAvatar);
-
-    public boolean insertAdvertiserAvatar(AdvertiserAvatar advertiserAvatar);
-
-    List<Long> getNameAdvertiserIds();
-
-    boolean updateAdvertiserNameInfo(AdvertiserNameInfo nameInfo);
-
-    boolean insertAdvertiserNameInfo(AdvertiserNameInfo nameInfo);
-
-    List<Long> getAppAdvertiserIds(String platType);
-
-    boolean updateAdvertiserAppList(AdvertiserApplet advertiserApplet);
-
-    boolean insertAdvertiserAppList(AdvertiserApplet advertiserApplet);
-
-    boolean updateAdvertiserAppList2(AdvertiserApplet advertiserApplet);
-
-    List<Long> getsiteAdvertiserIds();
-
-    List<JSONObject> getsiteAdvertiserIds2();
-
-    boolean updateAdvertiserToolsSite(AdvertiserToolsSite advertiserToolsSite);
-
-    boolean insertAdvertiserToolsSite(AdvertiserToolsSite advertiserToolsSite);
-
-    List<JSONObject> queryIsCreateSite(@Param("advertiserId") Long advertiserId, @Param("instanceId") Long instanceId);
-
-    List<AdvertiserApplet> queryAdvertiserAppList(@Param("advertiserId") Long advertiserId, @Param("platType") String platType);
-
-    List<JSONObject> getTimeOutAppList();
-}

+ 0 - 85
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/ZtPolicyMapper.java

@@ -1,85 +0,0 @@
-package cn.com.ctop.job.bytedance.data.mapper;
-
-import cn.com.ctop.job.bytedance.data.entity.*;
-
-import com.alibaba.fastjson.JSONObject;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface ZtPolicyMapper {
-
-    ZtPolicy getPolicyDetail(@Param("policyId") Long policyId);
-    List<ZtPolicyTargetFilter> getTargetFilters(@Param("policyId") Long policyId);
-    List<ZtPolicyTargetIds> getTargetIds(@Param("policyId") Long policyId);
-
-    List<JSONObject> advFilterList(
-                               @Param("appId") List<String> appId,
-                               @Param("businessLine") List<Integer> businessLine,
-                               @Param("businessMethod") List<String> businessMethod,
-                               @Param("optimizerId") List<Long> optimizerId,
-                               @Param("deptId") List<Long> deptId,
-                               @Param("movieId") List<String> movieId
-    );
-
-    List<JSONObject> adProjFilterList(
-            @Param("appId") List<String> appId,
-            @Param("businessLine") List<Integer> businessLine,
-            @Param("businessMethod") List<String> businessMethod,
-            @Param("optimizerId") List<Long> optimizerId,
-            @Param("deptId") List<Long> deptId,
-            @Param("movieId") List<String> movieId
-    );
-
-    List<JSONObject> adPromFilterList(
-            @Param("appId") List<String> appId,
-            @Param("businessLine") List<Integer> businessLine,
-            @Param("businessMethod") List<String> businessMethod,
-            @Param("optimizerId") List<Long> optimizerId,
-            @Param("deptId") List<Long> deptId,
-            @Param("movieId") List<String> movieId
-    );
-
-    List<String> advListFromAdvIds(@Param("policyId") Long policyId);
-    List<JSONObject> projectListFromAdvIds(@Param("policyId") Long policyId);
-    List<JSONObject> projectListFromProjIds(@Param("policyId") Long policyId);
-    List<JSONObject> adListFromAdvIds(@Param("policyId") Long policyId);
-    List<JSONObject> adListFromAdIds(@Param("policyId") Long policyId);
-
-    /**
-     * @Param("indicatorSql") String indicatorSql,
-     * @Param("mediaAdSql") String mediaAdSql,
-     * @Param("userDataSql") String userDataSql,
-     * @Param("managedDimension") Integer managedDimension,
-     * @Param("idList") List<String> idList,
-     * @Param("timeType") Integer timeType,//1按天 2按小时
-     * 按天: startDate, endDate
-     * 按小时: 今日累计, 今日分小时
-     * @return
-     */
-    List<JSONObject> adData(JSONObject requestParam);
-    List<JSONObject> promotionData(@Param("idList") List<String> idList);
-    List<JSONObject> promotionGroupToProjectData(@Param("idList") List<String> idList);
-    List<JSONObject> projectData(@Param("idList") List<String> idList);
-
-    List<JSONObject> balanceData(@Param("idList") List<String> idList);
-
-    List<JSONObject> indicatorList(@Param("indicatorIds") List<Long> indicatorIds);
-
-    int insertRunRecords(List<ZtTargetRunInfo> list);
-
-    int updatePolicyRunRecord(ZtPolicyRunInfo ztPolicyRunInfo);
-    int insertPolicyRunRecord(ZtPolicyRunInfo ztPolicyRunInfo);
-
-    int insertActionLog(List<ZtActionLog> list);
-
-
-    List<String> businessLineName(List<Integer> businessLine);
-    List<JSONObject> advertiserTargetNameInfo(List<String> targetIds);
-    List<JSONObject> projectTargetNameInfo(List<String> targetIds);
-    List<JSONObject> promotionTargetNameInfo(List<String> targetIds);
-
-
-
-
-}

+ 3 - 3
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/AdminAdvertiserListMapper.xml

@@ -91,12 +91,12 @@
         SELECT *
         FROM (SELECT t1.advertiser_id AS 'advertiserId', t3.access_token AS 'accessToken'
               FROM (SELECT advertiser_id
-                    FROM media_api.bytedance_advertiser_report_hour
+                    FROM nuojing_data.bytedance_advertiser_report_hour
                     WHERE stat_time_day >= 20250601
                       AND stat_time_day &lt;= 20250603
                     GROUP BY advertiser_id) t1
-                       LEFT JOIN tidb.deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
-                       LEFT JOIN tidb.deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id) t
+                       LEFT JOIN deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
+                       LEFT JOIN deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id) t
         WHERE t.advertiserId IS NOT NULL
 
     </select>

+ 6 - 6
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceAccountReportMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="cn.com.ctop.job.bytedance.data.mapper.BytedanceAccountReportMapper">
 
     <insert id="replaceAccountReportHour">
-        replace into media_api.bytedance_advertiser_report_hour (
+        replace into nuojing_data.bytedance_advertiser_report_hour (
         advertiser_id,
         stat_time_day,
         `hour`,
@@ -65,7 +65,7 @@
     </insert>
 
     <insert id="replaceAccountReportHourSD">
-        insert into media_api.bytedance_advertiser_report_hour (
+        insert into nuojing_data.bytedance_advertiser_report_hour (
         advertiser_id,
         stat_time_day,
         `hour`,
@@ -127,7 +127,7 @@
     </insert>
 
     <insert id="replaceAccountReportDaily">
-        replace into media_api.bytedance_advertiser_report_daily (
+        replace into nuojing_data.media_bytedance_advertiser_report_daily (
         advertiser_id,
         stat_time_day,
         stat_pay_amount,
@@ -188,7 +188,7 @@
     </insert>
 
     <insert id="replaceAccountReportDailySD">
-        insert into media_api.bytedance_advertiser_report_daily (
+        insert into nuojing_data.bytedance_advertiser_report_daily (
         advertiser_id,
         stat_time_day,
         stat_pay_amount,
@@ -249,7 +249,7 @@
     </insert>
 
     <insert id="replaceErrorInfo" parameterType="cn.com.ctop.job.bytedance.data.entity.BytedanceErrorLog">
-        replace into media_api.bytedance_error_log
+        replace into nuojing_data.bytedance_error_log
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="advertiserId != null">advertiser_id,</if>
             <if test="startDate != null">start_date,</if>
@@ -270,7 +270,7 @@
     </insert>
     <delete id="deleteInfoByErrorId" parameterType="java.lang.Long">
         DELETE
-        FROM bytedance_error_log
+        FROM nuojing_data.bytedance_error_log
         WHERE id = #{errorId}
     </delete>
     <select id="getTokenByAdvertiserId" resultType="java.lang.String">

+ 0 - 33
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceAppletTokenRefreshMapper.xml

@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="cn.com.ctop.job.bytedance.data.mapper.BytedanceAppletTokenRefreshMapper">
-
-    <select id="queryAppletList" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT t1.id,
-               t1.name,
-               t1.app_id AS 'appId', t1.app_secret AS 'appSecret', t2.id as 'officialAccountId'
-        FROM thirtpart.ly_applet t1
-                 LEFT JOIN thirtpart.ly_official_accounts t2 ON t1.id = t2.applet_id
-        WHERE t1.source != 2
-	AND t1.type =2
-    </select>
-
-    <insert id="refreshAppletTokens">
-        replace into thirtpart.applet_tokens (
-        app_id,
-        official_account_id,
-        applet_id,
-        token
-        )
-        values
-        <foreach collection="list" item="item" separator=",">
-            (
-            #{item.appId},
-            #{item.officialAccountId},
-            #{item.id},
-            #{item.token}
-            )
-        </foreach>
-    </insert>
-
-</mapper>

+ 28 - 28
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceCdpProjectListMapper.xml

@@ -5,7 +5,7 @@
 <mapper namespace="cn.com.ctop.job.bytedance.data.mapper.BytedanceCdpProjectMapper">
 
     <insert id="replaceBytedanceCdpProjectList">
-        replace into media_api.bytedance_cdp_project_list (
+        replace into nuojing_data.bytedance_cdp_project_list (
         advertiser_id,
         project_id,
         project_name,
@@ -69,7 +69,7 @@
     </insert>
 
     <insert id="replaceBytedanceCdpProjectListSD">
-        insert into media_api.bytedance_cdp_project_list (
+        insert into nuojing_data.bytedance_cdp_project_list (
         advertiser_id,
         project_id,
         project_name,
@@ -133,7 +133,7 @@
     </insert>
 
     <insert id="replaceBytedancePromotionList">
-        replace into media_api.bytedance_promotion_list (
+        replace into nuojing_data.bytedance_promotion_list (
         advertiser_id,
         project_id,
         promotion_id,
@@ -163,7 +163,7 @@
     </insert>
 
     <insert id="replaceBytedancePromotionListSD">
-        insert into media_api.bytedance_promotion_list (
+        insert into nuojing_data.bytedance_promotion_list (
         advertiser_id,
         project_id,
         promotion_id,
@@ -194,7 +194,7 @@
 
     <insert id="insertErrorAdvertiserId">
         replace
-        into media_api.error_advertiser (advertiser_id,`type`)
+        into nuojing_data.error_advertiser (advertiser_id,`type`)
         values(
         #{advertiserId},
         #{type}
@@ -202,7 +202,7 @@
     </insert>
 
     <insert id="replaceBytedanceByteAppInfo">
-        replace into media_api.bytedance_byte_app_info (
+        replace into nuojing_data.bytedance_byte_app_info (
         advertiser_id,
         byte_app_name,
         byte_app_id,
@@ -221,7 +221,7 @@
 
 
     <insert id="replaceBytedanceByteAppLinkInfo">
-        replace into media_api.bytedance_tools_asset_link_list (
+        replace into nuojing_data.bytedance_tools_asset_link_list (
         advertiser_id,
         link_id,
         instance_id,
@@ -252,7 +252,7 @@
     </insert>
 
     <insert id="replaceBytedanceByteAppLinkInfoSD">
-        insert into media_api.bytedance_tools_asset_link_list (
+        insert into nuojing_data.bytedance_tools_asset_link_list (
         advertiser_id,
         link_id,
         instance_id,
@@ -284,7 +284,7 @@
 
 
     <insert id="replaceBytedanceWxAppInfo">
-        replace into media_api.bytedance_wx_app_info (
+        replace into nuojing_data.bytedance_wx_app_info (
         advertiser_id,
         app_name,
         user_nme,
@@ -304,7 +304,7 @@
     </insert>
 
     <insert id="replaceBytedanceWxAppInfoSD">
-        insert into media_api.bytedance_wx_app_info (
+        insert into nuojing_data.bytedance_wx_app_info (
         advertiser_id,
         app_name,
         user_nme,
@@ -325,7 +325,7 @@
 
     <insert id="insertTTErrorAdvertiserId">
         replace
-        into media_api.error_advertiser_tt (advertiser_id)
+        into nuojing_data.error_advertiser_tt (advertiser_id)
         values(
         #{advertiserId}
         )
@@ -337,47 +337,47 @@
 
     <select id="queryErrApps" resultType="Long">
         SELECT advertiser_id
-        FROM media_api.error_advertiser
+        FROM nuojing_data.error_advertiser
         where type = #{type}
         order by create_time
     </select>
 
     <select id="queryPageAdvertiserIds" resultType="com.alibaba.fastjson.JSONObject">
         SELECT DISTINCT advertiser_id,page_id
-        FROM media_api.adq_dynamic_createive_list
+        FROM nuojing_data.adq_dynamic_createive_list
         where page_type = 'PAGE_TYPE_WECHAT_CANVAS'
           and mini_program_id is null
           and advertiser_id not in (SELECT DISTINCT advertiser_id
-                                    FROM media_api.adq_dynamic_page_list)
+                                    FROM nuojing_data.adq_dynamic_page_list)
     </select>
 
     <select id="queryTTErrApps" resultType="Long">
         SELECT advertiser_id
-        FROM media_api.error_advertiser_tt
+        FROM nuojing_data.error_advertiser_tt
         order by create_time
     </select>
 
     <delete id="delErrApps">
         DELETE
-        FROM media_api.error_advertiser
+        FROM nuojing_data.error_advertiser
         WHERE type = #{type}
     </delete>
 
     <delete id="delTTErrApps">
         DELETE
-        FROM media_api.error_advertiser_tt
+        FROM nuojing_data.error_advertiser_tt
     </delete>
 
 
     <select id="queryAdvertiserIds" resultType="Long">
         SELECT DISTINCT advertiser_id
-        FROM media_api.${db}
+        FROM nuojing_data.${db}
         where stat_time_day = #{date}
     </select>
 
     <select id="queryMediaAdverIds" resultType="Long">
         SELECT DISTINCT advertiser_id
-        FROM media_api.bytedance_cdp_project_list
+        FROM nuojing_data.bytedance_cdp_project_list
         where micro_promotion_type = #{mediaType}
         <if test="date != null">
             AND project_modify_time &gt;= CONCAT(#{date}, ' 00:00:00')
@@ -386,7 +386,7 @@
     </select>
 
     <insert id="replaceAdqDynamicCreateives">
-        replace into media_api.adq_dynamic_createive_list(
+        replace into nuojing_data.adq_dynamic_createive_list(
         advertiser_id,
         adgroup_id,
         dynamic_creative_id,
@@ -410,7 +410,7 @@
     </insert>
 
     <insert id="replaceAdqDynamicCreateivesSD">
-        insert into media_api.adq_dynamic_createive_list(
+        insert into nuojing_data.adq_dynamic_createive_list(
         advertiser_id,
         adgroup_id,
         dynamic_creative_id,
@@ -438,7 +438,7 @@
     </insert>
 
     <insert id="replaceAdqDynamicPages">
-        replace into media_api.adq_dynamic_page_list(
+        replace into nuojing_data.adq_dynamic_page_list(
         advertiser_id,
         page_id,
         page_type,
@@ -458,7 +458,7 @@
     </insert>
 
     <insert id="replaceAdqDynamicPagesSD">
-        insert into media_api.adq_dynamic_page_list(
+        insert into nuojing_data.adq_dynamic_page_list(
         advertiser_id,
         page_id,
         page_type,
@@ -484,13 +484,13 @@
 
     <select id="queryAppInstanceIdList" resultType="String">
         SELECT instance_id
-        FROM media_api.bytedance_byte_app_info
+        FROM nuojing_data.bytedance_byte_app_info
         where advertiser_id = #{advertiserId}
     </select>
 
     <select id="queryUniCostAdvertiserIds" resultType="com.alibaba.fastjson.JSONObject">
         select r.advertiser_id,c.access_token
-        from media_api.bytedance_uni_project_report_hour r
+        from nuojing_data.bytedance_uni_project_report_hour r
         join deepthink.bytedance_advertiser_list a on r.advertiser_id = a.advertiser_id
         join deepthink.bytedance_auth_list c on a.admin_advertiser_id = c.admin_advertiser_id
         where r.stat_time_day >= ${startDate} and r.stat_time_day &lt;= ${endDate}
@@ -499,7 +499,7 @@
 
     <select id="queryUniCostProjectIds" resultType="com.alibaba.fastjson.JSONObject">
         select r.advertiser_id,r.cdp_project_id,c.access_token
-        from media_api.bytedance_uni_project_report_hour r
+        from nuojing_data.bytedance_uni_project_report_hour r
         join deepthink.bytedance_advertiser_list a on r.advertiser_id = a.advertiser_id
         join deepthink.bytedance_auth_list c on a.admin_advertiser_id = c.admin_advertiser_id
         where r.stat_time_day >= ${startDate} and r.stat_time_day &lt;= ${endDate}
@@ -508,8 +508,8 @@
 
     <select id="queryUniCostNotListProjectIds" resultType="com.alibaba.fastjson.JSONObject">
         select r.advertiser_id,r.cdp_project_id,c.access_token
-        from media_api.bytedance_uni_project_report_hour r
-        left join media_api.bytedance_uni_project_list l
+        from nuojing_data.bytedance_uni_project_report_hour r
+        left join nuojing_data.bytedance_uni_project_list l
         on r.advertiser_id = l.advertiser_id and r.cdp_project_id = l.project_id
         join deepthink.bytedance_advertiser_list a on r.advertiser_id = a.advertiser_id
         join deepthink.bytedance_auth_list c on a.admin_advertiser_id = c.admin_advertiser_id

+ 3 - 3
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceMiniAppMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="cn.com.ctop.job.bytedance.data.mapper.BytedanceMiniAppMapper">
     <insert id="insertAdPlacement">
-        replace into media_api.bytedance_ad_placement_list
+        replace into nuojing_data.bytedance_ad_placement_list
                 (app_id,ad_placement_id,ad_placement_name,ad_placement_type,ad_placement_type_name,status)
         values
         <foreach collection="list" item="item" separator=",">
@@ -17,7 +17,7 @@
         </foreach>
     </insert>
     <select id="getEcpmKeys" resultType="java.lang.String">
-        SELECT concat(event_timestamp,open_id,cost) as ecpm_keys from media_api.bytedance_webhook_ma_ecpm
+        SELECT concat(event_timestamp,open_id,cost) as ecpm_keys from nuojing_data.bytedance_webhook_ma_ecpm
         where stat_date >=  #{startDate} and stat_date &lt;= #{endDate}
           and event_time >= #{startTime} and event_time &lt;= #{endTime}
     </select>
@@ -32,7 +32,7 @@
 
     <select id="getMaEcpmRetryJob" resultType="com.alibaba.fastjson.JSONObject">
         SELECT is_send AS 'isSend', id AS 'id', start_date AS 'startDate', end_date AS 'endDate', data_dimension AS 'dataDimension', data_type AS 'dataType'
-        FROM media_api.bytedance_error_log where   data_dimension like 'ma_ecpm:%'
+        FROM nuojing_data.bytedance_error_log where   data_dimension like 'ma_ecpm:%'
     </select>
 
 </mapper>

+ 8 - 8
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceProductReportMapper.xml

@@ -4,7 +4,7 @@
     <select id="queryCostAccount" resultType="com.alibaba.fastjson.JSONObject">
         SELECT t1.advertiser_id AS advertiserId, t3.access_token AS accessToken
         FROM (
-            select advertiser_id from media_api.bytedance_promoter_report_hour
+            select advertiser_id from nuojing_data.bytedance_promoter_report_hour
             where stat_time_day >= ${startDate} and stat_time_day &lt;= ${endDate}
             <if test="advertiserId != null">
                 and advertiser_id = ${advertiserId}
@@ -13,20 +13,20 @@
 
             union
 
-            select advertiser_id from media_api.bytedance_promoter_report_daily
+            select advertiser_id from nuojing_data.bytedance_promoter_report_daily
             where stat_time_day >= ${startDate} and stat_time_day &lt;= ${endDate}
             <if test="advertiserId != null">
                 and advertiser_id = ${advertiserId}
             </if>
             group by 1
         ) t1
-        LEFT JOIN tidb.deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
-        LEFT JOIN tidb.deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id
+        LEFT JOIN deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
+        LEFT JOIN deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id
         order by 1
     </select>
 
     <insert id="replaceProductReportDailies">
-        replace into media_api.bytedance_product_report_daily (
+        replace into nuojing_data.bytedance_product_report_daily (
         advertiser_id,
         stat_time_day,
         product_id,
@@ -68,7 +68,7 @@
     </insert>
 
     <insert id="replaceProductReportDailiesSD">
-        insert into media_api.bytedance_product_report_daily (
+        insert into nuojing_data.bytedance_product_report_daily (
         advertiser_id,
         stat_time_day,
         product_id,
@@ -110,12 +110,12 @@
     </insert>
 
     <delete id="deleteProductReportDailies">
-        DELETE FROM media_api.bytedance_product_report_daily
+        DELETE FROM nuojing_data.bytedance_product_report_daily
         WHERE advertiser_id = ${advertiserId} and stat_time_day >= ${startDate} and stat_time_day &lt;= ${endDate}
     </delete>
 
     <delete id="deleteProductReportDailiesSD">
-        DELETE FROM media_api.bytedance_product_report_daily
+        DELETE FROM nuojing_data.bytedance_product_report_daily
         WHERE advertiser_id = ${advertiserId} and stat_time_day >= ${startDate} and stat_time_day &lt;= ${endDate}
     </delete>
 

+ 0 - 160
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceProductUpdateMapper.xml

@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="cn.com.ctop.job.bytedance.data.mapper.BytedanceProductUpdateMapper">
-    <insert id="insertAlbumInfo">
-        insert into deepthink.bytedance_upload_album
-        (album_id, ly_video_id)
-        values
-        (#{albumId}, #{videoId})
-    </insert>
-    <update id="updateInstanceId">
-        update deepthink.bytedance_product_main_advertiser
-        set mini_instance_id = #{instanceId}
-        where advertiser_id = #{advertiserId} and source=#{source}
-    </update>
-    <update id="updateAlbumInfo">
-        update deepthink.bytedance_upload_album
-        set can_promotion = #{canPromotion}, cannot_reason = #{cannotReason}
-        where album_id = #{albumId}
-    </update>
-    <update id="updateMovieAuthStatus">
-        update deepthink.bytedance_product_main_advertiser
-        set movie_auth_status = 1
-        where platform_id = #{platformId}
-    </update>
-
-    <select id="getPlatformList" resultType="cn.com.ctop.job.bytedance.data.entity.AigcProductPlatform">
-        select t1.platform_id, t1.advertiser_id, t1.type, t1.platform_type, t1.platform_name, t1.mini_instance_id, t1.update_time, t1.create_time, t1.mi_appid, t1.membership_types, t1.max_charge, t1.min_charge, t1.recommended_charge, t1.single_price, t1._status, t1.social_credit_code, t1.movie_auth_status, t1.is_bytedance, t1.is_wechat, t1.is_dys, t1.source, ifnull(t1.mini_app_advertiser_id,t1.advertiser_id) as mini_app_advertiser_id, t3.access_token,
-        '天津星链视界信息技术有限公司' as copyright_owner
-        FROM deepthink.bytedance_product_main_advertiser t1
-        left join deepthink.bytedance_advertiser_list t2 on t1.advertiser_id=t2.advertiser_id
-        left join deepthink.bytedance_auth_list t3 on t2.admin_advertiser_id=t3.admin_advertiser_id
-        where t1.`_status`=0 and platform_type=1 and t1.mini_instance_id is not null
-        <if test="businessMethod != null">
-            <choose>
-                <when test="businessMethod == 'IAP'">and t1.`type`=2 </when>
-                <when test="businessMethod == 'IAA'">and t1.`type`=1 </when>
-            </choose>
-        </if>
-        <if test="platformId != null and platformId != ''">
-            and t1.platform_id = #{platformId}
-        </if>
-    </select>
-    <select id="getPlatformInitList" resultType="cn.com.ctop.job.bytedance.data.entity.AigcProductPlatform">
-        select t1.platform_id, t1.advertiser_id, t1.type, t1.platform_type, t1.platform_name, t1.mini_instance_id, t1.update_time, t1.create_time, t1.mi_appid, t1.membership_types, t1.max_charge, t1.min_charge, t1.recommended_charge, t1.single_price, t1._status, t1.social_credit_code, t1.movie_auth_status, t1.is_bytedance, t1.is_wechat, t1.is_dys, t1.source, ifnull(t1.mini_app_advertiser_id,t1.advertiser_id) as mini_app_advertiser_id, t3.access_token,
-               '天津星链视界信息技术有限公司' as copyright_owner
-        FROM deepthink.bytedance_product_main_advertiser t1
-        left join deepthink.bytedance_advertiser_list t2 on t1.advertiser_id=t2.advertiser_id
-        left join deepthink.bytedance_auth_list t3 on t2.admin_advertiser_id=t3.admin_advertiser_id
-        where t1.`_status`=0 and platform_type=1
-        <choose>
-            <when test="businessMethod != null and businessMethod == 'IAP'">and t1.`type`=2 </when>
-            <when test="businessMethod != null and businessMethod == 'IAA'">and t1.`type`=1 </when>
-        </choose>
-    </select>
-    <select id="getIAAPlatformList" resultType="cn.com.ctop.job.bytedance.data.entity.AigcProductPlatform">
-        select t1.platform_id, t1.advertiser_id, t1.type, t1.platform_type, t1.platform_name, t1.mini_instance_id, t1.update_time, t1.create_time, t1.mi_appid, t1.membership_types, t1.max_charge, t1.min_charge, t1.recommended_charge, t1.single_price, t1._status, t1.social_credit_code, t1.movie_auth_status, t1.is_bytedance, t1.is_wechat, t1.is_dys, t1.source, ifnull(t1.mini_app_advertiser_id,t1.advertiser_id) as mini_app_advertiser_id, t3.access_token,
-               '天津星链视界信息技术有限公司' as copyright_owner
-        FROM deepthink.bytedance_product_main_advertiser t1
-        left join deepthink.bytedance_advertiser_list t2 on t1.advertiser_id=t2.advertiser_id
-        left join deepthink.bytedance_auth_list t3 on t2.admin_advertiser_id=t3.admin_advertiser_id
-        where t1.`type`=1 and t1.`_status`=0 and platform_type=1 and t1.mini_instance_id is not null
-    </select>
-    <select id="getIAAPlatformInitList" resultType="cn.com.ctop.job.bytedance.data.entity.AigcProductPlatform">
-        select t1.platform_id, t1.advertiser_id, t1.type, t1.platform_type, t1.platform_name, t1.mini_instance_id, t1.update_time, t1.create_time, t1.mi_appid, t1.membership_types, t1.max_charge, t1.min_charge, t1.recommended_charge, t1.single_price, t1._status, t1.social_credit_code, t1.movie_auth_status, t1.is_bytedance, t1.is_wechat, t1.is_dys, t1.source, ifnull(t1.mini_app_advertiser_id,t1.advertiser_id) as mini_app_advertiser_id, t3.access_token,
-               '天津星链视界信息技术有限公司' as copyright_owner
-        FROM deepthink.bytedance_product_main_advertiser t1
-        left join deepthink.bytedance_advertiser_list t2 on t1.advertiser_id=t2.advertiser_id
-        left join deepthink.bytedance_auth_list t3 on t2.admin_advertiser_id=t3.admin_advertiser_id
-        where t1.`type`=1 and t1.`_status`=0 and platform_type=1
-    </select>
-    <select id="getIAPVideoList" resultType="cn.com.ctop.job.bytedance.data.entity.AigcProductAlbum">
-        select third.album_id, third.platform_type, detail.platform_config, video.id as video_id, detail.id as video_detail_id, video.name as name, video.cover_img as img,ifnull(category.name, '其他') as 'theme', video.play_platform,
-        '天津星链视界信息技术有限公司' as copyright_owner,
-        '5' as membership_types, '2' as has_motivation_types,
-        payinfo.maxpay as max_charge, payinfo.minpay as min_charge, maxpay as recommended_charge, maxpay as price,
-         1 as has_motivation_content, video.source
-        FROM (select video_id, album_id, 1 as platform_type from thirtpart.ly_third_videos where submission_status=2 and platform=2
-        and video_id in (select video_id from thirtpart.ly_video_audit_records where audit_status=2 and platform=2)
-        union select ly_video_id as video_id, album_id, 2 as platform_type from deepthink.bytedance_upload_album where can_promotion=1
-        ) third
-        LEFT JOIN (select * from thirtpart.ly_video_details where platform_config is not null group by video_id) detail ON third.video_id = detail.video_id
-        LEFT JOIN (select * from thirtpart.ly_videos) video ON third.video_id = video.id
-        LEFT JOIN thirtpart.ly_video_category category ON video.category_id = category.id
-        LEFT JOIN (select video_id, min(sort) as sort, max(pay_amount/100.0) as maxpay, min(pay_amount/100.0) as minpay from thirtpart.ly_video_details where is_pay=1 group by video_id) payinfo ON video.id = payinfo.video_id
-        where (video.is_free = 1 or (payinfo.sort is not null and maxpay>0))
-        and (video.created_at > 1743436800 or video.updated_at > 1743436800)
-        and video.source in (1,3)
-    </select>
-    <select id="getIAAVideoList" resultType="cn.com.ctop.job.bytedance.data.entity.AigcProductAlbum">
-        select third.album_id, third.platform_type, detail.platform_config, video.id as video_id, detail.id as video_detail_id, video.name as name, video.cover_img as img,ifnull(category.name, '其他') as 'theme', video.play_platform,
-        '天津星链视界信息技术有限公司' as copyright_owner,
-        '5' as membership_types, '1' as has_paid_content, '2' as has_motivation_types,payinfo.sort as starting_unlock_episode, video.source
-        FROM (select video_id, album_id, 1 as platform_type from thirtpart.ly_third_videos where submission_status=2 and platform=2
-        and video_id in (select video_id from thirtpart.ly_video_audit_records where audit_status=2 and platform=2)
-        union select ly_video_id as video_id, album_id, 2 as platform_type from deepthink.bytedance_upload_album where can_promotion=1
-        ) third
-        LEFT JOIN (select * from thirtpart.ly_video_details where platform_config is not null group by video_id) detail ON third.video_id = detail.video_id
-        LEFT JOIN (select * from thirtpart.ly_videos where play_platform like '%2%') video ON third.video_id = video.id
-        LEFT JOIN thirtpart.ly_video_category category ON video.category_id = category.id
-        LEFT JOIN (select video_id, max(sort) as sort from thirtpart.ly_video_details where is_pay=0 group by video_id) payinfo ON video.id = payinfo.video_id
-        where video.is_iaa_show=1 and video.created_at > 1743436800
-        and video.source in (1,3)
-    </select>
-    <select id="getProductTypeEnums" resultType="com.alibaba.fastjson.JSONObject">
-        select first_type_name, first_type_id, second_type_name, second_type_id, third_type_name, third_type_id
-        from deepthink.bytedance_product_group_types
-        where 1=1
-        <choose>
-            <when test="businessMethod != null and businessMethod == 'IAP'">and `type`=2 </when>
-            <when test="businessMethod != null and businessMethod == 'IAA'">and`type`=1 </when>
-        </choose>
-    </select>
-    <select id="getIAAProductTypeEnums" resultType="com.alibaba.fastjson.JSONObject">
-        select first_type_name, first_type_id, second_type_name, second_type_id, third_type_name, third_type_id
-        from deepthink.bytedance_product_group_types
-        where `type`=1
-    </select>
-    <select id="getVideoInfo" resultType="com.alibaba.fastjson.JSONObject">
-        select id, name, label, cover_img, sylloge from thirtpart.ly_videos where id = #{videoId}
-    </select>
-    <select id="getVideoDetail" resultType="com.alibaba.fastjson.JSONObject">
-        select video_id, name, is_pay, pay_amount, url, sort from thirtpart.ly_video_details where video_id=#{videoId} order by sort
-    </select>
-    <select id="getUploadList"  resultType="com.alibaba.fastjson.JSONObject">
-        select id,name
-        from thirtpart.ly_videos
-        where id not in
-        (select video_id from thirtpart.ly_third_videos where platform=2 and submission_status=2
-        and video_id in (select video_id from thirtpart.ly_video_audit_records where audit_status=2))
-        and id in (select video_id from thirtpart.ly_third_videos where platform=1)
-        and id not in (select ly_video_id from deepthink.bytedance_upload_album)
-    </select>
-    <select id="getDeveloperAccount" resultType="com.alibaba.fastjson.JSONObject">
-        select app_id, secret as app_secret from deepthink.bytedance_auth_config where auth_status=1 limit 1
-    </select>
-    <select id="selectWaitingAlbums"  resultType="com.alibaba.fastjson.JSONObject">
-        select album_id, tb2.name, tb1.create_time
-        from deepthink.bytedance_upload_album tb1
-        left join thirtpart.ly_videos tb2 on tb1.ly_video_id=tb2.id
-        where can_promotion is null or can_promotion=0
-    </select>
-    <select id="getDouyinMovieAuthList" resultType="com.alibaba.fastjson.JSONObject">
-        select platform_id, social_credit_code
-        from deepthink.bytedance_product_main_advertiser
-        where type=1 and _status=0 and movie_auth_status=0
-    </select>
-    <select id="allPlatform" resultType="java.lang.String">
-        select platform_id from deepthink.bytedance_product_main_advertiser where _status=0
-    </select>
-    <insert id="batchInsertPlatform">
-        insert into deepthink.bytedance_product_main_advertiser
-        (platform_id, advertiser_id, type, platform_type, platform_name, mini_instance_id,
-         mi_appid, _status, social_credit_code, is_bytedance, is_wechat, is_dys, source)
-        values
-        <foreach collection="list" item="item" separator=",">
-            (#{item.platformId}, #{item.advertiserId}, #{item.type}, #{item.platformType}, #{item.platformName}, #{item.miniInstanceId},
-             #{item.miAppid}, 0, #{item.socialCreditCode}, #{item.isBytedance}, #{item.isWechat}, #{item.isDys}, #{item.source})
-        </foreach>
-    </insert>
-</mapper>

+ 6 - 6
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedancePromoterReportMapper.xml

@@ -15,19 +15,19 @@
     <select id="getAccountList" resultType="com.alibaba.fastjson.JSONObject">
         SELECT t1.msg,t1.is_send AS 'isSend', t1.id AS 'id', t1.advertiser_id AS 'advertiserId', t1.start_date AS 'startDate', t1.end_date AS 'endDate', t1.data_dimension AS 'dataDimension', t1.data_type AS 'dataType', t3.access_token AS 'accessToken'
         FROM bytedance_error_log t1
-                 LEFT JOIN deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
-                 LEFT JOIN deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id
+                 LEFT JOIN nuojing_data.media_advertiser_account t2 ON t1.advertiser_id = t2.advertiser_id
+                 LEFT JOIN nuojing_data.media_auth_account t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id
         where t1.error_status = 0 or t1.update_time &lt;= date_add(now(),interval -40 minute )
     </select>
 
     <select id="getListBydate" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Integer">
         SELECT t1.advertiser_id AS 'advertiserId', t3.access_token AS 'accessToken'
         FROM (SELECT advertiser_id
-              FROM media_api.bytedance_promoter_report_hour
+              FROM nuojing_data.bytedance_promoter_report_hour
               WHERE stat_time_day = date_format(CURDATE() - INTERVAL 1 DAY, '%Y%m%d')
               GROUP BY advertiser_id) t1
-                 LEFT JOIN tidb.deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
-                 LEFT JOIN tidb.deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id
+                 LEFT JOIN deepthink.bytedance_advertiser_list t2 ON t1.advertiser_id = t2.advertiser_id
+                 LEFT JOIN deepthink.bytedance_auth_list t3 ON t2.admin_advertiser_id = t3.admin_advertiser_id
     </select>
     <select id="getAllList" resultType="com.alibaba.fastjson.JSONObject">
 
@@ -315,7 +315,7 @@
         </foreach>
     </insert>
     <insert id="replaceErrorInfo" parameterType="cn.com.ctop.job.bytedance.data.entity.BytedanceErrorLog">
-        replace into bytedance_error_log
+        replace into nuojing_data.bytedance_error_log
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="advertiserId != null">advertiser_id,</if>
             <if test="startDate != null">start_date,</if>

+ 2 - 48
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceRefreshTokenMapper.xml

@@ -21,24 +21,6 @@
         where timestampdiff(HOUR,token_update_time,now()) >= 23 or token_update_time is null
     </select>
 
-    <select id="getBaiduYunTokenList" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT app_id,
-               secretkey,
-               appkey,
-               signkey,
-               access_token,
-               refresh_token
-        FROM deepthink.baiduyun_token
-    </select>
-
-    <update id="updateBaiduYunToken">
-        UPDATE deepthink.baiduyun_token
-        SET access_token  = #{obj.access_token},
-            refresh_token = #{obj.refresh_token}
-        WHERE app_id = #{obj.app_id}
-    </update>
-
-
     <select id="onlyGetToken" resultType="java.lang.String">
         SELECT access_token
         FROM deepthink.bytedance_auth_list
@@ -59,41 +41,13 @@
             LIMIT 1)
     </select>
 
-    <select id="queryOfficialAccounts" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT id,
-               applet_id,
-               app_id,
-               '-' as token
-        FROM thirtpart.ly_official_accounts
-        order by id
-    </select>
-
     <select id="getAuthConfig" resultType="com.alibaba.fastjson.JSONObject">
         SELECT access_token,app_id
-        FROM deepthink.bytedance_auth_list
+        FROM nuojing_data.media_auth_account
         WHERE admin_advertiser_id =
               (SELECT admin_advertiser_id
-               FROM deepthink.bytedance_advertiser_list
+               FROM nuojing_data.media_advertiser_account
                WHERE advertiser_id = #{advertiserId}
             LIMIT 1)
     </select>
-
-
-    <insert id="refreshAppletTokens">
-        replace into thirtpart.applet_tokens (
-        app_id,
-        official_account_id,
-        applet_id,
-        token
-        )
-        values
-        <foreach collection="list" item="item" separator=",">
-            (
-            #{item.app_id},
-            #{item.id},
-            #{item.applet_id},
-            #{item.token}
-            )
-        </foreach>
-    </insert>
 </mapper>

+ 15 - 15
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceXingTuMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="cn.com.ctop.job.bytedance.data.mapper.BytedanceXingTuMapper">
     <insert id="insertTaskId" parameterType="java.util.List">
-        INSERT ignore INTO media_api.bytedance_xingtu_task_list (challenge_task_id,advertiser_id,task_type)
+        INSERT ignore INTO nuojing_data.bytedance_xingtu_task_list (challenge_task_id,advertiser_id,task_type)
         VALUES
         <foreach collection="list" item="item" separator=",">
             (#{item.challengeTaskId},#{item.advertiserId},#{item.taskType})
@@ -10,7 +10,7 @@
     </insert>
 
     <insert id="insertTaskIdSD" parameterType="java.util.List">
-        INSERT INTO media_api.bytedance_xingtu_task_list (challenge_task_id,advertiser_id,task_type)
+        INSERT INTO nuojing_data.bytedance_xingtu_task_list (challenge_task_id,advertiser_id,task_type)
         VALUES
         <foreach collection="list" item="item" separator=",">
             (#{item.challengeTaskId},#{item.advertiserId},#{item.taskType})
@@ -18,7 +18,7 @@
     </insert>
 
     <insert id="insertReport"  parameterType="java.util.List">
-        replace INTO media_api.bytedance_xingtu_task_report (
+        replace INTO nuojing_data.bytedance_xingtu_task_report (
         challenge_task_id,advertiser_id,
         android_activate_cnt, author_id, author_nickname, comment_cnt, component_click_cnt,
         est_ad_cost_value, est_ad_cost_time, est_sales_value, est_sales_time,
@@ -49,7 +49,7 @@
     </insert>
 
     <insert id="insertReportSD"  parameterType="java.util.List">
-        insert INTO media_api.bytedance_xingtu_task_report (
+        insert INTO nuojing_data.bytedance_xingtu_task_report (
         challenge_task_id,advertiser_id,
         android_activate_cnt, author_id, author_nickname, comment_cnt, component_click_cnt,
         est_ad_cost_value, est_ad_cost_time, est_sales_value, est_sales_time,
@@ -80,7 +80,7 @@
     </insert>
 
     <insert id="insertReportDaily" parameterType="java.util.List">
-        replace INTO media_api.bytedance_xingtu_task_report_daily (
+        replace INTO nuojing_data.bytedance_xingtu_task_report_daily (
         challenge_task_id,advertiser_id,author_id,
         item_id, p_date, est_sales, settle_cps, est_ad_cost, settle_ad_share
         )
@@ -95,7 +95,7 @@
     </insert>
 
     <insert id="insertReportDailySD" parameterType="java.util.List">
-        insert INTO media_api.bytedance_xingtu_task_report_daily (
+        insert INTO nuojing_data.bytedance_xingtu_task_report_daily (
         challenge_task_id,advertiser_id,author_id,
         item_id, p_date, est_sales, settle_cps, est_ad_cost, settle_ad_share
         )
@@ -110,7 +110,7 @@
     </insert>
 
     <update id="updateTaskInfo" parameterType="cn.com.ctop.job.bytedance.data.entity.BytedanceXingTuTask">
-        UPDATE media_api.bytedance_xingtu_task_list
+        UPDATE nuojing_data.bytedance_xingtu_task_list
         <set>
             <if test="accountDivideDay != null">account_divide_day = #{accountDivideDay},</if>
             <if test="anchorTitle != null">anchor_title = #{anchorTitle},</if>
@@ -143,7 +143,7 @@
     </update>
 
     <update id="updateTaskInfoSD" parameterType="cn.com.ctop.job.bytedance.data.entity.BytedanceXingTuTask">
-        UPDATE media_api.bytedance_xingtu_task_list
+        UPDATE nuojing_data.bytedance_xingtu_task_list
         <set>
             <if test="accountDivideDay != null">account_divide_day = #{accountDivideDay},</if>
             <if test="anchorTitle != null">anchor_title = #{anchorTitle},</if>
@@ -186,10 +186,10 @@
 
     <select id="queryXingTuActiveTask" resultType="com.alibaba.fastjson.JSONObject">
         select t.advertiser_id,challenge_task_id task_id,access_token
-        from media_api.bytedance_xingtu_task_list t
-        join tidb.deepthink.bytedance_xingtu_advertiser_list x
+        from nuojing_data.bytedance_xingtu_task_list t
+        join deepthink.bytedance_xingtu_advertiser_list x
         on t.advertiser_id = x.advertiser_id
-        join tidb.deepthink.bytedance_auth_list a
+        join deepthink.bytedance_auth_list a
         on x.admin_advertiser_id = a.admin_advertiser_id
         where (t.om_task_status is null or t.om_task_status not in (6,7,8))
         <if test="advertiserId != null">
@@ -199,10 +199,10 @@
 
     <select id="queryXingTuReportTask" resultType="com.alibaba.fastjson.JSONObject">
         select t.advertiser_id,challenge_task_id task_id,access_token
-        from media_api.bytedance_xingtu_task_list t
-        join tidb.deepthink.bytedance_xingtu_advertiser_list x
+        from nuojing_data.bytedance_xingtu_task_list t
+        join deepthink.bytedance_xingtu_advertiser_list x
         on t.advertiser_id = x.advertiser_id
-        join tidb.deepthink.bytedance_auth_list a
+        join deepthink.bytedance_auth_list a
         on x.admin_advertiser_id = a.admin_advertiser_id
         where (t.om_task_status not in (1,2,4) or t.om_task_status is null)
         and (t.end_time is null or t.end_time >= unix_timestamp(date_add(now(),Interval -65 day)))
@@ -215,7 +215,7 @@
     <select id="queryXingTuRetryJob" resultType="com.alibaba.fastjson.JSONObject">
         select is_send AS 'isSend', id AS 'id', start_date AS 'startDate', end_date AS 'endDate',l.msg,
                 l.advertiser_id AS 'advertiserId',data_dimension AS 'dataDimension', data_type AS 'dataType',access_token AS 'accessToken'
-        from media_api.bytedance_error_log l
+        from nuojing_data.bytedance_error_log l
          join deepthink.bytedance_xingtu_advertiser_list x
               on l.advertiser_id = x.advertiser_id
          join deepthink.bytedance_auth_list a

+ 0 - 458
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/CPSReportMapper.xml

@@ -1,458 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="cn.com.ctop.job.bytedance.data.mapper.CPSReportMapper">
-
-    <insert id="cleanCPSPayDailyReports">
-        replace
-        into thirtpart.cps_link_data_report
-        (stat_date,
-        official_account_id,
-        responsibility_person_id,
-        ma_appid,
-        link_id,
-        new_users,
-        new_pay_users,
-        new_pay_counts,
-        new_order_counts,
-        new_pay_amount,
-        new_xn_pay_amount,
-        pay_amount,
-        xn_pay_amount,
-        pay_users,
-        pay_counts,
-        order_counts
-        )
-        SELECT *
-        FROM (SELECT t1.consume_date,
-                     t0.official_account_id,
-                     t0.responsibility_person_id,
-                     t2.app_id,
-                     t0.id,
-                     t3.new_users,
-                     t1.new_pay_users,
-                     t1.new_pay_counts,
-                     t1.new_order_counts,
-                     t1.new_pay_amount,
-                     t1.new_xn_pay_amount,
-                     t1.pay_amount,
-                     t1.xn_pay_amount,
-                     t1.pay_users,
-                     t1.pay_counts,
-                     t1.order_counts
-              FROM (SELECT consume_date,
-                           link_id,
-                           count(DISTINCT CASE
-                                              WHEN t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d') AND
-                                                   t1.STATUS = 1 THEN t1.uid END) AS 'new_pay_users', SUM(
-                          IF
-                          (t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d') AND t1.STATUS = 1, 1,
-                           0)) AS 'new_pay_counts', SUM(
-                          IF
-                          (t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d'), 1,
-                           0)) AS 'new_order_counts', IFNULL(
-                          ROUND(
-                                  SUM(
-                                          IF
-                                          (t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d') AND
-                                           t1.STATUS = 1, t1.total_fee, 0)),
-                                  2
-                          ),
-                              0.00
-                          ) AS 'new_pay_amount', IFNULL(
-                          ROUND(
-                                  SUM(
-                                          IF
-                                          (
-                                                  t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d')
-                                                      AND t1.STATUS = 1
-                                                      AND (t1.pay_merchant = 15 OR pay_type = 20),
-                                                  total_fee,
-                                                  0
-                                          )),
-                                  2
-                          ),
-                              0.00
-                          ) AS 'new_xn_pay_amount', IFNULL( ROUND(SUM(IF(t1.STATUS = 1, t1.total_fee, 0)), 2), 0.00 ) AS 'pay_amount', IFNULL(
-                          ROUND(SUM(IF(t1.STATUS = 1 AND (t1.pay_merchant = 15 OR pay_type = 20), total_fee, 0)), 2),
-                              0.00
-                          ) AS 'xn_pay_amount', count( DISTINCT CASE WHEN t1.STATUS = 1 THEN t1.uid END ) AS 'pay_users', SUM(
-                          IF
-                          (t1.STATUS = 1, 1, 0)) AS 'pay_counts', count( t1.order_no ) AS 'order_counts'
-                    FROM thirtpart.ly_pay_record t1
-                    WHERE consume_date = #{nowDate}
-                    GROUP BY link_id) t1
-                       LEFT JOIN thirtpart.ly_link t0 ON t0.id = t1.link_id
-                       LEFT JOIN (SELECT DATE_FORMAT(activation_time, '%Y%m%d') AS 'date', link_id,
-                                         count(DISTINCT uid) AS 'new_users'
-                                  FROM thirtpart.ly_user_activation_info
-                                  WHERE DATE_FORMAT(activation_time, '%Y%m%d') = #{nowDate}
-                                  GROUP BY link_id) t3 ON t3.link_id = t1.link_id
-                       LEFT JOIN thirtpart.ly_official_accounts t2 ON t0.official_account_id = t2.id
-              WHERE official_account_id IS NOT NULL
-              GROUP BY t1.link_id
-              UNION ALL
-              SELECT t3.date,
-                     t0.official_account_id,
-                     t0.responsibility_person_id,
-                     t2.app_id,
-                     t0.id,
-                     t3.new_users,
-                     t1.new_pay_users,
-                     t1.new_pay_counts,
-                     t1.new_order_counts,
-                     t1.new_pay_amount,
-                     t1.new_xn_pay_amount,
-                     t1.pay_amount,
-                     t1.xn_pay_amount,
-                     t1.pay_users,
-                     t1.pay_counts,
-                     t1.order_counts
-              FROM (SELECT DATE_FORMAT(activation_time, '%Y%m%d') AS 'date', link_id,
-                           count(DISTINCT uid) AS 'new_users'
-                    FROM thirtpart.ly_user_activation_info
-                    WHERE created_at &gt;= unix_timestamp(#{nowDate})
-                      AND created_at &lt; unix_timestamp(DATE_ADD(#{nowDate}, INTERVAL 1 day))
-                    GROUP BY link_id) t3
-                       LEFT JOIN thirtpart.ly_link t0 ON t0.id = t3.link_id
-                       LEFT JOIN (SELECT consume_date,
-                                         link_id,
-                                         count(DISTINCT CASE
-                                                            WHEN t1.consume_date =
-                                                                 DATE_FORMAT(t1.activation_time, '%Y%m%d') AND
-                                                                 t1.STATUS = 1 THEN t1.uid END) AS 'new_pay_users', SUM(
-                          IF
-                          (t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d') AND t1.STATUS = 1, 1,
-                           0)) AS 'new_pay_counts', SUM(
-                          IF
-                          (t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d'), 1,
-                           0)) AS 'new_order_counts', IFNULL(
-                          ROUND(
-                                  SUM(
-                                          IF
-                                          (t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d') AND
-                                           t1.STATUS = 1, t1.total_fee, 0)),
-                                  2
-                          ),
-                              0.00
-                          ) AS 'new_pay_amount', IFNULL(
-                          ROUND(
-                                  SUM(
-                                          IF
-                                          (
-                                                  t1.consume_date = DATE_FORMAT(t1.activation_time, '%Y%m%d')
-                                                      AND t1.STATUS = 1
-                                                      AND (t1.pay_merchant = 15 OR pay_type = 20),
-                                                  total_fee,
-                                                  0
-                                          )),
-                                  2
-                          ),
-                              0.00
-                          ) AS 'new_xn_pay_amount', IFNULL( ROUND(SUM(IF(t1.STATUS = 1, t1.total_fee, 0)), 2), 0.00 ) AS 'pay_amount', IFNULL(
-                          ROUND(SUM(IF(t1.STATUS = 1 AND (t1.pay_merchant = 15 OR pay_type = 20), total_fee, 0)), 2),
-                              0.00
-                          ) AS 'xn_pay_amount', count( DISTINCT CASE WHEN t1.STATUS = 1 THEN t1.uid END ) AS 'pay_users', SUM(
-                          IF
-                          (t1.STATUS = 1, 1, 0)) AS 'pay_counts', count( t1.order_no ) AS 'order_counts'
-                                  FROM thirtpart.ly_pay_record t1
-                                  WHERE consume_date = #{nowDate}
-                                  GROUP BY link_id) t1 ON t3.link_id = t1.link_id
-                       LEFT JOIN thirtpart.ly_official_accounts t2 ON t0.official_account_id = t2.id
-              WHERE official_account_id IS NOT NULL
-              GROUP BY t3.link_id) t
-        GROUP BY t.id
-    </insert>
-
-    <select id="queryCPSIaaDaily" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT IFNULL(t.date, t0.date) AS 'date', tt.official_account_id,
-               tt.responsibility_person_id,
-               tt.app_id,
-               tt.id,
-               t1.new_users,
-               t3.new_pay_users,
-               t3.new_pay_counts,
-               t3.new_order_counts,
-               t3.new_pay_amount,
-               t3.new_xn_pay_amount,
-               t3.pay_amount,
-               t3.xn_pay_amount,
-               t3.pay_users,
-               t3.pay_counts,
-               t3.order_counts,
-               t0.new_iaa_users,
-               t0.new_iaa_counts,
-               t0.new_iaa_amount,
-               t0.iaa_users,
-               t0.iaa_counts,
-               t0.iaa_amount,
-               t.active_users
-        FROM (SELECT t0.id, t0.responsibility_person_id, t0.official_account_id, t2.app_id
-              FROM tidb.thirtpart.ly_link t0
-                       LEFT JOIN tidb.thirtpart.ly_official_accounts t2 ON t0.official_account_id = t2.id) tt
-                 LEFT JOIN (SELECT t.date, t.link_id, COUNT(DISTINCT t.uid) AS 'active_users'
-                            FROM tidb.thirtpart.ly_user_login_record t
-                            WHERE date = #{dateStr} AND link_id > 0
-                            GROUP BY link_id, date) t ON tt.id = t.link_id
-                 LEFT JOIN (SELECT t.stat_date AS 'date', t.link_id,
-                                   count(DISTINCT CASE
-                                                      WHEN SUBSTR(dying_time, 1, 10) = SUBSTR(event_time, 1, 10)
-                                                          THEN uid END) 'new_iaa_users', sum( IF(SUBSTR(dying_time, 1, 10) = SUBSTR(event_time, 1, 10), 1, 0)) 'new_iaa_counts', ROUND( IFNULL(
-                        sum(IF(SUBSTR(dying_time, 1, 10) = SUBSTR(event_time, 1, 10), cost / 100000, 0)),
-                        0.00), 2 ) 'new_iaa_amount', count( DISTINCT uid ) 'iaa_users', sum( 1 ) 'iaa_counts', ROUND( IFNULL(sum(cost / 100000), 0.00), 2 ) 'iaa_amount'
-                            FROM media_api.bytedance_webhook_ma_ecpm t
-                                     LEFT JOIN tidb.thirtpart.ly_link t0 ON t.link_id = t0.id
-                            WHERE t.stat_date = #{nowDate}
-                            GROUP BY t.link_id, t.stat_date
-                            ORDER BY t.link_id) t0 ON tt.id = t0.link_id
-                 LEFT JOIN (SELECT t0.id,
-                                   DATE_FORMAT(t.activation_time, '%Y%m%d') AS 'date', t0.official_account_id,
-                                   t0.responsibility_person_id,
-                                   count(DISTINCT t.uid) AS 'new_users'
-                            FROM tidb.thirtpart.ly_user_activation_info t
-                                     LEFT JOIN tidb.thirtpart.ly_link t0 ON t.link_id = t0.id
-                            WHERE t.created_at &gt;= unix_timestamp(#{nowDate})
-                              AND t.created_at &lt; unix_timestamp(DATE_ADD(#{nowDate}, INTERVAL 1 day))
-                            GROUP BY 1, 2, 3, 4) t1 ON tt.id = t1.id
-                 LEFT JOIN (SELECT link_id,
-                                   new_pay_users,
-                                   new_pay_counts,
-                                   new_order_counts,
-                                   new_pay_amount,
-                                   new_xn_pay_amount,
-                                   pay_amount,
-                                   xn_pay_amount,
-                                   pay_users,
-                                   pay_counts,
-                                   order_counts
-                            FROM tidb.thirtpart.cps_link_data_report
-                            WHERE stat_date = #{nowDate}) t3 ON t3.link_id = tt.id
-        WHERE t0.iaa_amount IS NOT NULL
-    </select>
-
-    <insert id="cleanCPSIaaDailyReportsDS">
-        replace into thirtpart.cps_link_data_report
-        (stat_date,
-        official_account_id,
-        responsibility_person_id,
-        ma_appid,
-        link_id,
-        new_users,
-        new_pay_users,
-        new_pay_counts,
-        new_order_counts,
-        new_pay_amount,
-        new_xn_pay_amount,
-        pay_amount,
-        xn_pay_amount,
-        pay_users, pay_counts,
-        order_counts,
-        new_iaa_users,
-        new_iaa_counts,
-        new_iaa_amount,
-        iaa_users,
-        iaa_counts,
-        iaa_amount,
-        active_users)
-        values
-        <foreach collection="list" item="item" separator=",">
-            (
-            #{item.date},
-            #{item.official_account_id},
-            #{item.responsibility_person_id},
-            #{item.app_id},
-            #{item.id},
-            #{item.new_users},
-            #{item.new_pay_users},
-            #{item.new_pay_counts},
-            #{item.new_order_counts},
-            #{item.new_pay_amount},
-            #{item.new_xn_pay_amount},
-            #{item.pay_amount},
-            #{item.xn_pay_amount},
-            #{item.pay_users},
-            #{item.pay_counts},
-            #{item.order_counts},
-            #{item.new_iaa_users},
-            #{item.new_iaa_counts},
-            #{item.new_iaa_amount},
-            #{item.iaa_users},
-            #{item.iaa_counts},
-            #{item.iaa_amount},
-            #{item.active_users}
-            )
-        </foreach>
-    </insert>
-
-
-    <insert id="runCPSIapSettlementData">
-        replace into deepthink.distribution_iap_settlement
-        (stat_date, link_id, app_id, person_id, person_pid, company_id, all_pay_amount, all_refund_amount, all_settlement_amount, virtual_pay_amount, virtual_commission_amount, virtual_refund_amount, virtual_settlement_amount, un_virtual_pay_amount, un_virtual_commission_amount, un_virtual_refund_amount, un_virtual_settlement_amount,virtual_ad_amount,virtual_ad_settlement_amount)
-        select
-        #{dateLong} as stat_date,
-        ifnull(link_id, 0) as link_id,
-        ifnull(app_id, '') as app_id,
-        ifnull(person_id, 0) as person_id,
-        ifnull(person_pid, 0) as person_pid,
-        ifnull(company_id, 0) as company_id,
-        all_pay_amount,
-        all_refund_amount,
-        (wx_virtual_pay_amount-wx_virtual_commission_amount-wx_virtual_refund_amount) * wx_virtual_scale_rate + (wx_common_pay_amount-wx_common_commission_amount-wx_common_refund_amount) * wx_common_scale_rate
-        + (tt_common_pay_amount-tt_common_commission_amount-tt_common_refund_amount) * tt_common_scale_rate as all_settlement_amount,
-        wx_virtual_pay_amount as virtual_pay_amount,
-        wx_virtual_commission_amount as virtual_commission_amount,
-        wx_virtual_refund_amount as virtual_refund_amount,
-        (wx_virtual_pay_amount-wx_virtual_commission_amount-wx_virtual_refund_amount) * wx_virtual_scale_rate as virtual_settlement_amount,
-        (wx_common_pay_amount+tt_common_pay_amount) un_virtual_pay_amount,
-        (wx_common_commission_amount+tt_common_commission_amount) un_virtual_commission_amount,
-        (wx_common_refund_amount+tt_common_refund_amount) un_virtual_refund_amount,
-        (wx_common_pay_amount-wx_common_commission_amount-wx_common_refund_amount) * wx_common_scale_rate
-        + (tt_common_pay_amount-tt_common_commission_amount-tt_common_refund_amount) * tt_common_scale_rate as un_virtual_settlement_amount,
-        wx_virtual_pay_amount * 0.05 as virtual_ad_amount,
-        wx_virtual_pay_amount * 0.05 * wx_ad_amount_scale_rate as virtual_ad_settlement_amount
-        from
-        (select
-        stat_date, t2.*,
-        ifnull(sum(t3.all_pay_amount),0) as all_pay_amount,
-        ifnull(sum(t4.refund_amount), 0) as all_refund_amount,
-        ifnull(sum(case when t1.pay_merchant=15 then ifnull(t3.all_pay_amount,0) else 0 end), 0) as wx_virtual_pay_amount,
-        ifnull(sum(case when t1.pay_merchant=15 then (ifnull(t3.all_pay_amount,0)-ifnull(t4.refund_amount,0))* wx_virtual_commission_rate else 0 end), 0) as wx_virtual_commission_amount,
-        ifnull(sum(case when t1.pay_merchant=15 then ifnull(t4.refund_amount,0) else 0 end), 0) as wx_virtual_refund_amount,
-        ifnull(sum(case when t1.pay_merchant in (22,23) then ifnull(t3.all_pay_amount,0) else 0 end), 0) as wx_common_pay_amount,
-        ifnull(sum(case when t1.pay_merchant in (22,23) then (ifnull(t3.all_pay_amount,0)-ifnull(t4.refund_amount,0))* wx_common_commission_rate else 0 end), 0) as wx_common_commission_amount,
-        ifnull(sum(case when t1.pay_merchant in (22,23) then ifnull(t4.refund_amount,0) else 0 end), 0) as wx_common_refund_amount,
-        ifnull(sum(case when t1.pay_merchant=30 then ifnull(t3.all_pay_amount,0) else 0 end), 0) as tt_common_pay_amount,
-        ifnull(sum(case when t1.pay_merchant=30 then (ifnull(t3.all_pay_amount,0)-ifnull(t4.refund_amount,0))* tt_common_commission_rate else 0 end), 0) as tt_common_commission_amount,
-        ifnull(sum(case when t1.pay_merchant=30 then ifnull(t4.refund_amount,0) else 0 end), 0) as tt_common_refund_amount
-
-        from
-        (
-        select consume_date stat_date, link_id, pay_merchant
-        from thirtpart.ly_pay_record p
-        where consume_date=#{dateLong} and status=1
-        group by 1,2,3
-        union
-        select date_format(refund_time,'%Y%m%d') stat_date,link_id, pay_merchant
-        from thirtpart.ly_refund_record lrr
-        where refund_time &gt;= concat(#{dateStr}, ' 00:00:00') and refund_time &lt;= concat(#{dateStr}, ' 23:59:59')
-        and status = 1
-        group by 1,2,3
-        ) t1
-        inner join
-        (
-        select l.id link_id,
-        l.responsibility_person_id person_id,
-        p.pid person_pid,
-        p.company_id,
-        la.app_id,
-        ifnull(scale_wx_virtual.scale/100.0, 0) as wx_virtual_scale_rate,
-        ifnull(scale_wx_virtual.commission_scale/100.0, 0) as wx_virtual_commission_rate,
-        ifnull(scale_wx_common.scale/100.0, 0) as wx_common_scale_rate,
-        ifnull(scale_wx_common.commission_scale/100.0, 0) as wx_common_commission_rate,
-        ifnull(scale_tt_common.scale/100.0, 0) as tt_common_scale_rate,
-        ifnull(scale_tt_common.commission_scale/100.0, 0) as tt_common_commission_rate,
-        ifnull(scale_wx_ad_amount.scale/100.0, 0) as wx_ad_amount_scale_rate
-        from thirtpart.ly_link l
-            join
-        (
-        select  link_id
-        from thirtpart.ly_pay_record p
-        where consume_date=#{dateLong} and status=1
-        group by 1
-        union
-        select link_id
-        from thirtpart.ly_refund_record lrr
-        where refund_time &gt;= concat(#{dateStr}, ' 00:00:00') and refund_time &lt;= concat(#{dateStr}, ' 23:59:59')
-        and status = 1
-        group by 1
-        ) t1 on l.id = t1.link_id
-        join thirtpart.ly_responsibility_person p on l.responsibility_person_id = p.id
-        left join thirtpart.ly_official_accounts a on l.official_account_id = a.id
-        left join thirtpart.ly_applet la on a.applet_id = la.id
-        left join (select company_id, scale, ifnull(commission_scale, 10) as commission_scale from thirtpart.ly_responsibility_person_scale where source=7
-        and #{st} &gt;= start_time and #{st} &lt;= end_time
-        ) scale_wx_virtual on p.company_id = scale_wx_virtual.company_id
-        left join (select company_id, scale, ifnull(commission_scale, 1) as commission_scale from thirtpart.ly_responsibility_person_scale where source=1
-        and #{st} &gt;= start_time and #{st} &lt;= end_time
-        ) scale_wx_common on p.company_id = scale_wx_common.company_id
-        left join (select company_id, scale, ifnull(commission_scale, 1) as commission_scale from thirtpart.ly_responsibility_person_scale where source=2
-        and #{st} &gt;= start_time and #{st} &lt;= end_time
-        ) scale_tt_common on p.company_id = scale_tt_common.company_id
-        left join (select company_id, scale from thirtpart.ly_responsibility_person_scale where source=12
-        and #{st} &gt;= start_time and #{st} &lt;= end_time
-        ) scale_wx_ad_amount on p.company_id = scale_wx_ad_amount.company_id
-<!--        where p.is_distributor = 1 or p.pid in (select id from thirtpart.ly_responsibility_person where is_distributor=1)-->
-        group by 1,2,3,4,5,6,7,8,9,10,11,12
-        ) t2 on t1.link_id = t2.link_id
-        left join
-        (
-        select consume_date,link_id,pay_merchant, sum(total_fee) all_pay_amount
-        from thirtpart.ly_pay_record p
-        where consume_date=#{dateLong} and status=1
-        group by 1,2,3
-        )t3 on t1.stat_date = t3.consume_date and t1.link_id = t3.link_id and t1.pay_merchant=t3.pay_merchant
-        left join
-        (
-        select date_format(refund_time,'%Y%m%d') refund_date,link_id, pay_merchant, sum(refund_price) refund_amount
-        from thirtpart.ly_refund_record r
-        where refund_time &gt;= concat(#{dateStr}, ' 00:00:00') and refund_time &lt;= concat(#{dateStr}, ' 23:59:59')
-        and status = 1
-        group by 1,2,3
-        )t4 on t1.stat_date = t4.refund_date and t1.link_id = t4.link_id and t1.pay_merchant=t4.pay_merchant
-        group by consume_date, t2.person_id, t2.link_id) tb
-
-    </insert>
-    <select id="runCPSIaaDySettlementData" resultType="com.alibaba.fastjson.JSONObject">
-        select stat_date, link_id, app_id, person_id, person_pid, company_id,
-        ad_total_income,
-        ad_total_income*scale/100.0 ad_settlement_amount,
-        ad_original_income, ad_platform_subsidy, pre_ecpm,
-        round(if(ad_total_income=0, 0, (pre_ecpm-ad_total_income)/ad_total_income), 4) data_gap
-        from
-        (select t1.stat_date,t1.link_id,t1.app_id,t1.person_id,t1.person_pid, t1.company_id,ifnull(t1.scale,0) scale,
-        link_cost/100000/0.7 pre_ecpm,
-        (ifnull(income,0) + ifnull(incentive_fund_cost,0))/100*(link_cost/all_cost) ad_total_income,
-        income/100*(link_cost/all_cost) ad_original_income,
-        incentive_fund_cost/100*(link_cost/all_cost) ad_platform_subsidy
-        from
-        (
-        select stat_date,app_id,link_id,ll.responsibility_person_id as person_id, lrp.pid as person_pid, lrp.company_id, scale.scale, sum(cost) link_cost
-        from media_api.bytedance_webhook_ma_ecpm bwme
-        left join tidb.thirtpart.ly_link ll on bwme.link_id=ll.id
-        left join tidb.thirtpart.ly_responsibility_person lrp on ll.responsibility_person_id=lrp.id
-        left join (select company_id, scale, ifnull(commission_scale, 10) as commission_scale from tidb.thirtpart.ly_responsibility_person_scale
-        where source=9 and #{st} &gt;= start_time and #{st} &lt;= end_time
-        ) scale on lrp.company_id = scale.company_id
-        where stat_date = #{dateLong} and link_id is not null
-<!--        and (lrp.is_distributor=1 or lrp.pid in (select id from tidb.thirtpart.ly_responsibility_person where is_distributor=1))-->
-        group by 1,2,3,4,5,6,7
-        )t1
-        left join
-        (
-        select stat_date,app_id,sum(cost) all_cost
-        from media_api.bytedance_webhook_ma_ecpm bwme
-        where stat_date = #{dateLong}
-        group by 1,2
-        )t2 on t1.stat_date = t2.stat_date and t1.app_id = t2.app_id
-        left join
-        (
-        select stat_date,ma_appid,income,incentive_fund_cost
-        from tidb.media_api.bytedance_miniapp_ad_income
-        where stat_date = #{dateLong}
-        )t3 on t1.stat_date = t3.stat_date and t1.app_id = t3.ma_appid
-        )tb
-    </select>
-
-    <update id="saveIaaDySettlementData">
-        replace into deepthink.distrubution_iaa_douyin_settlement
-        (stat_date, link_id, app_id, person_id, person_pid, company_id,
-        ad_total_income, ad_settlement_amount, ad_original_income, ad_platform_subsidy, pre_ecpm, data_gap)
-        values
-        <foreach collection="list" item="item" separator=",">
-            (
-            #{item.stat_date}, #{item.link_id}, #{item.app_id}, #{item.person_id}, #{item.person_pid}, #{item.company_id},
-            #{item.ad_total_income}, #{item.ad_settlement_amount}, #{item.ad_original_income}, #{item.ad_platform_subsidy},
-            #{item.pre_ecpm}, #{item.data_gap}
-            )
-        </foreach>
-    </update>
-</mapper>

+ 1 - 1
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/ChannelMapper.xml

@@ -19,7 +19,7 @@
         SELECT t1.is_send AS 'isSend', t1.id AS 'id', t1.start_date AS 'startDate', t1.end_date AS 'endDate', t1.data_dimension AS 'dataDimension', t1.data_type AS 'dataType',
                 t2.channel_account_id as 'channelAccountId',t2.secret_key as 'secretKey',
                 t2.channel_app_id as 'channelAppId',t2.channel_app_name as 'channelAppName'
-        FROM media_api.bytedance_error_log t1
+        FROM nuojing_data.bytedance_error_log t1
         JOIN deepthink.channel_account_info t2 ON t1.advertiser_id = t2.channel_account_id
     </select>
 

+ 4 - 4
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/DianZhongMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="cn.com.ctop.job.bytedance.data.mapper.DianZhongMapper">
 
     <insert id="insertDownloadTask">
-        insert into media_api.dianzhong_data_download_url
+        insert into nuojing_data.dianzhong_data_download_url
         (stat_date,task_id,`type`,client_id,start_time,end_time) values
         (
         #{item.stat_date},
@@ -18,13 +18,13 @@
         start_time= VALUES(start_time),end_time= VALUES(end_time)
     </insert>
     <update id="updateTaskDownloaded">
-        update media_api.dianzhong_data_download_url
+        update nuojing_data.dianzhong_data_download_url
         set downloaded = 1 where task_id = #{taskId}
     </update>
 
     <select id="getTaskUrl" resultType="com.alibaba.fastjson.JSONObject">
         select task_id,url,type,client_id,stat_date
-        from media_api.dianzhong_data_download_url
+        from nuojing_data.dianzhong_data_download_url
         where downloaded = 0 and url is not null and url != '-1'
         <if test="statDate != null">
             and stat_date = #{statDate}
@@ -40,7 +40,7 @@
 
     <select id="getBytedanceAdvertiserByAd" resultType="java.util.Map">
         SELECT  "1" media_id,cast(advertiser_id as char) advertiser_id,cast(project_id as char) a_id,cast(promotion_id as char) ad_id
-        from  media_api.bytedance_promotion_list
+        from nuojing_data.bytedance_promotion_list
         where promotion_id  = ${adId}  limit 1
     </select>
     <select id="getDZAppIdByChannelId" resultType="java.lang.String">

+ 0 - 104
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/DianzhongConfigMapper.xml

@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="cn.com.ctop.job.bytedance.data.mapper.DianzhongConfigMapper">
-    <!--create table dianzhong_movie_config(
-    movie_id varchar(64) not null comment '剧目ID'
-    primary key,
-    movie_name varchar(64) not null comment '剧目名称',
-    introduction text null comment '简介',
-    word_count int null comment '字数',
-    cover_img_url varchar(256) null comment '封面图链接',
-    type_1 varchar(64) null comment '男频/女频',
-    type_2 varchar(64) null comment '二级分类',
-    type_3 varchar(64) null comment '三级分类',
-    first_shelf_time datetime null comment '上架时间',
-    show_title varchar(64) null comment '显示标题',
-    remark varchar(64) null comment '备注',
-    create_by          varchar(64) default ''                null comment '创建者',
-    create_time        datetime    default CURRENT_TIMESTAMP null comment '创建时间',
-    update_by          varchar(64) default ''                null comment '更新者',
-    update_time        datetime    default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '修改时间'
-    ) comment '点众-短剧配置表';-->
-
-
-    <insert id="insertConfigSelective">
-        REPLACE INTO deepthink.dianzhong_movie_config
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="movieId != null">movie_id,</if>
-            <if test="movieName != null">movie_name,</if>
-            <if test="coverImgUrl != null">cover_img_url,</if>
-            <if test="chapterCount != null">chapter_count,</if>
-            <if test="freeChapterCount != null">free_chapter_count,</if>
-            <if test="type1 != null">type_1,</if>
-            <if test="type2 != null">type_2,</if>
-            <if test="type3 != null">type_3,</if>
-            <if test="firstShelfTime != null">first_shelf_time,</if>
-            <if test="remark != null">remark,</if>
-            <if test="createBy != null">create_by,</if>
-            <if test="updateBy != null">update_by,</if>
-            <if test="infoJson != null">info_json,</if>
-        </trim>
-        VALUES
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="movieId != null">#{movieId},</if>
-            <if test="movieName != null">#{movieName},</if>
-            <if test="coverImgUrl != null">#{coverImgUrl},</if>
-            <if test="chapterCount != null">#{chapterCount},</if>
-            <if test="freeChapterCount != null">#{freeChapterCount},</if>
-            <if test="type1 != null">#{type1},</if>
-            <if test="type2 != null">#{type2},</if>
-            <if test="type3 != null">#{type3},</if>
-            <if test="firstShelfTime != null">#{firstShelfTime},</if>
-            <if test="remark != null">#{remark},</if>
-            <if test="createBy != null">#{createBy},</if>
-            <if test="infoJson != null">#{infoJson},</if>
-        </trim>
-    </insert>
-
-    <insert id="insertDistributorConfigSelective">
-        REPLACE INTO deepthink.dianzhong_distributor_config
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="distributorId != null">distributor_id,</if>
-            <if test="distributorName != null">distributor_name,</if>
-            <if test="nickName != null">nick_name,</if>
-            <if test="dianzhongAccountId != null">dianzhong_account_id,</if>
-            <if test="channelCreateTime != null">channel_create_time,</if>
-            <if test="jumpType != null">jump_type,</if>
-            <if test="ofAppid != null">of_appid,</if>
-            <if test="ofName != null">of_name,</if>
-            <if test="remark != null">remark,</if>
-            <if test="createBy != null">create_by,</if>
-            <if test="updateBy != null">update_by,</if>
-        </trim>
-        VALUES
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="distributorId != null">#{distributorId},</if>
-            <if test="distributorName != null">#{distributorName},</if>
-            <if test="nickName != null">#{nickName},</if>
-            <if test="dianzhongAccountId != null">#{dianzhongAccountId},</if>
-            <if test="channelCreateTime != null">#{channelCreateTime},</if>
-            <if test="jumpType != null">#{jumpType},</if>
-            <if test="ofAppid != null">#{ofAppid},</if>
-            <if test="ofName != null">#{ofName},</if>
-            <if test="remark != null">#{remark},</if>
-            <if test="createBy != null">#{createBy},</if>
-            <if test="updateBy != null">#{updateBy},</if>
-        </trim>
-    </insert>
-    <update id="updateMovieImage">
-        UPDATE deepthink.dianzhong_movie_config
-        SET cover_img_url = #{coverImgUrl}
-        WHERE movie_id = #{movieId}
-    </update>
-    <select id="getAllMovieIds" resultType="java.lang.String">
-        select movie_id
-        from deepthink.dianzhong_movie_config
-        where cover_img_url is not null
-    </select>
-    <select id="toUploadImageList" resultType="cn.com.ctop.job.bytedance.data.entity.DianzhongMovieConfig">
-        select movie_id as movieId, movie_name as movieName, cover_img_url as coverImgUrl
-        from deepthink.dianzhong_movie_config
-        where cover_img_url is not null and cover_img_url like '%resali.ssread.cn%'
-        limit 500
-    </select>
-</mapper>

+ 0 - 85
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/PromoteLinkRefreshMapper.xml

@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="cn.com.ctop.job.bytedance.data.mapper.PromoteLinkRefreshMapper">
-    <update id="updateLink">
-        update deepthink.bytedance_landing_redirect
-        set url = #{url},
-        expire_time = #{expireTime}
-        where uuid = #{uuid}
-    </update>
-    <update id="updateRunStatus">
-        replace into deepthink.bytedance_advertiser_task
-        (id, task_id, task_name, task_status, task_type, advertiser_id, advertiser_name, advertiser_name_update, template_value_name, advertiser_avatar_url, avatar_signature, media_type, app_id, app_name, instance_id, stat_date, site_id, movie_id, distributor_id, recharge_template_id, recharge_template_name, callback_id, callback_name, user_id, lift_assistant, rewarded_ad, remark, `index`, create_time, update_time, run_status, fail_reason, movie_name)
-        select id, task_id, task_name, task_status, task_type, advertiser_id, advertiser_name, advertiser_name_update, template_value_name, advertiser_avatar_url, avatar_signature, media_type, app_id, app_name, instance_id, stat_date, site_id, movie_id, distributor_id, recharge_template_id, recharge_template_name, callback_id, callback_name, user_id, lift_assistant, rewarded_ad, remark, `index`, create_time, update_time,
-               case when plat_type=7 and ('AUDIT_PASS' = avatar_status and 'STATUS_ENABLE' = advertiser_status) then 1
-                    when plat_type=7 and ('FAIL' = advertiser_status or 'STATUS_CONFIRM_FAIL_END' = advertiser_status or 'AUDIT_REJECT' = avatar_status or 'FAIL' = avatar_status) then -1
-                    when plat_type=7 then 0
-                    when media_type=1 and (('AUDIT_ACCEPTED' = app_status or 'ADD_LINK_SUCCESS' = app_status or 'SHARE_SUCCESS' = app_status) and 'AUDIT_ACCEPTED' = site_status and (avatar_status is null or 'AUDIT_PASS'= avatar_status) and (advertiser_status is null or 'STATUS_ENABLE' = advertiser_status)) then 1
-                    when media_type=1 and (app_status is null or 'AUDIT_REJECTED' = app_status or 'FAIL' = app_status or 'ADD_LINK_FAIL' = app_status or 'SHARE_FAIL' = app_status or site_status is null or 'AUDIT_REJECTED' = site_status or 'AUDIT_REJECT' = avatar_status or 'FAIL' = avatar_status or 'FAIL' = advertiser_status or 'STATUS_CONFIRM_FAIL_END' = advertiser_status) then -1
-                    when media_type=1 then 0
-                    when media_type=3 and ('ENABLE' = site_status or 'AUDIT_ACCEPTED' = site_status) AND '1'=link_status then 1
-                    when media_type=3 and ('CREATE_FAILED' = site_status OR 'AUDIT_REJECTED' = site_status) then -1
-                    else 0 end as run_status,
-               concat(
-                       case when plat_type=7 and ( 'FAIL' = advertiser_status or 'STATUS_CONFIRM_FAIL_END' = advertiser_status) then '账户 '
-                            when plat_type != 7 and media_type=1 and ('FAIL' = advertiser_status or 'STATUS_CONFIRM_FAIL_END' = advertiser_status) then '账户 '
-                            else '' end,
-                       case when plat_type=7 and ( 'AUDIT_REJECT' = avatar_status or 'FAIL' = avatar_status) then '头像 '
-                            when plat_type != 7 and media_type=1 and ('AUDIT_REJECT' = avatar_status or 'FAIL' = avatar_status) then '头像 '
-                            else '' end,
-                       case when plat_type != 7 and media_type=1 and (app_status is null or 'AUDIT_REJECTED' = app_status or 'FAIL' = app_status or 'ADD_LINK_FAIL' = app_status or 'SHARE_FAIL' = app_status) then '小程序 '
-                            else '' end,
-                       case when plat_type != 7 and media_type=1 and (site_status is null or 'AUDIT_REJECTED' = site_status) then '落地页 '
-                            when plat_type != 7 and media_type=3 and ('CREATE_FAILED' = site_status OR 'AUDIT_REJECTED' = site_status) then '落地页 '
-                            else '' end
-               ) as fail_reason, standard_movie_name
-        from (select t1.*, t7.standard_movie_name,
-                     t2.audit_status as 'app_status',
-                     t3.`status` as 'site_status',
-                     t4.avatar_status as 'avatar_status',
-                     t5.advertiser_status as 'advertiser_status',
-                     t6.status as 'link_status',
-                     app.plat_type
-              from (select * from deepthink.bytedance_advertiser_task where create_time &gt;= #{startTime} and create_time &lt;= #{endTime}) t1
-                       left join deepthink.mini_app_info app on t1.app_id = app.app_id
-                       LEFT JOIN (select instance_id, advertiser_id, task_id, audit_status from deepthink.advertiser_app_list where create_time &gt;= #{startTime} and create_time &lt;= #{endTime}) t2
-                                 ON t1.instance_id = t2.instance_id AND t1.advertiser_id = t2.advertiser_id and t1.task_id = t2.task_id
-                       LEFT JOIN (select site_id, advertiser_id, `status` from deepthink.advertiser_tools_site where create_time &gt;= #{startTime} and create_time &lt;= #{endTime}) t3
-                                 ON t1.site_id = t3.site_id AND t1.advertiser_id = t3.advertiser_id
-                       LEFT JOIN (select advertiser_id, avatar_status from deepthink.advertiser_avatar where create_time &gt;= #{startTime} and create_time &lt;= #{endTime}) t4
-                                 ON t1.advertiser_id = t4.advertiser_id
-                       LEFT JOIN (select advertiser_id, advertiser_status from deepthink.advertiser_name_info where create_time &gt;= #{startTime} and create_time &lt;= #{endTime}) t5
-                                 ON t1.advertiser_id = t5.advertiser_id
-                       LEFT JOIN (select task_id, advertiser_id, `status` from deepthink.bytedance_advertiser_task_link where create_time &gt;= #{startTime} and create_time &lt;= #{endTime}) t6
-                                 ON t1.task_id = t6.task_id AND t1.advertiser_id = t6.advertiser_id
-                       LEFT JOIN (select standard_movie_id, standard_movie_name from deepthink.all_moive group by standard_movie_id, standard_movie_name) t7
-                                 on cast(t1.movie_id as char) = t7.standard_movie_id
-             ) t
-    </update>
-
-
-    <select id="refreshList" resultType="com.alibaba.fastjson.JSONObject">
-        select tb1.task_id, tb1.advertiser_id, tb1.promoter_id, tb1.link_uuid, tb4.expire_time,
-        tb2.media_type, tb3.app_plat_type,
-        tb3.movie_id as video_id, tb5.id as video_detail_id,
-        tb1.promoter_uri, tb2.app_id, tb6.id as applet_id,
-        tb5.platform_config, tb5.sort, tb7.album_id
-        from
-        (select *
-        from deepthink.bytedance_advertiser_task_link
-        where link_uuid is not null and status=1) tb1
-        inner join deepthink.bytedance_advertiser_task tb2
-        on tb1.task_id=tb2.task_id and tb1.advertiser_id = tb2.advertiser_id
-        left join deepthink.bytedance_advertiser_task_template tb3
-        on tb1.task_id=tb3.task_id
-        left join deepthink.bytedance_landing_redirect tb4
-        on tb1.link_uuid = tb4.uuid
-        left join thirtpart.ly_video_details tb5
-        on tb3.movie_id = tb5.video_id and tb3.entry_chapter_count = tb5.sort
-        left join thirtpart.ly_applet tb6
-        on tb2.app_id = tb6.app_id
-        left join thirtpart.ly_third_videos tb7
-        on tb3.movie_id = tb7.video_id and platform=2
-        where tb4.expire_time &lt;= ${expireTime}
-    </select>
-</mapper>

+ 0 - 385
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/ToolsSiteMapper.xml

@@ -1,385 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="cn.com.ctop.job.bytedance.data.mapper.ToolsSiteMapper">
-
-    <insert id="replaceAdvertiserToolsSite">
-        replace into deepthink.advertiser_tools_site(
-        site_id,
-        advertiser_id,
-        name,
-        thumbnail,
-        status,
-        site_type,
-        function_type,
-        create_type
-        )
-        values
-        <foreach collection="siteList" item="item" separator=",">
-            (
-            #{item.siteId},
-            #{item.advertiserId},
-            #{item.name},
-            #{item.thumbnail},
-            #{item.status},
-            #{item.siteType},
-            #{item.functionType},
-            #{item.createType} )
-        </foreach>
-    </insert>
-
-    <select id="getAvatarAdvertiserIds" resultType="Long">
-        select advertiser_id
-        from deepthink.advertiser_avatar
-        where avatar_status = 'IN_AUDIT'
-    </select>
-
-    <update id="updateAdvertiserAvatar" parameterType="cn.com.ctop.job.bytedance.data.entity.AdvertiserAvatar">
-        update deepthink.advertiser_avatar
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="avatarStatus != null">avatar_status = #{avatarStatus},</if>
-            <if test="avatarReason != null">avatar_reason = #{avatarReason},</if>
-            <if test="sourceStatus != null">source_status = #{sourceStatus},</if>
-            <if test="sourceInfo != null">source_info = #{sourceInfo},</if>
-            <if test="sourceReason != null">source_reason = #{sourceReason},</if>
-            <if test="webUri != null">web_uri = #{webUri},</if>
-            <if test="auditWebUri != null">audit_web_uri = #{auditWebUri},</if>
-            <if test="height != null">height = #{height},</if>
-            <if test="width != null">width = #{width},</if>
-            <if test="webUrl != null">web_url = #{webUrl},</if>
-            <if test="auditWebUrl != null">audit_web_url = #{auditWebUrl},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="updateTime != null">update_time = #{updateTime},</if>
-            <if test="reason != null">reason = #{reason},</if>
-        </trim>
-        where advertiser_id = #{advertiserId}
-    </update>
-
-    <insert id="insertAdvertiserAvatar" parameterType="cn.com.ctop.job.bytedance.data.entity.AdvertiserAvatar">
-        insert into deepthink.advertiser_avatar
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="advertiserId != null">advertiser_id,</if>
-            <if test="avatarStatus != null">avatar_status,</if>
-            <if test="avatarReason != null">avatar_reason,</if>
-            <if test="sourceStatus != null">source_status,</if>
-            <if test="sourceInfo != null">source_info,</if>
-            <if test="sourceReason != null">source_reason,</if>
-            <if test="webUri != null">web_uri,</if>
-            <if test="auditWebUri != null">audit_web_uri,</if>
-            <if test="height != null">height,</if>
-            <if test="width != null">width,</if>
-            <if test="webUrl != null">web_url,</if>
-            <if test="auditWebUrl != null">audit_web_url,</if>
-            <if test="ossUrl != null">oss_url,</if>
-            <if test="reason != null">reason,</if>
-            <if test="parameters != null">parameters,</if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="advertiserId != null">#{advertiserId},</if>
-            <if test="avatarStatus != null">#{avatarStatus},</if>
-            <if test="avatarReason != null">#{avatarReason},</if>
-            <if test="sourceStatus != null">#{sourceStatus},</if>
-            <if test="sourceInfo != null">#{sourceInfo},</if>
-            <if test="sourceReason != null">#{sourceReason},</if>
-            <if test="webUri != null">#{webUri},</if>
-            <if test="auditWebUri != null">#{auditWebUri},</if>
-            <if test="height != null">#{height},</if>
-            <if test="width != null">#{width},</if>
-            <if test="webUrl != null">#{webUrl},</if>
-            <if test="auditWebUrl != null">#{auditWebUrl},</if>
-            <if test="ossUrl != null">#{ossUrl},</if>
-            <if test="reason != null">#{reason},</if>
-            <if test="parameters != null">#{parameters},</if>
-        </trim>
-    </insert>
-
-    <select id="getNameAdvertiserIds" resultType="Long">
-        select advertiser_id
-        from deepthink.advertiser_name_info
-        where advertiser_status = 'STATUS_PENDING_CONFIRM'
-           OR (
-            reason like '%账户名已存在%'
-                and advertiser_status = 'FAIL'
-            )
-    </select>
-
-    <insert id="insertAdvertiserNameInfo" parameterType="cn.com.ctop.job.bytedance.data.entity.AdvertiserNameInfo">
-        insert into deepthink.advertiser_name_info
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="advertiserId != null">advertiser_id,</if>
-            <if test="advertiserName != null">advertiser_name,</if>
-            <if test="advertiserStatus != null">advertiser_status,</if>
-            <if test="reason != null">reason,</if>
-            <if test="parameters != null">parameters,</if>
-            <if test="createTime != null">create_time,</if>
-            <if test="updateTime != null">update_time,</if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="advertiserId != null">#{advertiserId},</if>
-            <if test="advertiserName != null">#{advertiserName},</if>
-            <if test="advertiserStatus != null">#{advertiserStatus},</if>
-            <if test="reason != null">#{reason},</if>
-            <if test="parameters != null">#{parameters},</if>
-            <if test="createTime != null">#{createTime},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-        </trim>
-    </insert>
-
-    <update id="updateAdvertiserNameInfo" parameterType="cn.com.ctop.job.bytedance.data.entity.AdvertiserNameInfo">
-        update deepthink.advertiser_name_info
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="advertiserName != null">advertiser_name = #{advertiserName},</if>
-            <if test="advertiserStatus != null">advertiser_status = #{advertiserStatus},</if>
-            <if test="reason != null">reason = #{reason},</if>
-            <if test="parameters != null">parameters = #{parameters},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="updateTime != null">update_time = #{updateTime},</if>
-        </trim>
-        where advertiser_id = #{advertiserId}
-    </update>
-
-
-    <select id="getAppAdvertiserIds" resultType="Long">
-        select advertiser_id
-        from deepthink.advertiser_app_list
-        where audit_status = 'AUDITING'
-          AND plat_type = #{platType}
-    </select>
-
-
-    <insert id="insertAdvertiserAppList" parameterType="cn.com.ctop.job.bytedance.data.entity.AdvertiserApplet"
-            useGeneratedKeys="true"
-            keyProperty="id">
-        replace into deepthink.advertiser_app_list
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="advertiserId != null">advertiser_id,</if>
-            <if test="appName != null">app_name,</if>
-            <if test="remark != null">remark,</if>
-            <if test="instanceId != null">instance_id,</if>
-            <if test="appId != null">app_id,</if>
-            <if test="originalAppId != null">original_app_id,</if>
-            <if test="platType != null">plat_type,</if>
-            <if test="auditStatus != null">audit_status,</if>
-            <if test="reason != null">reason,</if>
-            <if test="link != null">link,</if>
-            <if test="linkRemark != null">link_remark,</if>
-            <if test="path != null">path,</if>
-            <if test="remarkMessage != null">remark_message,</if>
-            <if test="iconImageUrl != null">icon_image_url,</if>
-            <if test="headerImageUrl != null">header_image_url,</if>
-            <if test="labels != null">labels,</if>
-            <if test="guideText != null">guide_text,</if>
-            <if test="imagesVerticalUrl != null">images_vertical_url,</if>
-            <if test="imagesHorizontalUrl != null">images_horizontal_url,</if>
-            <if test="introduction != null">introduction,</if>
-            <if test="tagInfo != null">tag_info,</if>
-            <if test="startPage != null">start_page,</if>
-            <if test="startParam != null">start_param,</if>
-            <if test="appCreateTime != null">app_create_time,</if>
-            <if test="appUpdateTime != null">app_update_time,</if>
-            <if test="parameters != null">parameters,</if>
-            <if test="taskId != null">task_id,</if>
-            <if test="appShare != null">app_share,</if>
-            <if test="shareAdvertiserId != null">share_advertiser_id,</if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="advertiserId != null">#{advertiserId},</if>
-            <if test="appName != null">#{appName},</if>
-            <if test="remark != null">#{remark},</if>
-            <if test="instanceId != null">#{instanceId},</if>
-            <if test="appId != null">#{appId},</if>
-            <if test="originalAppId != null">#{originalAppId},</if>
-            <if test="platType != null">#{platType},</if>
-            <if test="auditStatus != null">#{auditStatus},</if>
-            <if test="reason != null">#{reason},</if>
-            <if test="link != null">#{link},</if>
-            <if test="linkRemark != null">#{linkRemark},</if>
-            <if test="path != null">#{path},</if>
-            <if test="remarkMessage != null">#{remarkMessage},</if>
-            <if test="iconImageUrl != null">#{iconImageUrl},</if>
-            <if test="headerImageUrl != null">#{headerImageUrl},</if>
-            <if test="labels != null">#{labels},</if>
-            <if test="guideText != null">#{guideText},</if>
-            <if test="imagesVerticalUrl != null">#{imagesVerticalUrl},</if>
-            <if test="imagesHorizontalUrl != null">#{imagesHorizontalUrl},</if>
-            <if test="introduction != null">#{introduction},</if>
-            <if test="tagInfo != null">#{tagInfo},</if>
-            <if test="startPage != null">#{startPage},</if>
-            <if test="startParam != null">#{startParam},</if>
-            <if test="appCreateTime != null">#{appCreateTime},</if>
-            <if test="appUpdateTime != null">#{appUpdateTime},</if>
-            <if test="parameters != null">#{parameters},</if>
-            <if test="taskId != null">#{taskId},</if>
-            <if test="appShare != null">#{appShare},</if>
-            <if test="shareAdvertiserId != null">#{shareAdvertiserId},</if>
-        </trim>
-    </insert>
-
-    <update id="updateAdvertiserAppList2" parameterType="cn.com.ctop.job.bytedance.data.entity.AdvertiserApplet">
-        update deepthink.advertiser_app_list
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="advertiserId != null">advertiser_id = #{advertiserId},</if>
-            <if test="appName != null">app_name = #{appName},</if>
-            <if test="remark != null">remark = #{remark},</if>
-            <if test="instanceId != null">instance_id = #{instanceId},</if>
-            <if test="appId != null">app_id = #{appId},</if>
-            <if test="originalAppId != null">original_app_id = #{originalAppId},</if>
-            <if test="platType != null">plat_type = #{platType},</if>
-            <if test="auditStatus != null">audit_status = #{auditStatus},</if>
-            <if test="reason != null">reason = #{reason},</if>
-            <if test="link != null">link = #{link},</if>
-            <if test="linkRemark != null">link_remark = #{linkRemark},</if>
-            <if test="path != null">path = #{path},</if>
-            <if test="remarkMessage != null">remark_message = #{remarkMessage},</if>
-            <if test="iconImageUrl != null">icon_image_url = #{iconImageUrl},</if>
-            <if test="headerImageUrl != null">header_image_url = #{headerImageUrl},</if>
-            <if test="labels != null">labels = #{labels},</if>
-            <if test="guideText != null">guide_text = #{guideText},</if>
-            <if test="imagesVerticalUrl != null">images_vertical_url = #{imagesVerticalUrl},</if>
-            <if test="imagesHorizontalUrl != null">images_horizontal_url = #{imagesHorizontalUrl},</if>
-            <if test="introduction != null">introduction = #{introduction},</if>
-            <if test="tagInfo != null">tag_info = #{tagInfo},</if>
-            <if test="startPage != null">start_page = #{startPage},</if>
-            <if test="startParam != null">start_param = #{startParam},</if>
-            <if test="appCreateTime != null">app_create_time = #{appCreateTime},</if>
-            <if test="appUpdateTime != null">app_update_time = #{appUpdateTime},</if>
-            <if test="taskId != null">task_id = #{taskId},</if>
-            <if test="appShare != null">app_share = #{appShare},</if>
-            <if test="shareAdvertiserId != null">share_advertiser_id = #{shareAdvertiserId},</if>
-        </trim>
-        WHERE advertiser_id = #{advertiserId}
-        AND instance_id = #{instanceId}
-        AND task_id = #{taskId}
-    </update>
-
-    <update id="updateAdvertiserAppList" parameterType="cn.com.ctop.job.bytedance.data.entity.AdvertiserApplet">
-        update deepthink.advertiser_app_list
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="advertiserId != null">advertiser_id = #{advertiserId},</if>
-            <if test="appName != null">app_name = #{appName},</if>
-            <if test="remark != null">remark = #{remark},</if>
-            <if test="instanceId != null">instance_id = #{instanceId},</if>
-            <if test="appId != null">app_id = #{appId},</if>
-            <if test="originalAppId != null">original_app_id = #{originalAppId},</if>
-            <if test="platType != null">plat_type = #{platType},</if>
-            <if test="auditStatus != null">audit_status = #{auditStatus},</if>
-            <if test="reason != null">reason = #{reason},</if>
-            <if test="link != null">link = #{link},</if>
-            <if test="linkRemark != null">link_remark = #{linkRemark},</if>
-            <if test="path != null">path = #{path},</if>
-            <if test="remarkMessage != null">remark_message = #{remarkMessage},</if>
-            <if test="iconImageUrl != null">icon_image_url = #{iconImageUrl},</if>
-            <if test="headerImageUrl != null">header_image_url = #{headerImageUrl},</if>
-            <if test="labels != null">labels = #{labels},</if>
-            <if test="guideText != null">guide_text = #{guideText},</if>
-            <if test="imagesVerticalUrl != null">images_vertical_url = #{imagesVerticalUrl},</if>
-            <if test="imagesHorizontalUrl != null">images_horizontal_url = #{imagesHorizontalUrl},</if>
-            <if test="introduction != null">introduction = #{introduction},</if>
-            <if test="tagInfo != null">tag_info = #{tagInfo},</if>
-            <if test="startPage != null">start_page = #{startPage},</if>
-            <if test="startParam != null">start_param = #{startParam},</if>
-            <if test="appCreateTime != null">app_create_time = #{appCreateTime},</if>
-            <if test="appUpdateTime != null">app_update_time = #{appUpdateTime},</if>
-            <if test="taskId != null">task_id = #{taskId},</if>
-            <if test="appShare != null">app_share = #{appShare},</if>
-            <if test="shareAdvertiserId != null">share_advertiser_id = #{shareAdvertiserId},</if>
-        </trim>
-        WHERE advertiser_id = #{advertiserId}
-        AND instance_id = #{instanceId}
-        AND plat_type = #{platType}
-    </update>
-
-    <select id="getsiteAdvertiserIds2" resultType="com.alibaba.fastjson.JSONObject">
-        select advertiser_id, task_id
-        from deepthink.advertiser_tools_site
-        where status = 'EDIT'
-    </select>
-
-    <select id="getsiteAdvertiserIds" resultType="Long">
-        select advertiser_id
-        from deepthink.advertiser_tools_site
-        where status = 'ENABLE'
-    </select>
-
-    <select id="queryIsCreateSite" resultType="com.alibaba.fastjson.JSONObject">
-        select task_id, task_name, advertiser_id
-        from deepthink.bytedance_advertiser_task
-        where site_id is null
-          AND advertiser_id = #{advertiserId}
-          AND instance_id = #{instanceId}
-    </select>
-
-
-    <select id="queryAdvertiserAppList" resultType="cn.com.ctop.job.bytedance.data.entity.AdvertiserApplet">
-        select advertiser_id,
-        instance_id,
-        app_name,
-        task_id,
-        audit_status
-        from deepthink.advertiser_app_list
-        <where>
-            <if test="platType != null ">and plat_type = #{platType}</if>
-            <if test="advertiserId != null ">and advertiser_id = #{advertiserId}</if>
-        </where>
-    </select>
-
-
-    <update id="updateAdvertiserToolsSite" parameterType="cn.com.ctop.job.bytedance.data.entity.AdvertiserToolsSite">
-        update deepthink.advertiser_tools_site
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="name != null">name = #{name},</if>
-            <if test="thumbnail != null">thumbnail = #{thumbnail},</if>
-            <if test="status != null">status = #{status},</if>
-            <if test="siteType != null">site_type = #{siteType},</if>
-            <if test="functionType != null">function_type = #{functionType},</if>
-            <if test="createType != null">create_type = #{createType},</if>
-            <if test="parameters != null">parameters = #{parameters},</if>
-            <if test="taskId != null">task_id = #{taskId},</if>
-        </trim>
-        where site_id = #{siteId}
-        AND advertiser_id = #{advertiserId}
-    </update>
-
-
-    <insert id="insertAdvertiserToolsSite" parameterType="cn.com.ctop.job.bytedance.data.entity.AdvertiserToolsSite">
-        replace into deepthink.advertiser_tools_site
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="siteId != null">site_id,</if>
-            <if test="advertiserId != null">advertiser_id,</if>
-            <if test="name != null">name,</if>
-            <if test="thumbnail != null">thumbnail,</if>
-            <if test="status != null">status,</if>
-            <if test="reason != null">reason,</if>
-            <if test="siteType != null">site_type,</if>
-            <if test="functionType != null">function_type,</if>
-            <if test="createType != null">create_type,</if>
-            <if test="createTime != null">create_time,</if>
-            <if test="updateTime != null">update_time,</if>
-            <if test="parameters != null">parameters,</if>
-            <if test="taskId != null">task_id,</if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="siteId != null">#{siteId},</if>
-            <if test="advertiserId != null">#{advertiserId},</if>
-            <if test="name != null">#{name},</if>
-            <if test="thumbnail != null">#{thumbnail},</if>
-            <if test="status != null">#{status},</if>
-            <if test="reason != null">#{reason},</if>
-            <if test="siteType != null">#{siteType},</if>
-            <if test="functionType != null">#{functionType},</if>
-            <if test="createType != null">#{createType},</if>
-            <if test="createTime != null">#{createTime},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-            <if test="parameters != null">#{parameters},</if>
-            <if test="taskId != null">#{taskId},</if>
-        </trim>
-    </insert>
-
-
-    <select id="getTimeOutAppList" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT task_id, advertiser_id, plat_type
-        FROM deepthink.advertiser_app_list
-        WHERE audit_status = 'FAIL'
-          AND reason like '%timed out%'
-    </select>
-
-</mapper>

+ 0 - 518
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/ZtPolicyMapper.xml

@@ -1,518 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="cn.com.ctop.job.bytedance.data.mapper.ZtPolicyMapper">
-
-    <resultMap id="ZtPolicyWithCondActionResultMap" type="cn.com.ctop.job.bytedance.data.entity.ZtPolicy">
-
-        <!-- config -->
-        <id     property="id"               column="id"/>
-        <result property="name"             column="name"/>
-        <result property="status"           column="status"/>
-        <result property="mediaId"          column="media_id"/>
-        <result property="scheduleType"     column="schedule_type"/>
-        <result property="managedDimension" column="managed_dimension"/>
-        <result property="targetScope"      column="target_scope"/>
-        <result property="conditionLogic"      column="condition_logic"/>
-        <result property="createdAt"        column="created_at"/>
-        <result property="createdBy"        column="created_by"/>
-        <result property="updatedAt"        column="updated_at"/>
-        <result property="updatedBy"        column="updated_by"/>
-        <result property="createUserId"     column="create_user_id"/>
-
-        <!-- conditions: config.id -> cd.owner_id (1:N) -->
-        <collection property="conditions" ofType="cn.com.ctop.job.bytedance.data.entity.ZtPolicyCondition">
-            <id     property="id"               column="cd_id"/>
-            <result property="indicatorId"      column="cd_indicator_id"/>
-            <result property="operator"         column="cd_operator"/>
-            <result property="timeType"         column="cd_time_type"/>
-            <result property="compareValueJson" column="cd_compare_value_json"/>
-            <result property="descriptionZh"    column="cd_description_zh"/>
-        </collection>
-
-        <!-- actions: config.id -> ac.owner_id (1:N) -->
-        <collection property="actions" ofType="cn.com.ctop.job.bytedance.data.entity.ZtPolicyAction">
-            <id     property="id"            column="ac_id"/>
-            <result property="actionType"    column="ac_action_type"/>
-            <result property="actionRuleJson" column="ac_action_rule_json"/>
-            <result property="descriptionZh" column="ac_description_zh"/>
-        </collection>
-
-    </resultMap>
-    <insert id="insertRunRecords">
-        insert into deepthink.zt_rule_run_log
-        (id, run_id, advertiser_id, target_type, target_id, condition_id,
-         operation_executed, trigger_time, matched_conditions_json, matched_condition_desc, policy_config_id)
-        values
-        <foreach collection="list" item="item" open="" close="" separator=",">
-            (#{item.uuid}, #{item.runId}, #{item.advertiserId}, #{item.managedDimension}, #{item.targetId}, #{item.conditionId},
-             #{item.isExecute}, #{item.triggerTime}, #{item.matchedConditionJsonStr}, #{item.matchedConditionDesc}, #{item.policyId})
-        </foreach>
-    </insert>
-    <insert id="insertPolicyRunRecord">
-        insert into deepthink.zt_policy_run
-            (run_id, policy_config_id, scheduled_time, result_status)
-        values
-            (#{runId}, #{policyConfigId}, #{scheduledTime}, 0)
-    </insert>
-    <insert id="insertActionLog">
-            insert into deepthink.zt_policy_action_log
-            (
-            id,
-            run_id,
-            policy_config_id,
-            target_type,
-            target_id,
-            action_id,
-            action_type,
-            executed,
-            skip_reason,
-            result_status,
-            error_message
-            )
-            values
-            <foreach collection="list" item="item" separator=",">
-                (
-                #{item.id},
-                #{item.runId},
-                #{item.policyId},
-                #{item.targetType},
-                #{item.targetId},
-                #{item.actionId},
-                #{item.actionType},
-                #{item.executed},
-                #{item.skipReason},
-                #{item.resultStatus},
-                #{item.errorMessage}
-                )
-            </foreach>
-    </insert>
-    <update id="updatePolicyRunRecord">
-        update deepthink.zt_policy_run
-        <set>
-            <if test="startTime != null">start_time = #{startTime},</if>
-            <if test="endTime != null">end_time = #{endTime},</if>
-            <if test="triggered != null">triggered = #{triggered},</if>
-            <if test="triggerNum != null">trigger_num = #{triggerNum},</if>
-            <if test="resultStatus != null">result_status = #{resultStatus},</if>
-            <if test="errorMessage != null">error_message = #{errorMessage},</if>
-        </set>
-        where run_id = #{runId}
-    </update>
-    <select id="getPolicyDetail" resultMap="ZtPolicyWithCondActionResultMap">
-        select config.id, config.name, config.status,
-               config.media_id,
-               config.schedule_type, config.managed_dimension, config.target_scope, config.condition_logic,
-               config.created_at, config.created_by, config.updated_at, config.updated_by, config.create_user_id,
-               cd.id              as cd_id,
-               cd.indicator_id    as cd_indicator_id,
-               cd.operator        as cd_operator,
-               cd.time_type       as cd_time_type,
-               cd.compare_value_json as cd_compare_value_json,
-               cd.description_zh  as cd_description_zh,
-
-               ac.id              as ac_id,
-               ac.action_type     as ac_action_type,
-               ac.action_rule_json as ac_action_rule_json,
-               ac.description_zh  as ac_description_zh
-        from (select * from deepthink.zt_policy_config where is_deleted=0) config
-                 left join deepthink.zt_policy_condition cd on config.id = cd.owner_id and cd.owner_type=1
-                 left join deepthink.zt_policy_action ac on config.id = ac.owner_id and ac.owner_type=1
-        where config.id = #{policyId} and is_deleted=0
-    </select>
-    <select id="getTargetFilters" resultType="cn.com.ctop.job.bytedance.data.entity.ZtPolicyTargetFilter">
-        select policy_config_id, target_dimension, filter_key, filter_value
-        from deepthink.zt_policy_target_filter
-        where policy_config_id = #{policyId}
-    </select>
-    <select id="getTargetIds" resultType="cn.com.ctop.job.bytedance.data.entity.ZtPolicyTargetIds">
-        select policy_config_id, target_type, target_id
-        from deepthink.zt_policy_target_ids
-        where policy_config_id = #{policyId}
-    </select>
-    <select id="advFilterList" resultType="com.alibaba.fastjson.JSONObject">
-        select distinct tb1.advertiser_id from
-        (select ma_appid, advertiser_id
-        from application.media_ad_report_daily where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-        group by ma_appid, advertiser_id
-        having sum(show_num)>0
-        ) tb1
-        join (select advertiser_id, advertiser_name, user_id, ma_appid from tidb.deepthink.advertiser_bind_info) tb2
-        on tb1.advertiser_id = tb2.advertiser_id
-        left join tidb.deepthink.mini_app_info tb3 on tb1.ma_appid = tb3.app_id
-        left join tidb.deepthink.sys_user tb4 on tb2.user_id = tb4.user_id
-        left join (select advertiser_id, movie_id
-        from application.media_ad_report_daily
-        where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-        group by advertiser_id, movie_id
-        ) tb5 on tb1.advertiser_id = tb5.advertiser_id
-        left join (select distinct moive_id, standard_movie_id
-        from tidb.deepthink.all_moive) tb6 on tb5.movie_id = tb6.moive_id
-        <where>
-            <if test="appId != null and appId.size > 0">
-                and tb3.app_id in
-                <foreach collection="appId" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="businessMethod != null and businessMethod.size > 0">
-                and tb3.business_method in
-                <foreach collection="businessMethod" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="businessLine != null and businessLine.size > 0">
-                and tb3.business_line in
-                <foreach collection="businessLine" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="optimizerId != null and optimizerId.size > 0">
-                and tb4.user_id in
-                <foreach collection="optimizerId" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="deptId != null and deptId.size > 0">
-                and tb4.dept_id in
-                <foreach collection="deptId" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="movieId != null and movieId.size > 0">
-                and tb6.standard_movie_id in
-                <foreach collection="movieId" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-        </where>
-    </select>
-    <select id="adProjFilterList" resultType="com.alibaba.fastjson.JSONObject">
-        select distinct tb1.advertiser_id, tb1.a_id from
-        (select ma_appid, advertiser_id, a_id
-        from application.media_ad_report_daily where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-        group by ma_appid, advertiser_id, a_id
-        having sum(show_num)>0
-        ) tb1
-        join (select advertiser_id, advertiser_name, user_id, ma_appid from tidb.deepthink.advertiser_bind_info) tb2
-        on tb1.advertiser_id = tb2.advertiser_id
-        left join tidb.deepthink.mini_app_info tb3 on tb1.ma_appid = tb3.app_id
-        left join tidb.deepthink.sys_user tb4 on tb2.user_id = tb4.user_id
-        left join (select advertiser_id, movie_id
-        from application.media_ad_report_daily
-        where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-        group by advertiser_id, movie_id
-        ) tb5 on tb1.advertiser_id = tb5.advertiser_id
-        left join (select distinct moive_id, standard_movie_id
-        from tidb.deepthink.all_moive) tb6 on tb5.movie_id = tb6.moive_id
-        <where>
-            <if test="appId != null and appId.size > 0">
-                and tb3.app_id in
-                <foreach collection="appId" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="businessMethod != null and businessMethod.size > 0">
-                and tb3.business_method in
-                <foreach collection="businessMethod" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="businessLine != null and businessLine.size > 0">
-                and tb3.business_line in
-                <foreach collection="businessLine" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="optimizerId != null and optimizerId.size > 0">
-                and tb4.user_id in
-                <foreach collection="optimizerId" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="deptId != null and deptId.size > 0">
-                and tb4.dept_id in
-                <foreach collection="deptId" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="movieId != null and movieId.size > 0">
-                and tb6.standard_movie_id in
-                <foreach collection="movieId" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-        </where>
-    </select>
-    <select id="adPromFilterList" resultType="com.alibaba.fastjson.JSONObject">
-        select distinct tb1.advertiser_id, tb1.ad_id from
-        (select ma_appid, advertiser_id, ad_id
-        from application.media_ad_report_daily where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-        group by ma_appid, advertiser_id, ad_id
-        having sum(show_num)>0
-        ) tb1
-        join (select advertiser_id, advertiser_name, user_id, ma_appid from tidb.deepthink.advertiser_bind_info) tb2
-        on tb1.advertiser_id = tb2.advertiser_id
-        left join tidb.deepthink.mini_app_info tb3 on tb1.ma_appid = tb3.app_id
-        left join tidb.deepthink.sys_user tb4 on tb2.user_id = tb4.user_id
-        left join (select advertiser_id, movie_id
-        from application.media_ad_report_daily
-        where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-        group by advertiser_id, movie_id
-        ) tb5 on tb1.advertiser_id = tb5.advertiser_id
-        left join (select distinct moive_id, standard_movie_id
-        from tidb.deepthink.all_moive) tb6 on tb5.movie_id = tb6.moive_id
-        <where>
-            <if test="appId != null and appId.size > 0">
-                and tb3.app_id in
-                <foreach collection="appId" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="businessMethod != null and businessMethod.size > 0">
-                and tb3.business_method in
-                <foreach collection="businessMethod" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="businessLine != null and businessLine.size > 0">
-                and tb3.business_line in
-                <foreach collection="businessLine" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="optimizerId != null and optimizerId.size > 0">
-                and tb4.user_id in
-                <foreach collection="optimizerId" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="deptId != null and deptId.size > 0">
-                and tb4.dept_id in
-                <foreach collection="deptId" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="movieId != null and movieId.size > 0">
-                and tb6.standard_movie_id in
-                <foreach collection="movieId" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
-            </if>
-        </where>
-    </select>
-
-    <select id="advListFromAdvIds" resultType="java.lang.String">
-        select tb2.advertiser_id
-        from tidb.deepthink.zt_policy_target_ids tb1
-                 join (select advertiser_id
-                       from application.media_ad_report_daily
-                       where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-                       group by advertiser_id
-                       having sum(show_num)>0
-                       ) tb2
-                      on tb1.target_id = tb2.advertiser_id
-    </select>
-    <select id="projectListFromAdvIds" resultType="com.alibaba.fastjson.JSONObject">
-        select advertiser_id, a_id
-        from tidb.deepthink.zt_policy_target_ids tb1
-                 join (select advertiser_id, a_id
-                       from application.media_ad_report_daily
-                       where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-                       group by advertiser_id , a_id
-                       having sum(show_num)>0
-                       ) tb2
-                      on tb1.target_id = tb2.advertiser_id
-    </select>
-    <select id="projectListFromProjIds" resultType="com.alibaba.fastjson.JSONObject">
-        select advertiser_id, a_id
-        from tidb.deepthink.zt_policy_target_ids tb1
-                 join (select advertiser_id, a_id
-                       from application.media_ad_report_daily
-                       where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-                       group by advertiser_id , a_id
-                       having sum(show_num)>0
-                       ) tb2
-                      on tb1.target_id = tb2.a_id
-    </select>
-    <select id="adListFromAdvIds" resultType="com.alibaba.fastjson.JSONObject">
-        select advertiser_id, ad_id
-        from tidb.deepthink.zt_policy_target_ids tb1
-                 join (select advertiser_id, a_id, ad_id
-                       from application.media_ad_report_daily
-                       where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-                       group by advertiser_id , a_id, ad_id
-                       having sum(show_num)>0
-                       ) tb2
-                      on tb1.target_id = tb2.advertiser_id
-    </select>
-    <select id="adListFromAdIds" resultType="com.alibaba.fastjson.JSONObject">
-        select advertiser_id, ad_id
-        from tidb.deepthink.zt_policy_target_ids tb1
-                 join (select advertiser_id, a_id, ad_id
-                       from application.media_ad_report_daily
-                       where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-                       group by advertiser_id , a_id, ad_id
-                       having sum(show_num)>0
-                       ) tb2
-                      on tb1.target_id = tb2.ad_id
-    </select>
-    <select id="adData" resultType="com.alibaba.fastjson.JSONObject">
-        select
-        <choose>
-            <when test="managedDimension == 1">
-                coalesce(tb1.advertiser_id, tb2.advertiser_id) as target_id,
-            </when>
-            <when test="managedDimension == 2">
-                coalesce(tb1.a_id, tb2.a_id) as target_id,
-            </when>
-            <when test="managedDimension == 3">
-                coalesce(tb1.ad_id, tb2.ad_id) as target_id,
-            </when>
-        </choose>
-            ${selectIndicator}
-        from
-            (select advertiser_id, a_id, ad_id, ${mediaAdColumns}
-             <if test="timeType == 1">
-                 from application.media_ad_report_daily
-                 where stat_date &gt;= #{startDate} and stat_date &lt;= #{endDate}
-             </if>
-             <if test="timeType == 2">
-                 from application.media_ad_report_hourly
-                 where stat_date = #{date}
-                 <if test="hour != null and hour > 0">
-                     and `hour`=#{hour}
-                 </if>
-             </if>
-             group by advertiser_id, a_id, ad_id
-            ) tb1
-            full join
-            (select advertiser_id, a_id, ad_id, ${userDataColumns}
-            <if test="timeType == 1">
-                from application.user_data_report_daily
-                where stat_date &gt;= #{startDate} and stat_date &lt;= #{endDate}
-            </if>
-            <if test="timeType == 2">
-                from application.user_data_report_hourly
-                where stat_date = #{date}
-                <if test="hour != null and hour > 0">
-                    and `hour`=#{hour}
-                </if>
-            </if>
-            group by advertiser_id, a_id, ad_id
-            ) tb2
-        on tb1.advertiser_id = tb2.advertiser_id
-            and tb1.a_id = tb2.a_id
-            and tb1.ad_id = tb2.ad_id
-        <where>
-            <choose>
-                <when test="managedDimension == 1">
-                    coalesce(tb1.advertiser_id, tb2.advertiser_id) in
-                    <foreach collection="idList" item="item" open="(" close=")" separator=",">
-                        #{item}
-                    </foreach>
-                </when>
-                <when test="managedDimension == 2">
-                    coalesce(tb1.a_id, tb2.a_id) in
-                    <foreach collection="idList" item="item" open="(" close=")" separator=",">
-                        #{item}
-                    </foreach>
-                </when>
-                <when test="managedDimension == 3">
-                    coalesce(tb1.ad_id, tb2.ad_id) in
-                    <foreach collection="idList" item="item" open="(" close=")" separator=",">
-                        #{item}
-                    </foreach>
-                </when>
-            </choose>
-        </where>
-        group by 1
-    </select>
-    <select id="promotionData" resultType="com.alibaba.fastjson.JSONObject">
-        select promotion_id as target_id, status_first as bytedance_promote_status
-        from media_api.bytedance_promotion_list
-        where promotion_id in
-        <foreach collection="idList" item="item" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
-    </select>
-    <select id="promotionGroupToProjectData" resultType="com.alibaba.fastjson.JSONObject">
-        select project_id as target_id, group_concat(distinct status_first) as bytedance_project_status
-        from media_api.bytedance_promotion_list
-        where project_id in
-        <foreach collection="idList" item="item" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
-        group by project_id
-    </select>
-    <select id="projectData" resultType="com.alibaba.fastjson.JSONObject">
-        select project_id as target_id, bid_type as bytedance_project_bid_type,
-               roi_goal as bytedance_project_roi_goal,
-               cpa_bid as bytedance_project_cpa_bid,
-        external_action as bytedance_project_external_action,
-        deep_external_action as bytedance_project_deep_external_action
-        from media_api.bytedance_cdp_project_list
-        where project_id in
-        <foreach collection="idList" item="item" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
-    </select>
-    <select id="balanceData" resultType="com.alibaba.fastjson.JSONObject">
-        select advertiser_id as target_id, (wallet_total_balance_valid + balance) as bytedance_advertiser_balance
-        from media_api.bytedance_advertiser_fund
-        where advertiser_id in
-        <foreach collection="idList" item="item" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
-    </select>
-    <select id="indicatorList" resultType="com.alibaba.fastjson.JSONObject">
-        select indicator_id, indicator_name, indicator_code, data_source, time_type, formula, from_page
-        from deepthink.indicator_info
-        where indicator_id in 
-        <foreach collection="indicatorIds" item="item" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
-    </select>
-    <select id="businessLineName" resultType="java.lang.String">
-        select dict_name
-        from deepthink.dt_dictionary
-        where select_key='business_line'
-        and dict_key in
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
-    </select>
-
-    <select id="advertiserTargetNameInfo" resultType="com.alibaba.fastjson.JSONObject">
-        select advertiser_id as advertiserId, advertiser_name as advertiserName,
-               advertiser_id as targetId, advertiser_name as targetName
-        from deepthink.advertiser_bind_info
-        where advertiser_id in
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
-    </select>
-    <select id="projectTargetNameInfo" resultType="com.alibaba.fastjson.JSONObject">
-        select tb1.advertiser_id as advertiserId, tb2.advertiser_name as advertiserName,
-        a_id as targetId, a_name as targetName
-        from application.media_ad_report_daily tb1
-        left join tidb.deepthink.advertiser_bind_info tb2 on tb1.advertiser_id = tb2.advertiser_id
-        where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-        and a_id in
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
-        group by 1,2,3,4
-    </select>
-    <select id="promotionTargetNameInfo" resultType="com.alibaba.fastjson.JSONObject">
-        select tb1.advertiser_id as advertiserId, tb2.advertiser_name as advertiserName,
-        ad_id as targetId, ad_name as targetName
-        from application.media_ad_report_daily tb1
-        left join tidb.deepthink.advertiser_bind_info tb2 on tb1.advertiser_id = tb2.advertiser_id
-        where stat_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 9 DAY)
-        and ad_id in
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
-        group by 1,2,3,4
-    </select>
-</mapper>

+ 0 - 10
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/BytedanceAppletTokenRefreshService.java

@@ -1,10 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service;
-
-import com.alibaba.fastjson.JSONObject;
-
-import java.util.List;
-
-public interface BytedanceAppletTokenRefreshService {
-
-    void buildAppletTokens();
-}

+ 0 - 21
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IBytedanceProductUpdateService.java

@@ -1,21 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service;
-
-import java.io.IOException;
-
-public interface IBytedanceProductUpdateService {
-
-    String runPlatform(String platformId) throws IOException;
-
-    void runMp() throws Exception;
-
-    void authMovieResource();
-
-    void initNew();
-
-    void test() throws Exception;
-
-
-    void uploadAlbum() throws IOException;
-
-    void refreshAlbumStatus() throws IOException;
-}

+ 0 - 17
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IBytedancePromoteRefreshService.java

@@ -1,17 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service;
-
-import com.alibaba.fastjson.JSONObject;
-
-import java.io.IOException;
-import java.util.List;
-
-public interface IBytedancePromoteRefreshService {
-
-    void run() throws IOException;
-
-    List<JSONObject> getRefreshList();
-
-    JSONObject refreshLink(JSONObject linkInfo);
-
-    void runAdvertiserTaskStatus(String startTime, String endTime);
-}

+ 0 - 8
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IBytedanceRefreshTokenService.java

@@ -1,14 +1,6 @@
 package cn.com.ctop.job.bytedance.data.service;
 
-import redis.clients.jedis.Jedis;
-
 public interface IBytedanceRefreshTokenService {
 
     void bytedanceRefreshToken(Boolean refreshAlll);
-
-    void refreshBaiduYunToken();
-
-    void refreshAppletTokens();
-
-    Jedis getJedisToken();
 }

+ 0 - 9
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/ICPSReportService.java

@@ -1,9 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service;
-
-public interface ICPSReportService {
-
-    void cleanCPSDailyReports(String nowDate);
-
-
-    void runCPSSettlementData(String nowDate);
-}

+ 0 - 13
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IDianzhongConfigService.java

@@ -1,13 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-
-public interface IDianzhongConfigService {
-
-    void pullChannelInfo();
-
-    void pullMovie() throws IOException;
-
-    void syncPromoteLinkInfo();
-}

+ 0 - 6
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IHealthCheckService.java

@@ -1,6 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service;
-
-public interface IHealthCheckService {
-
-    void check() throws Exception;
-}

+ 0 - 35
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IToolsSiteService.java

@@ -1,35 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service;
-
-import com.alibaba.fastjson.JSONObject;
-
-import java.util.List;
-
-public interface IToolsSiteService {
-
-    List<Long> getAvatarAdvertiserIds();
-
-    void updateAvatarStatus(Long id);
-
-    List<Long> getNameAdvertiserIds();
-
-    void updateNameStatus(Long id);
-
-    List<JSONObject> getTimeOutAppList();
-
-    void pushAgain(JSONObject app);
-
-    List<Long> getAppAdvertiserIds(String platType);
-
-    void updateWxAppStatus(Long advertiserId, String searchType, Integer page);
-
-    void updateTTAppStatus(Long id, String createOnly, Integer page);
-
-    List<Long> getSiteAdvertiserIds();
-
-    List<JSONObject> getSiteAdvertiserIds2();
-
-    void updateSiteStatus(Long id, Integer page);
-
-    void publishSiteStatus(Long id, String taskId);
-
-}

+ 0 - 10
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IZtPolicyRunService.java

@@ -1,10 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service;
-
-public interface IZtPolicyRunService {
-
-
-    void test();
-    void run(Long policyId);
-
-
-}

+ 5 - 8
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceAccountReportServiceImpl.java

@@ -29,11 +29,12 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     @Autowired
     private RateLimitUtil rateLimitUtil;
 
+
+    private static String devAppId = "1876837323659296";
+
     @Override
     public void getBytedanceRetryAccountHourReport(Long errorId, Long advertiserId, String accessToken, String startDate, String endDate, Integer page, Integer isSend) {
         try {
-            JSONObject authConfig = tokenMapper.getAuthConfig(advertiserId);
-            String devAppId = authConfig.getString("app_id");
             String url = "https://api.oceanengine.com/open_api/v3.0/report/custom/get/";
             Map<String, Object> paramsMap = new HashMap<>();
             paramsMap.put("advertiser_id", advertiserId);
@@ -111,8 +112,6 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     @Override
     public void getBytedanceRetryAccountDailyReport(Long errorId, Long advertiserId, String accessToken, String startDate, String endDate, Integer page, Integer isSend) {
         try {
-            JSONObject authConfig = tokenMapper.getAuthConfig(advertiserId);
-            String devAppId = authConfig.getString("app_id");
             String url = "https://api.oceanengine.com/open_api/v3.0/report/custom/get/";
             Map<String, Object> paramsMap = new HashMap<>();
             paramsMap.put("advertiser_id", advertiserId);
@@ -188,8 +187,6 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     @Override
     public void getBytedanceAccountHour(Long advertiserId, String accessToken, String startDate, String endDate, Integer page, Integer isLog) {
         try {
-            JSONObject authConfig = tokenMapper.getAuthConfig(advertiserId);
-            String devAppId = authConfig.getString("app_id");
             String url = "https://api.oceanengine.com/open_api/v3.0/report/custom/get/";
             Map<String, Object> paramsMap = new HashMap<>();
             paramsMap.put("advertiser_id", advertiserId);
@@ -283,8 +280,8 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     @Override
     public void getBytedanceAccountDaily(Long advertiserId, String accessToken, String startDate, String endDate, Integer page, Integer isLog) {
         try {
-            JSONObject authConfig = tokenMapper.getAuthConfig(advertiserId);
-            String devAppId = authConfig.getString("app_id");
+
+
             String url = "https://api.oceanengine.com/open_api/v3.0/report/custom/get/";
             Map<String, Object> paramsMap = new HashMap<>();
             paramsMap.put("advertiser_id", advertiserId);

+ 0 - 72
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceAppletTokenRefreshServiceImpl.java

@@ -1,72 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service.impl;
-
-import cn.com.ctop.job.bytedance.data.mapper.BytedanceAppletTokenRefreshMapper;
-import cn.com.ctop.job.bytedance.data.service.BytedanceAppletTokenRefreshService;
-import cn.com.ctop.job.bytedance.data.service.IBytedanceRefreshTokenService;
-import cn.com.ctop.job.bytedance.data.utils.Check;
-import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
-import com.alibaba.fastjson.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import redis.clients.jedis.Jedis;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Service
-@Slf4j
-public class BytedanceAppletTokenRefreshServiceImpl implements BytedanceAppletTokenRefreshService {
-
-    @Autowired
-    private BytedanceAppletTokenRefreshMapper tokenRefreshMapper;
-
-    @Autowired
-    private IBytedanceRefreshTokenService refreshTokenService;
-
-    @Override
-    public void buildAppletTokens() {
-        Jedis jedis = refreshTokenService.getJedisToken();
-        List<JSONObject> list = tokenRefreshMapper.queryAppletList();
-        for (JSONObject applet : list) {
-            buildAppletToken(applet, jedis, 0);
-        }
-        tokenRefreshMapper.refreshAppletTokens(list);
-        jedis.close();
-    }
-
-    //构建小程序token
-    private void buildAppletToken(JSONObject applet, Jedis jedis, int count) {
-        String name = applet.getString("name");
-        try {
-            Map<String, Object> param = new HashMap<>();
-            String appId = applet.getString("appId");
-            param.put("client_key", appId);
-            param.put("client_secret", applet.getString("appSecret"));
-            param.put("grant_type", "client_credential");
-            String result = HttpUtils.httpPostRequest("https://open.douyin.com/oauth/client_token/", param, null);
-            JSONObject tokenInfo = JSONObject.parseObject(result);
-            if (!Check.isNull(tokenInfo)) {
-                JSONObject data = tokenInfo.getJSONObject("data");
-                if (!Check.isNull(data) && data.getInteger("error_code") == 0) {
-                    String accessToken = data.getString("access_token");
-                    jedis.setex("client-token-key_" + appId, 3600, accessToken);
-                    log.info("小程序:{},获取token完成", name);
-                    applet.put("token", accessToken);
-                } else {
-                    if (count < 3) {
-                        Thread.sleep(5000L);
-                        buildAppletToken(applet, jedis, count + 1);
-                    } else {
-                        log.error("小程序:{},获取token失败!结果:{}", name, tokenInfo);
-                    }
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("小程序:{},获取token异常!", name);
-        }
-    }
-
-}

+ 6 - 6
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceCdpProjectServiceImpl.java

@@ -22,10 +22,10 @@ import java.util.*;
 /**
  * 头条项目列Service业务层处理
  * <p>
- * media_api.bytedance_cdp_project_list
- * media_api.bytedance_byte_app_info
- * media_api.bytedance_wx_app_info
- * media_api.adq_dynamic_createive_list
+ * nuojing_data.bytedance_cdp_project_list
+ * nuojing_data.bytedance_byte_app_info
+ * nuojing_data.bytedance_wx_app_info
+ * nuojing_data.adq_dynamic_createive_list
  *
  * @author ruoyi
  * @date 2025-04-23
@@ -378,7 +378,7 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
                             continue;
                         }
                         jsonObject.put("advertiser_id", advertiserId);
-                        dynamicInsertMapper.insertDynamic("media_api.bytedance_uni_project_list", jsonObject);
+                        dynamicInsertMapper.insertDynamic("nuojing_data.bytedance_uni_project_list", jsonObject);
                     }
                     log.info("---账户({})全域投放项目列表第{}页更新成功", advertiserId, page);
                 } else {
@@ -1085,7 +1085,7 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
 
                 }
             }
-            dynamicInsertMapper.insertDynamic("media_api.bytedance_oc_project_material_other", data);
+            dynamicInsertMapper.insertDynamic("nuojing_data.bytedance_oc_project_material_other", data);
         }
     }
 

+ 0 - 676
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceProductUpdateServiceImpl.java

@@ -1,676 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service.impl;
-
-import cn.com.ctop.job.bytedance.data.entity.AigcProductAlbum;
-import cn.com.ctop.job.bytedance.data.entity.AigcProductPlatform;
-import cn.com.ctop.job.bytedance.data.mapper.BytedanceProductUpdateMapper;
-import cn.com.ctop.job.bytedance.data.mapper.BytedanceRefreshTokenMapper;
-import cn.com.ctop.job.bytedance.data.service.IBytedanceProductUpdateService;
-import cn.com.ctop.job.bytedance.data.utils.Check;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
-import cn.com.ctop.job.bytedance.utils.RateLimitUtil;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.io.IOException;
-import java.util.*;
-import java.util.stream.Collectors;
-
-@Slf4j
-@Service
-public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdateService {
-    @Resource
-    BytedanceProductUpdateMapper bytedanceProductUpdateMapper;
-    @Resource
-    private RedisTemplate redisTemplate_db5;
-    @Autowired
-    private RateLimitUtil rateLimitUtil;
-    @Autowired
-    private BytedanceRefreshTokenMapper tokenMapper;
-
-
-    public static final String DOUYIN_MOVIE_SOURCE_APP="ttd652a0ef496310bd01";
-
-    //枚举值:is_pay: IAA, IAP
-    enum BusinessType {
-        IAA,
-        IAP
-    }
-
-
-
-    // 内部错误记录类:包含报错信息、剧目ID、商品库ID
-    private static class ErrorRecord {
-        String message;
-        String albumId; // 剧目ID
-        String platformId; // 商品库ID
-
-        public ErrorRecord(String message, String albumId, String platformId) {
-            this.message = message;
-            this.albumId = albumId;
-            this.platformId = platformId;
-        }
-
-        public String getMessage() { return message; }
-        public String getAlbumId() { return albumId; }
-        public String getPlatformId() { return platformId; }
-
-        @Override
-        public String toString() {
-            return "ErrorRecord{" +
-                    "message='" + message + '\'' +
-                    ", albumId='" + albumId + '\'' +
-                    ", platformId='" + platformId + '\'' +
-                    '}';
-        }
-    }
-
-    public String runPlatform(String platformId) throws IOException {
-        List<AigcProductPlatform> platform = bytedanceProductUpdateMapper.getPlatformList(null, platformId);
-        if (platform.isEmpty()){
-            return "未找到对应的商品库信息,商品库ID:"+platformId;
-        }
-        System.out.println(JSON.toJSONString(platform.get(0)));
-        AigcProductPlatform p = platform.get(0);
-        if (p.getPlatformType() == 1 || p.getPlatformType() == 2){
-            runMiniProgram(platformId);
-        }
-        return null;
-    }
-
-    @Override
-    public void runMp() throws Exception {
-        runMiniProgram(null);
-    }
-
-    private void runMiniProgram(String platformId) throws IOException {
-        Set<ErrorRecord> errors = new HashSet<>();
-        log.info("付费商品库更新中...");
-        List<AigcProductPlatform> iapPlatformList = bytedanceProductUpdateMapper.getPlatformList("IAP", platformId); //商品库列表
-        if (!iapPlatformList.isEmpty()){
-            List<AigcProductAlbum> iapVideoList = bytedanceProductUpdateMapper.getIAPVideoList(); //剧目列表
-            List<JSONObject> iapProductTypeEnums = bytedanceProductUpdateMapper.getProductTypeEnums("IAP"); //商品类型
-            Map<String, JSONObject> iapProductTypeMap = iapProductTypeEnums.stream().collect(Collectors.toMap(
-                    obj -> obj.getString("third_type_name"),
-                    obj -> obj,
-                    (existing, replacement) -> replacement
-            ));
-            runMpProductTask(iapPlatformList, iapVideoList, iapProductTypeMap, errors, BusinessType.IAP);
-        }
-        log.info("付费商品库更新完成");
-
-        log.info("免费商品库更新中...");
-        List<AigcProductPlatform> iaaPlatformList = bytedanceProductUpdateMapper.getPlatformList("IAA", platformId); //商品库列表
-        if (!iaaPlatformList.isEmpty()){
-            List<AigcProductAlbum> iaaVideoList = bytedanceProductUpdateMapper.getIAAVideoList(); //剧目列表
-            List<JSONObject> iaaProductTypeEnums = bytedanceProductUpdateMapper.getProductTypeEnums("IAA"); //商品类型
-            Map<String, JSONObject> iaaProductTypeMap = iaaProductTypeEnums.stream().collect(Collectors.toMap(
-                    obj -> obj.getString("third_type_name"),
-                    obj -> obj,
-                    (existing, replacement) -> replacement
-            ));
-            runMpProductTask(iaaPlatformList, iaaVideoList, iaaProductTypeMap, errors, BusinessType.IAA);
-        }
-        log.info("免费商品库更新完成");
-
-        // 过滤掉包含“剧目不可用”的错误
-        errors.removeIf(er -> er.getMessage() != null && er.getMessage().contains("剧目不可用"));
-        if (!Check.isNull(errors)){
-            List<String> info = new ArrayList<>();
-            info.add("商品上传报错通知");
-
-            // 合并相同剧目ID和报错信息的数据
-            Map<String, Set<String>> grouped = new LinkedHashMap<>(); // key -> set of platformIds
-            Map<String, String> keyToAlbum = new HashMap<>(); // key -> albumId
-            for (ErrorRecord er : errors){
-                String albumKey = er.getAlbumId() == null ? "" : er.getAlbumId();
-                String key = albumKey + "||" + er.getMessage();
-                grouped.computeIfAbsent(key, k -> new LinkedHashSet<>());
-                if (er.getPlatformId() != null){
-                    grouped.get(key).add(er.getPlatformId());
-                }
-                keyToAlbum.putIfAbsent(key, albumKey);
-            }
-
-            for (Map.Entry<String, Set<String>> e : grouped.entrySet()){
-                String key = e.getKey();
-                String[] parts = key.split("\\|\\|");
-                String message = parts.length>1 ? parts[1] : parts[0];
-                String albumId = keyToAlbum.get(key);
-                Set<String> platformIds = e.getValue();
-                StringBuilder sb = new StringBuilder();
-                sb.append(message);
-                if (StringUtils.isNotEmpty(albumId)){
-                    sb.append(",剧目ID: ").append(albumId);
-                }
-                if (platformIds != null && !platformIds.isEmpty()){
-                    if (platformIds.size() < 5){
-                        sb.append(",商品库ID: ").append(StringUtils.join(platformIds, ","));
-                    }
-                }
-                info.add(sb.toString());
-            }
-
-            log.error(StringUtils.join(info, "\n"));
-        }
-    }
-
-    private void runMpProductTask(List<AigcProductPlatform> platformList, List<AigcProductAlbum> albums, Map<String, JSONObject> productTypeMap, Set<ErrorRecord> errors, BusinessType businessType) throws IOException {
-        for (AigcProductPlatform platform : platformList){
-            // 获取开发者应用ID
-            JSONObject authConfig = tokenMapper.getAuthConfig(Long.valueOf(platform.getAdvertiserId()));
-            String devAppId = authConfig.getString("app_id");
-            platform.setDevAppId(devAppId);
-            // 拉取已上传剧目,对比,得到未上传剧目列表
-            List<AigcProductAlbum> hasUploadProductList = hasUploadProductList(platform);
-            List<String> hasUpload = hasUploadProductList.stream().map(AigcProductAlbum::getProductId).collect(Collectors.toList());
-            System.out.println("已上传剧目数: "+hasUpload.size() + ", 商品库ID: "+platform.getPlatformId()+", 来源:"+platform.getSource());
-            List<AigcProductAlbum> toUpload = albums.stream()
-                    .filter(o -> Objects.equals(o.getSource(), platform.getSource()))
-                    .filter(o -> Objects.equals(o.getPlatformType(), String.valueOf(platform.getPlatformType())))
-                    .filter(o -> !hasUpload.contains(o.getAlbumId())).collect(Collectors.toList());
-            System.out.println("待上传剧目数: "+toUpload.size() + ", 商品库ID: "+platform.getPlatformId()+", 来源:"+platform.getSource());
-            if (toUpload.isEmpty()){
-                continue;
-            }
-            //未上传剧目:对比平台类型;确定商品分类
-            for (AigcProductAlbum album : toUpload){
-                if (!Objects.equals(album.getPlatformType(), String.valueOf(platform.getPlatformType()))){
-                    continue;
-                }
-                if (!productTypeMap.containsKey(album.getTheme())){
-                    System.out.println(">>>>没有找到对应的产品类型:" + album.getTheme());
-                    System.out.println("\n\n\n");
-                    continue;
-                }
-                uploadProduct(platform, album, errors, productTypeMap.get(album.getTheme()), businessType);
-            }
-        }
-    }
-
-    /**
-     * 当前商品库中,已经上传的商品列表
-     * @param platform
-     * @return
-     */
-    private List<AigcProductAlbum> hasUploadProductList(AigcProductPlatform platform){
-        return hasUploadProductPageList(platform, 1, 100, null);
-    }
-
-    private List<AigcProductAlbum> hasUploadProductPageList(AigcProductPlatform platform, int page, int pageSize, Integer auditStatus){
-        String url = "https://api.oceanengine.com/open_api/2/dpa/detail/get/";
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Access-Token", platform.getAccessToken());
-        Map<String, Object> params = new HashMap<>();
-        params.put("advertiser_id", Long.valueOf(platform.getAdvertiserId()));
-        params.put("product_platform_id", Long.valueOf(platform.getPlatformId()));
-        params.put("page", String.valueOf(page));
-        params.put("page_size", String.valueOf(pageSize));
-        JSONObject filtering = new JSONObject();
-        if (auditStatus != null){
-            filtering.put("audit_status", auditStatus);
-        }
-        if (!filtering.isEmpty()){
-            params.put("filtering", filtering);
-        }
-
-        String res = null;
-        if (rateLimitUtil.acquire(platform.getDevAppId(), url, 5)){
-            res = HttpUtils.httpGet(url, params, headers);
-        }
-
-        if (res == null || res.isEmpty()) {
-            System.out.println("获取已上传商品列表失败, 广告账号ID:" + platform.getAdvertiserId() + ", 商品库ID:" + platform.getPlatformId());
-            return new ArrayList<>();
-        }else {
-            JSONObject jsonObject = JSONObject.parseObject(res);
-            int code = jsonObject.getIntValue("code");
-            if (code != 0) {
-                System.out.println("获取已上传商品列表失败,code: " + code + ", msg: " + jsonObject.getString("message") + ", 广告账号ID:" + platform.getAdvertiserId() + ", 商品库ID:" + platform.getPlatformId());
-                return new ArrayList<>();
-            }else {
-                JSONArray list = jsonObject.getJSONObject("data").getJSONArray("list");
-                if (list == null || list.isEmpty()){
-                    return new ArrayList<>();
-                }
-                List<AigcProductAlbum> resList = new ArrayList<>(list.size());
-                for (int i = 0; i < list.size(); i++) {
-                    JSONObject obj = list.getJSONObject(i);
-                    AigcProductAlbum album = new AigcProductAlbum();
-                    album.setProductId(String.valueOf(obj.getLongValue("product_id")));
-                    album.setName(obj.getString("name"));
-                    JSONObject profession = obj.getJSONObject("profession");
-                    if (profession!=null && profession.containsKey("album_link")){
-                        album.setAlbumLink(profession.getString("album_link"));
-                    }
-                    resList.add(album);
-                }
-                JSONObject page_info = jsonObject.getJSONObject("data").getJSONObject("page_info");
-                int total_page = page_info.getIntValue("total_page");
-                if (total_page > page){
-                    //递归获取下一页
-                    List<AigcProductAlbum> nextPage = hasUploadProductPageList(platform, page + 1, pageSize, auditStatus);
-                    resList.addAll(nextPage);
-                }
-                return resList;
-            }
-        }
-    }
-
-    @Override
-    public void authMovieResource() {
-        //原片授权
-        List<JSONObject> authList = bytedanceProductUpdateMapper.getDouyinMovieAuthList();
-        if (!Check.isNull(authList)){
-            try {
-                String tokenKey = "client-token-key_"+ DOUYIN_MOVIE_SOURCE_APP;
-                String token = (String) redisTemplate_db5.opsForValue().get(tokenKey);
-                if (Check.isNull(token)){
-                    log.warn("没有找到字节小程序access_token,无法进行  原片授权");
-                    return;
-                }
-                for (JSONObject obj : authList){
-                    String socialCreditCode = obj.getString("social_credit_code");
-                    if (Check.isNull(socialCreditCode)){
-                        log.warn("没有找到社会信用代码,跳过授权: " + obj.getString("name"));
-                        continue;
-                    }
-                    String url = "https://open.douyin.com/api/resource_library/util/v1/batch_auth_contents/";
-                    Map<String, String> headers = new HashMap<>();
-                    headers.put("Access-Token", token);
-                    Map<String, Object> body = new HashMap<>();
-                    body.put("auth_all_album", true);
-                    body.put("auth_type", 1);
-                    body.put("authed_corp", socialCreditCode);
-                    String res = HttpUtils.httpPostRequest(url, body, headers);
-                    System.out.println("授权结果: " + res);
-                    JSONObject resObj = JSONObject.parseObject(res);
-                    int code = resObj.getIntValue("err_no");
-                    if (code != 0){
-                        log.error("授权失败,code: " + code + ", msg: " + resObj.getString("message") + ", 社会信用代码: " + socialCreditCode);
-                    }else {
-                        JSONObject data = resObj.getJSONObject("data");
-                        if (data.getBooleanValue("authed")){
-                            log.info("授权成功,社会信用代码: " + socialCreditCode + ", 企业名称: " + data.getJSONArray("authed_corps").toJSONString());
-                            bytedanceProductUpdateMapper.updateMovieAuthStatus(obj.getString("platform_id"));
-                        }
-                    }
-                    Thread.sleep(4000);
-                }
-            }catch (Exception e){
-                e.printStackTrace();
-                log.error("获取字节小程序access_token失败", e);
-            }
-        }
-    }
-
-    /**
-     * 初始化新的字节小程序; 新增字节用的商品库时调用
-     */
-    @Override
-    public void initNew(){
-        List<AigcProductPlatform> iapPlatformList = bytedanceProductUpdateMapper.getPlatformInitList("IAP");
-        List<AigcProductPlatform> iaaPlatformList = bytedanceProductUpdateMapper.getPlatformInitList("IAA");
-        initNew(iaaPlatformList);
-        initNew(iapPlatformList);
-        authMovieResource();
-    }
-
-    @Override
-    public void test() throws Exception {
-//        uploadAlbum(31084L, 1742489802322972L, "d22b45ce9033303d22c5f34abcd4600811b18d88");
-//        uploadAlbum();
-//        Thread.sleep(1000);
-        runMp();
-//        refreshAlbumStatus();
-//        List<String> errors = new ArrayList<>();
-//        iapProductUpdate(errors);
-//        System.out.println(errors);
-
-    }
-
-    public void initNew(List<AigcProductPlatform> platformList)  {
-        //为广告主账户创建新的字节小程序
-        //step1 查询表里广告主是否都有自己的字节小程序、
-        //step2 如果没有,创建新的字节小程序
-        for (AigcProductPlatform obj : platformList){
-            if (!Check.isNull(obj.getMiniInstanceId())){
-                //已经有字节小程序了
-                continue;
-            }
-            String createLinkUrl = "https://api.oceanengine.com/open_api/v3.0/tools/micro_app/create/";
-            JSONObject authConfig = tokenMapper.getAuthConfig(Long.valueOf(obj.getAdvertiserId()));
-            String devAppId = authConfig.getString("app_id");
-            String access_token = obj.getAccessToken();
-            Map<String, String> headers = new HashMap<>();
-            headers.put("Access-Token", access_token);
-            JSONObject requestBody = new JSONObject();
-            requestBody.put("advertiser_id", Long.parseLong(obj.getMiniAppAdvertiserId()));
-            requestBody.put("app_id", obj.getMiAppid());
-            requestBody.put("remark", "商品库管理用");
-            requestBody.put("tag_info", "1050107001");
-            JSONObject app_page = new JSONObject();
-            app_page.put("link", "");
-            app_page.put("link_remark", "init");
-            app_page.put("start_page", "pages/index/index");
-            app_page.put("start_param", "link_id=574391");
-            requestBody.put("app_page", app_page);
-
-            String res = null;
-            // Rate limit for /open_api/v3.0/tools/micro_app/create/
-            if (rateLimitUtil.acquire(devAppId, createLinkUrl, 5)){
-                res = HttpUtils.httpPostRequest(createLinkUrl, requestBody, headers);
-            }
-
-            if (res == null || res.isEmpty()){
-                System.out.println("创建字节小程序失败,advertiser_id:"+obj.getMiniAppAdvertiserId());
-            }else {
-                JSONObject jsonObject = JSONObject.parseObject(res);
-                System.out.println("创建字节小程序响应: " + jsonObject.toJSONString());
-                int code = jsonObject.getIntValue("code");
-                if (code != 0) {
-                    System.out.println("创建字节小程序失败,advertiser_id: "+obj.getMiniAppAdvertiserId()+",code: " + code + ", msg: " + jsonObject.getString("message"));
-                }else {
-                    String instanceId = jsonObject.getJSONObject("data").getString("instance_id");
-                    //更新表
-                    bytedanceProductUpdateMapper.updateInstanceId(obj.getAdvertiserId(), instanceId, obj.getSource());
-                    System.out.println("创建字节小程序成功,广告主ID: " + obj.getMiniAppAdvertiserId() + ", 实例ID: " + instanceId);
-                }
-            }
-        }
-    }
-
-    private void uploadProduct(AigcProductPlatform platform, AigcProductAlbum album,
-                                  Set<ErrorRecord> errorBlanket, JSONObject productType,
-                              BusinessType businessType){
-        String url;
-        if (StringUtils.isEmpty(album.getAlbumId())){
-            url = "https://ad.oceanengine.com/open_api/2/dpa/product/create/";
-        }else {
-            url = "https://ad.oceanengine.com/open_api/2/dpa/product/update/";
-        }
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Access-Token", platform.getAccessToken());
-        headers.put("Content-Type", "application/json");
-
-        JSONObject request = new JSONObject();
-        String album_id = album.getAlbumId();
-        if (StringUtils.isNotEmpty(album_id)){
-            request.put("product_id", Long.valueOf(album_id));
-        }
-        JSONObject product_info = new JSONObject();
-        product_info.put("name", album.getName());
-        product_info.put("image_url", album.getImg());
-        product_info.put("status", 1);
-        product_info.put("stock", 1);
-        product_info.put("first_category_id", productType.getString("first_type_id"));
-        product_info.put("sub_category_id", productType.getString("second_type_id"));
-        product_info.put("third_category_id", productType.getString("third_type_id"));
-        product_info.put("first_category", productType.getString("first_type_name"));
-        product_info.put("sub_category", productType.getString("second_type_name"));
-        product_info.put("third_category", productType.getString("third_type_name"));
-        request.put("advertiser_id", Long.valueOf(platform.getAdvertiserId()));
-        request.put("platform_id", Long.valueOf(platform.getPlatformId()));
-        JSONObject profession = new JSONObject();
-        profession.put("copyright_owner", platform.getCopyrightOwner());
-        if (businessType==BusinessType.IAP){
-            if (platform.getMaxCharge() > 0.0){
-                profession.put("max_charge", String.valueOf(platform.getMaxCharge()));
-            }
-            if (platform.getMinCharge() > 0.0){
-                profession.put("min_charge", String.valueOf(platform.getMinCharge()));
-            }
-            if (platform.getRecommendedCharge() > 0.0){
-                profession.put("recommended_charge", String.valueOf(platform.getRecommendedCharge()));
-            }
-            profession.put("has_paid_content", "1");
-            profession.put("has_motivation_content", "2");
-            profession.put("membership_types", String.valueOf(platform.getMembershipTypes()));
-
-            //price_info
-            JSONObject price_info = new JSONObject();
-            price_info.put("price", platform.getSinglePrice());
-            product_info.put("price_info", price_info);
-        }else { //IAA
-            profession.put("has_paid_content", "2");
-            profession.put("has_motivation_content", "2");
-            profession.put("membership_types", "5");
-            profession.put("starting_unlock_episode", String.valueOf(album.getStartingUnlockEpisode()));
-        }
-        List<String> ad_carrier = new ArrayList<>();
-        if (platform.getIsBytedance() == 1){
-            ad_carrier.add("字节小程序");
-        }
-        if (platform.getIsWechat() == 1){
-            ad_carrier.add("微信小程序");
-        }
-        if (platform.getIsBytedance() == 1 || platform.getIsWechat() == 1){
-            profession.put("album_id", album_id);
-        }
-        profession.put("ad_carrier", JSON.toJSONString(ad_carrier));
-        product_info.put("profession", profession);
-        request.put("product_info", product_info);
-
-        // 单次请求(已移除重试逻辑)
-        String res = null;
-        if (rateLimitUtil.acquire(platform.getDevAppId(), url, 5)){
-            res = HttpUtils.httpPostRequest(url, request, headers);
-        }
-
-        if (res == null || res.isEmpty()){
-            String payName = businessType==BusinessType.IAP?"付费":"免费";
-            errorBlanket.add(new ErrorRecord("上传"+payName+"商品失败,msg: 请求失败或无响应, 关联剧目: " + album.getName(), album.getAlbumId(), platform.getPlatformId()));
-        } else {
-            JSONObject btRes = JSONObject.parseObject(res);
-            int code = btRes.getIntValue("code");
-            if (code != 0){
-                String errorMessage = btRes.getString("message");
-                String payName = businessType==BusinessType.IAP?"付费":"免费";
-                errorBlanket.add(new ErrorRecord("上传"+payName+"商品失败,code: [" + code + "], msg: [" + errorMessage +"], 关联剧目: " + album.getName(), album.getAlbumId(), platform.getPlatformId()));
-            }
-        }
-
-    }
-
-    public void uploadAlbum() throws IOException {
-        List<String> info = new ArrayList<>();
-        info.add("仅微小剧目上传通知");
-        List<JSONObject> wxVideoInfos = bytedanceProductUpdateMapper.getUploadList();
-        JSONObject developerAccount = bytedanceProductUpdateMapper.getDeveloperAccount();
-        Long appId = developerAccount.getLong("app_id");
-        String appAccessToken = getAppAccessToken(appId, developerAccount.getString("app_secret"));
-        if (appAccessToken == null){
-            System.out.println("获取app_access_token失败");
-            info.add("获取app_access_token失败");
-            log.error(StringUtils.join(info, "\n"));
-            return;
-        }
-        for (JSONObject vi : wxVideoInfos){
-            Long videoId = vi.getLong("id");
-            String albumId = uploadWxAlbum(videoId, appId, appAccessToken);
-            if (albumId == null){
-                info.add("上传短剧失败,videoId: " + videoId + ", 剧目名称: " + vi.getString("name"));
-            }else {
-                bytedanceProductUpdateMapper.insertAlbumInfo(albumId, videoId);
-                info.add("上传短剧成功,videoId: " + videoId + ", 剧目名称: " + vi.getString("name") + ", albumId: " + albumId);
-            }
-        }
-        if (info.size()>1){
-            log.error(StringUtils.join(info, "\n"));
-        }
-    }
-
-    public void refreshAlbumStatus() throws IOException {
-        List<String> info = new ArrayList<>();
-        info.add("仅微小短剧审核状态更新通知");
-        JSONObject developerAccount = bytedanceProductUpdateMapper.getDeveloperAccount();
-        Long app_id = developerAccount.getLong("app_id");
-        String app_secret = developerAccount.getString("app_secret");
-        String appAccessToken = getAppAccessToken(app_id, app_secret);
-        if (appAccessToken == null){
-            System.out.println("获取app_access_token失败");
-            return;
-        }
-
-        List<JSONObject> listAlbum = bytedanceProductUpdateMapper.selectWaitingAlbums();
-        for (JSONObject album : listAlbum){
-            String al = album.getString("album_id");
-            String albumName = album.getString("name");
-            String createTime = album.getString("create_time");
-            //增加判断:如果已经提审超过7天,直接标记为失败
-            Date createDate = DateUtils.getDateByPattern(createTime, "yyyy-MM-dd HH:mm:ss");
-            if (createDate != null){
-                long diff = System.currentTimeMillis() - createDate.getTime();
-                if (diff > 7L * 24 * 60 * 60 *1000){
-                    bytedanceProductUpdateMapper.updateAlbumInfo(al, 2, "审核超时");
-                    info.add("短剧审核超时,albumId: " + al + ", 剧目名称: " + albumName + ", 原因: 审核超时");
-                    continue;
-                }
-            }
-            String url = "https://api.oceanengine.com/open_api/v3.0/dpa/album_status/get/";
-            Map<String, String> headers = new HashMap<>();
-            headers.put("App-Access-Token", appAccessToken);
-            Map<String, Object> params = new HashMap<>();
-            params.put("album_id", al);
-            params.put("app_id", app_id);
-
-            String res = null;
-            // Rate limit for /open_api/v3.0/dpa/album_status/get/
-            if (rateLimitUtil.acquire(String.valueOf(app_id), url, 5)){
-                res = HttpUtils.httpGet(url, params, headers);
-            }
-
-            if (res == null || res.isEmpty()){
-                System.out.println("获取短剧状态失败,albumId: " + al);
-            }else {
-                JSONObject resObj = JSONObject.parseObject(res);
-                int code = resObj.getIntValue("code");
-                if (code != 0){
-                    info.add("获取短剧状态失败,code: " + code + ", msg: " + resObj.getString("message")+", 剧目名称: " + albumName);
-                    continue;
-                }else {
-                    JSONObject data = resObj.getJSONObject("data");
-                    boolean isSuccess = data.getBooleanValue("can_promotion");
-                    if (isSuccess) {
-                        //更新状态
-                        bytedanceProductUpdateMapper.updateAlbumInfo(al, 1, null);
-                        info.add("短剧审核通过,albumId: " + al + ", 剧目名称: " + albumName);
-                    }else {
-                        String failReason = data.getString("can_not_promotion_reason");
-                        if ("RESOURCE_CREATING".equals(failReason) || "RESOURCE_AUDITING".equals(failReason)){
-                            //等待中
-                            bytedanceProductUpdateMapper.updateAlbumInfo(al, 0, failReason);
-                            info.add("短剧审核中,albumId: " + al + ", 剧目名称: " + albumName+", 当前状态: " + failReason);
-                        }else {
-                            //失败
-                            bytedanceProductUpdateMapper.updateAlbumInfo(al, 2, failReason);
-                            info.add("短剧审核失败,albumId: " + al + ", 剧目名称: " + albumName + ", 原因: " + failReason);
-                        }
-                    }
-
-                }
-            }
-        }
-        if (info.size()>1){
-            log.error(StringUtils.join(info, "\n"));
-        }
-    }
-
-
-    /**
-     * 上传短剧
-     * @param videoId from ly_videos
-     * @return albumId
-     */
-    private String uploadWxAlbum(long videoId, Long appId, String appAccessToken){
-        JSONObject video = bytedanceProductUpdateMapper.getVideoInfo(videoId);
-        if (video == null){
-            System.out.println("没有找到视频信息,videoId: " + videoId);
-            return null;
-        }
-        String videoName = video.getString("name");
-        Integer sylloge = video.getInteger("sylloge");//总集数
-        List<JSONObject> videoDetail = bytedanceProductUpdateMapper.getVideoDetail(videoId);
-        if (videoDetail == null || videoDetail.isEmpty()){
-            System.out.println("没有找到视频剧集详情,videoId: " + videoId);
-            return null;
-        }
-
-        JSONObject requestBody = new JSONObject();
-        requestBody.put("album_title", videoName);
-        requestBody.put("seq_num", sylloge);
-        requestBody.put("app_id", appId);
-
-        List<JSONObject> videoDetailList = new ArrayList<>();
-        for (JSONObject obj : videoDetail){
-            String videoUrl = obj.getString("url").replaceAll("oss\\.artlinkworld\\.cn", "bydance.artlinkworld.cn");//使用单独的域名
-
-            String title = obj.getString("name");
-            Integer seq = obj.getInteger("sort");
-
-            JSONObject meta = new JSONObject();
-            meta.put("url", videoUrl);
-            meta.put("title", title);
-            meta.put("seq", seq);
-            videoDetailList.add(meta);
-        }
-        requestBody.put("video_meta_mico", videoDetailList);
-
-        String url = "https://api.oceanengine.com/open_api/v3.0/dpa/album/create/";
-        Map<String, String> headers = new HashMap<>();
-        headers.put("App-Access-Token", appAccessToken);
-        headers.put("Content-Type", "application/json");
-
-        System.out.println(requestBody.toJSONString());
-        String res = HttpUtils.httpPostRequest(url, requestBody, headers);
-        System.out.println(">>> "+res);
-        if (res == null || res.isEmpty()){
-            System.out.println("上传短剧失败, 返回null");
-            return null;
-        }else {
-            JSONObject resObj = JSONObject.parseObject(res);
-            int code = resObj.getIntValue("code");
-            if (code != 0){
-                System.out.println("上传短剧失败,code: " + code + ", msg: " + resObj.getString("message"));
-                return null;
-            }else {
-                String albumId = resObj.getJSONObject("data").getString("album_id");
-                return albumId;
-            }
-        }
-    }
-
-    private String getAppAccessToken(Long app_id, String app_secret){
-        String url = "https://open.oceanengine.com/open_api/oauth2/app_access_token/";
-        if (app_id == null || app_secret == null){
-            return null;
-        }
-        JSONObject body = new JSONObject();
-        body.put("app_id", app_id);
-        body.put("secret", app_secret);
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        String res = HttpUtils.httpPostRequest(url, body, headers);
-        if (res == null || res.isEmpty()){
-            return null;
-        }else {
-            JSONObject resObj = JSONObject.parseObject(res);
-            int code = resObj.getIntValue("code");
-            if (code != 0){
-                System.out.println("获取app_access_token失败,code: " + code + ", msg: " + resObj.getString("message"));
-                return null;
-            }else {
-                return resObj.getJSONObject("data").getString("access_token");
-            }
-        }
-    }
-
-
-}

+ 0 - 209
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedancePromoteRefreshServiceImpl.java

@@ -1,209 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service.impl;
-
-import cn.com.ctop.job.bytedance.data.mapper.PromoteLinkRefreshMapper;
-import cn.com.ctop.job.bytedance.data.service.IBytedancePromoteRefreshService;
-import cn.com.ctop.job.bytedance.data.utils.Check;
-import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import io.netty.util.internal.StringUtil;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang.StringUtils;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Slf4j
-@Service
-public class BytedancePromoteRefreshServiceImpl implements IBytedancePromoteRefreshService {
-    @Resource
-    PromoteLinkRefreshMapper promoteLinkRefreshMapper;
-
-    @Resource
-    private RedisTemplate redisTemplate_db5;
-
-    @Override
-    public void run() throws IOException {
-        List<JSONObject> list = getRefreshList();
-        if (Check.isNull(list) || list.isEmpty()) {
-            return; // 没有需要刷新的链接
-        }
-        long startTime = System.currentTimeMillis();
-        List<String> errorMsg = new ArrayList<>();
-        for (JSONObject linkInfo : list) {
-            try {
-                JSONObject response = refreshLink(linkInfo);
-                if (response.getInteger("code") != 0) {
-                    errorMsg.add(response.getString("msg"));
-                    System.out.println("刷新链接失败: " + response.getString("msg"));
-                }
-            } catch (Exception e) {
-                System.err.println("刷新链接时发生异常: " + e.getMessage());
-                errorMsg.add("刷新链接时发生异常: " + e.getMessage());
-            }
-        }
-        long endTime = System.currentTimeMillis();
-        if (!errorMsg.isEmpty()){
-            errorMsg.add(0, "**批量开户推广链刷新任务报错**");
-            log.error(StringUtils.join(errorMsg, "\n"));
-        }
-        long duration = (endTime - startTime) / 1000 / 60; // 转换为分钟
-        if (duration > 10){
-            log.warn("批量刷新推广链接任务耗时预警: {}分钟", duration);
-        } else {
-            System.out.println("批量刷新推广链接任务完成,耗时: " + duration + "分钟");
-        }
-    }
-
-    @Override
-    public List<JSONObject> getRefreshList() {
-        Long now = System.currentTimeMillis() / 1000;
-        Long targetTime = now + 60 * 60 * 24; // 24 hours later
-        return promoteLinkRefreshMapper.refreshList(targetTime);
-    }
-
-
-    /**
-     * 刷新推广链接
-     * @param linkInfo
-     * @return code:错误码 msg:错误信息
-     */
-    @Override
-    public JSONObject refreshLink(JSONObject linkInfo) {
-        //select tb1.task_id, tb1.advertiser_id, tb1.promoter_id, tb1.link_uuid, tb4.expire_time, tb2.media_type, tb3.app_plat_type,
-        //        tb3.movie_id as video_id, tb5.id as video_detail_id, tb1.promoter_uri, tb2.app_id
-        String uuid = linkInfo.getString("link_uuid");
-        String appId = linkInfo.getString("app_id");
-        String appletId = linkInfo.getString("applet_id");
-        Long linkId = linkInfo.getLong("promoter_id");
-        Long videoId = linkInfo.getLong("video_id");
-        Long videoDetailId = linkInfo.getLong("video_detail_id");
-        String promoterUri = linkInfo.getString("promoter_uri");
-
-        Integer mediaType = linkInfo.getInteger("media_type");
-        Integer appPlatType = linkInfo.getInteger("app_plat_type");
-        if (mediaType == 1){
-            if (appPlatType == 1){
-                String tokenKey = "wechat-applet-access-token-key-"+appletId;
-                Object tokenobj = redisTemplate_db5.opsForValue().get(tokenKey);
-                if (Check.isNull(tokenobj)){
-                    return response(400, "微信小程序access_token不存在,请先获取: "+appId);
-                }
-                String token = String.valueOf(tokenobj);
-
-                //wx
-                String path = promoterUri.split("\\?")[0];
-                String query = promoterUri.split("\\?")[1];
-
-                String url = "https://api.weixin.qq.com/wxa/generate_urllink?access_token="+token;
-                Map<String, Object> params = new HashMap<>();
-                params.put("path", path);
-                if (StringUtil.isNullOrEmpty(query)) {
-                    params.put("query", query);
-                }
-                params.put("expire_type", 1);
-                params.put("expire_interval", 30);
-                Long expireTime = System.currentTimeMillis()/1000 + (86400L * 29); // 29天
-                String res = HttpUtils.httpPostRequest(url, params, null);
-                if (Check.isNull(res)) {
-                    return response(500, "获取微信跳转链接失败");
-                }
-                JSONObject jsonResponse = JSON.parseObject(res);
-                if (jsonResponse.getInteger("errcode") != 0) {
-                    return response(500, "获取微信跳转链接失败: " + jsonResponse.getString("errmsg"));
-                }
-                String link = jsonResponse.getString("url_link");
-                int updateCount = promoteLinkRefreshMapper.updateLink(uuid, link, expireTime);
-                return response(0, null);
-
-            }else if (appPlatType ==2){
-                String tokenKey = "client-token-key_"+ appId;
-                Object tokenobj = redisTemplate_db5.opsForValue().get(tokenKey);
-                if (Check.isNull(tokenobj)){
-                    return response(400, "抖音小程序access_token不存在,请先获取: "+appId);
-                }
-                String token = String.valueOf(tokenobj);
-
-                String serialNo = linkInfo.getString("sort");
-                String albumId = linkInfo.getString("album_id");
-                String episodeId = "";
-                try {
-                    String platform_config = linkInfo.getString("platform_config");
-                    if (!Check.isNull(platform_config)){
-                        JSONObject platformConfigJson = JSON.parseObject(platform_config);
-                        if (!platformConfigJson.containsKey("douyinyun")){
-                        }
-                        episodeId = platformConfigJson.getJSONObject("douyinyun").getString("episode_id");
-                    }
-                }catch (Exception e){
-                    log.error("解析平台配置失败: " + e.getMessage(), e);
-                }
-                //douyin
-                String path = promoterUri.split("\\?")[0];
-                String url = "https://open.douyin.com/api/apps/v1/url_link/generate/";
-                Map<String, String> query = new HashMap<>();
-                query.put("link_id", String.valueOf(linkId));
-                query.put("video_id", String.valueOf(videoId));
-                query.put("video_detail_id", String.valueOf(videoDetailId));
-                query.put("type", "1");
-                query.put("source", "link");
-                query.put("serialNo", serialNo);
-                query.put("app_id", appId);
-                query.put("tt_album_id", albumId);
-                query.put("tt_episode_id", episodeId);
-                Map<String, Object> params = new HashMap<>();
-                params.put("app_id", appId);
-                params.put("app_name", "douyin");
-                params.put("path", path);
-                params.put("query", JSON.toJSONString(query));
-
-                long now = System.currentTimeMillis() / 1000;
-                long expireTime = now + (86400) * 179; // 170天有效期
-                params.put("expire_time", String.valueOf(expireTime));
-
-                Map<String, String> headers = new HashMap<>();
-                headers.put("Access-Token", token);
-                headers.put("Content-Type", "application/json");
-
-                String res = HttpUtils.httpPostRequest(url, params, headers);
-                if (Check.isNull(res)) {
-                    return response(500, "获取抖音跳转链接失败: 响应内容为空");
-                }
-                JSONObject jsonResponse = JSON.parseObject(res);
-                if (jsonResponse.getInteger("err_no") != 0) {
-                    return response(500, "获取抖音跳转链接失败: " + jsonResponse.getString("message"));
-                }else {
-                    JSONObject data = jsonResponse.getJSONObject("data");
-                    if (data == null || !data.containsKey("url_link")) {
-                        return response(500, "获取抖音跳转链接失败: "+ res);
-                    }
-                    String link = data.getString("url_link");
-                    //更新数据库
-                    int updateCount = promoteLinkRefreshMapper.updateLink(uuid, link, expireTime);
-                    return response(0, null);
-                }
-            }
-        }else {
-            //adq等
-        }
-        return response(0, null);
-    }
-
-    @Override
-    public void runAdvertiserTaskStatus(String startTime, String endTime) {
-        promoteLinkRefreshMapper.updateRunStatus(startTime, endTime);
-    }
-
-    private JSONObject response(int code, String msg) {
-        JSONObject response = new JSONObject();
-        response.put("code", code);
-        response.put("msg", msg);
-        return response;
-    }
-}

+ 0 - 81
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceRefreshTokenServiceImpl.java

@@ -7,9 +7,7 @@ import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
-import redis.clients.jedis.Jedis;
 
 import java.util.HashMap;
 import java.util.List;
@@ -21,15 +19,6 @@ public class BytedanceRefreshTokenServiceImpl implements IBytedanceRefreshTokenS
     @Autowired
     private BytedanceRefreshTokenMapper bytedanceRefreshTokenMapper;
 
-    @Value("${spring.redis.host}")
-    private String redisHost;
-
-    @Value("${spring.redis.port}")
-    private int redisPort;
-
-    @Value("${spring.redis.password}")
-    private String redisPassword;
-
     @Override
     public void bytedanceRefreshToken(Boolean refreshAlll) {
         List<JSONObject> tokenList = refreshAlll ? bytedanceRefreshTokenMapper.getTokenList() : bytedanceRefreshTokenMapper.getTokenToRefreshList();
@@ -65,74 +54,4 @@ public class BytedanceRefreshTokenServiceImpl implements IBytedanceRefreshTokenS
             log.info("没有需要刷新的token");
         }
     }
-
-    @Override
-    public void refreshBaiduYunToken() {
-        List<JSONObject> tokenList = bytedanceRefreshTokenMapper.getBaiduYunTokenList();
-        if (!Check.isNull(tokenList)) {
-            for (int i = 0; i < tokenList.size(); i++) {
-                JSONObject tokenJson = tokenList.get(i);
-                Map<String, Object> params = new HashMap<>();
-                params.put("grant_type", "refresh_token");
-                params.put("refresh_token", tokenJson.getString("refresh_token"));
-                params.put("client_id", tokenJson.getString("appkey"));
-                params.put("client_secret", tokenJson.getString("secretkey"));
-                String url = "https://openapi.baidu.com/oauth/2.0/token";
-                String results = HttpUtils.httpGet(url, params, null);
-                JSONObject obj = JSONObject.parseObject(results);
-                if (!Check.isNull(obj)) {
-                    obj.put("app_id", tokenJson.getLong("app_id"));
-                    bytedanceRefreshTokenMapper.updateBaiduYunToken(obj);
-                    log.info("{},刷新百度云token成功", tokenJson.getLong("app_id"));
-                }
-            }
-        }
-    }
-
-    @Override
-    public void refreshAppletTokens() {
-        List<JSONObject> list = bytedanceRefreshTokenMapper.queryOfficialAccounts();
-        if (!Check.isNull(list)) {
-            Jedis jedis = getJedisToken();
-            if (!Check.isNull(jedis)) {
-                for (JSONObject app : list) {
-                    String key = null;
-                    if (app.getString("app_id").startsWith("tt")) {
-                        key = "client-token-key_" + app.getString("app_id");
-                    }
-                    if (app.getString("app_id").startsWith("wx")) {
-                        key = "wechat-applet-access-token-key-" + app.getString("applet_id");
-                    }
-                    if (Check.isNull(key)) {
-                        continue;
-                    }
-                    String token = jedis.get(key);
-                    if (!Check.isNull(token)) {
-                        app.put("token", token);
-                    }
-                }
-                jedis.close();
-            }
-        }
-        bytedanceRefreshTokenMapper.refreshAppletTokens(list);
-
-    }
-
-    //获取token
-    @Override
-    public Jedis getJedisToken() {
-        Jedis jedis = null;
-        try {
-            jedis = new Jedis(redisHost, redisPort);
-            jedis.auth(redisPassword);
-            // token 缓存固定使用 db5,与 RedisConfig#redisTemplate_db5 保持一致
-            jedis.select(5);
-            return jedis;
-        } catch (Exception e) {
-            log.info("---Jedis失败,消息:{}", e.getMessage());
-            log.info("---异常消息:", e);
-            e.printStackTrace();
-        }
-        return null;
-    }
 }

+ 0 - 54
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/CPSReportServiceImpl.java

@@ -1,54 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service.impl;
-
-import cn.com.ctop.job.bytedance.data.mapper.CPSReportMapper;
-import cn.com.ctop.job.bytedance.data.service.ICPSReportService;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import com.alibaba.fastjson.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Date;
-import java.util.List;
-
-@Service
-@Slf4j
-public class CPSReportServiceImpl implements ICPSReportService {
-    @Autowired
-    private CPSReportMapper cpsReportMapper;
-
-    @Override
-    public void cleanCPSDailyReports(String nowDate) {
-        try {
-            if (cpsReportMapper.cleanCPSPayDailyReports(nowDate))
-                if (cpsReportMapper.cleanCPSIaaDailyReportsDS(cpsReportMapper.queryCPSIaaDaily(Integer.valueOf(nowDate), nowDate)))
-                    log.info("CPS数据清洗完成:{}", nowDate);
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("CPS数据清洗异常");
-        }
-    }
-
-    @Override
-    public void runCPSSettlementData(String nowDate) {
-        try {
-            //根据nowDate获取这一天开始和结束的时间戳(10位)
-            Date date = DateUtils.getDateByPattern(nowDate, "yyyy-MM-dd");
-            Long st = date.getTime() / 1000 + 3600;
-            String dateLong = nowDate.replaceAll("-", "");
-
-            int count = cpsReportMapper.runCPSIapSettlementData(nowDate, dateLong, st);
-            log.info("CPSIAP结算数据处理完成,影响行数:{}", count);
-
-            List<JSONObject> dyList = cpsReportMapper.runCPSIaaDySettlementData(nowDate, dateLong, st);
-            count = dyList == null ? 0 : dyList.size();
-            if (count > 0) {
-                cpsReportMapper.saveIaaDySettlementData(dyList);
-            }
-            log.info("CPSIaa(抖音)结算数据处理完成,影响行数:{}", count);
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("CPSIAP结算数据处理异常");
-        }
-    }
-}

+ 0 - 144
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/DianzhongConfigServiceImpl.java

@@ -1,144 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service.impl;
-
-import cn.com.ctop.job.bytedance.config.DianZhongConfig;
-import cn.com.ctop.job.bytedance.data.entity.DianzhongDistributorConfig;
-import cn.com.ctop.job.bytedance.data.entity.DianzhongMovieConfig;
-import cn.com.ctop.job.bytedance.data.mapper.DianzhongConfigMapper;
-import cn.com.ctop.job.bytedance.data.service.IDianzhongConfigService;
-import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.http.Header;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.message.BasicNameValuePair;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.*;
-
-@Service
-@Slf4j
-public class DianzhongConfigServiceImpl implements IDianzhongConfigService {
-    @Autowired
-    DianZhongConfig dianZhongConfig;
-    @Resource
-    DianzhongConfigMapper dianzhongConfigMapper;
-
-
-
-    @Override
-    public void pullChannelInfo() {
-        for (DianZhongConfig.DZConfig dzAuth : dianZhongConfig.getDzConfig()){
-            String url = "https://routine.wqxsw.com/flames/channel/query/channelInfoList";
-            JSONObject requestJson = initRequestJson2(dzAuth);
-            System.out.println("请求点众渠道用户列表接口,参数:" + requestJson.toJSONString());
-            String res = HttpUtils.httpPostRequest(url, requestJson, null);
-            System.out.println("点众回调渠道用户列表接口返回结果:" + res);
-            if (StringUtils.isEmpty(res)){
-                log.error("点众渠道用户列表接口返回结果为空");
-                return;
-            }
-            JSONObject resObj = JSONObject.parseObject(res);
-            int code = resObj.getIntValue("retCode");
-            if (code != 0){
-                log.error("点众渠道用户列表接口返回错误,code: {}, msg: {}", code, resObj.getString("retMsg"));
-                return;
-            }
-            JSONObject data = resObj.getJSONObject("data");
-            JSONArray channelInfoList = data.getJSONArray("channelInfoList");
-            if (channelInfoList == null || channelInfoList.isEmpty()) {
-                log.info("点众渠道用户列表接口没有返回数据");
-                return;
-            }
-            for (int i = 0; i < channelInfoList.size(); i++) {
-                JSONObject obj = channelInfoList.getJSONObject(i);
-                DianzhongDistributorConfig config = new DianzhongDistributorConfig();
-                config.setDistributorId(obj.getString("channelId"));
-                config.setDistributorName(obj.getString("userName"));
-                config.setNickName(obj.getString("nickName"));
-                config.setDianzhongAccountId(dzAuth.getClientId());
-                config.setChannelCreateTime( obj.getString("createTime"));
-                config.setJumpType( obj.getString("jumpType"));
-                config.setOfAppid( obj.getString("ofAppid"));
-                config.setCreateBy("system");
-                config.setUpdateBy("system");
-
-                dianzhongConfigMapper.insertDistributorConfigSelective(config);
-            }
-
-        }
-    }
-
-    @Override
-    public void pullMovie() throws IOException {
-        try {
-            String url = "https://api.deepthink.artlinkworld.cn/dianzhong/syncMovie";
-            String s = HttpUtils.httpPostRequest(url, null, null);
-        }catch (Exception ignored){
-
-        }
-    }
-
-    @Override
-    public void syncPromoteLinkInfo() {
-        try {
-            String url = "https://api.deepthink.artlinkworld.cn/dianzhong/syncAll";
-            String s = HttpUtils.httpPostRequest(url, null, null);
-        }catch (Exception ignored){
-
-        }
-    }
-
-
-
-
-
-
-    //获取调用点众接口的必要参数
-    private JSONObject initRequestJson(DianZhongConfig.DZConfig authConfig){
-        JSONObject object = new JSONObject();
-        String clientId = authConfig.getClientId();
-        String token = authConfig.getToken();
-        object.put("clientId", clientId);
-        long timestamp = System.currentTimeMillis() / 1000;
-        object.put("timestamp", String.valueOf(timestamp));
-        System.out.println(clientId + token + timestamp);
-        String signKey = DigestUtils.md5Hex(
-                clientId + token + timestamp
-        ).toLowerCase();
-        object.put("signKey", signKey);
-        return object;
-    }
-
-    private JSONObject initRequestJson2(DianZhongConfig.DZConfig authConfig){
-        JSONObject object = new JSONObject();
-        String clientId = authConfig.getClientId();
-        String token = authConfig.getToken();
-        object.put("clientId", clientId);
-        long timestamp = System.currentTimeMillis();
-        object.put("timestamp", String.valueOf(timestamp));
-        System.out.println(clientId + token + timestamp);
-        String signKey = DigestUtils.md5Hex(
-                clientId + token + timestamp
-        ).toLowerCase();
-        object.put("signKey", signKey);
-        return object;
-    }
-
-
-
-
-}

+ 0 - 106
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/HealthCheckServiceImpl.java

@@ -1,106 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service.impl;
-
-import cn.com.ctop.job.bytedance.data.service.IHealthCheckService;
-import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
-import com.alibaba.fastjson.JSONObject;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.springframework.stereotype.Service;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Service
-public class HealthCheckServiceImpl implements IHealthCheckService {
-
-    @Override
-    public void check() throws Exception {
-
-        List<String> ips = Arrays.asList(
-//                "192.168.1.33"//localhost
-                "123.57.9.211"//test
-//                "172.16.0.108",
-//                "172.16.0.130",
-//                "172.16.0.131",
-//                "172.16.0.144"
-        );
-
-        Map<String, Integer> ipErrorCount = new HashMap<>();
-        for (String ip : ips) {
-            ipErrorCount.put(ip, 0);
-        }
-        for (int i = 0; i < 10; i++) {
-            for (String ip : ips) {
-                String url = "http://" + ip + ":9002/monitor/server/healthCheck";
-                System.out.println(url);
-                try {
-                    int status = healthCheckRequest(url);
-                    if (status == 0) {
-                        System.out.println("Health check passed for " + ip);
-                    } else {
-                        ipErrorCount.put(ip, ipErrorCount.get(ip) + 1);
-                    }
-                }catch (Exception e) {
-                    System.out.println("Health check failed for " + ip + ": " + e.getMessage());
-                    ipErrorCount.put(ip, ipErrorCount.get(ip) + 1);
-                }
-            }
-            Thread.sleep(5000);
-        }
-
-        for (String ip : ips) {
-            if (ipErrorCount.get(ip) > 6) {
-                System.out.println("Health check failed for " + ip);
-            }
-        }
-
-    }
-
-    private static int healthCheckRequest(String url) throws Exception {
-        //一个最简单的http请求,GET,无参数,超时时间为1秒
-        HttpGet httpEntity = new HttpGet(url);
-        CloseableHttpResponse response = null;
-        CloseableHttpClient client = null;
-        try {
-            client = HttpClientBuilder.create().build();
-            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(1000).setConnectTimeout(1000).build();
-            httpEntity.setConfig(requestConfig);
-            response = client.execute(httpEntity);
-            if (response != null && response.getStatusLine().getStatusCode() == 200) {
-                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
-                StringBuilder result = new StringBuilder();
-                String line = "";
-                while ((line = bufferedReader.readLine()) != null) {
-                    result.append(line);
-                }
-                bufferedReader.close();
-                return result.toString().equals("SUCCESS") ? 0 : 500;
-            }
-        } finally {
-            try {
-                if (response != null) {
-                    response.close();
-                }
-                if (client != null) {
-                    client.close();
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-        return 500;
-
-    }
-
-
-}

+ 0 - 343
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ToolsSiteServiceImpl.java

@@ -1,343 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service.impl;
-
-import cn.com.ctop.job.bytedance.data.entity.AdvertiserApplet;
-import cn.com.ctop.job.bytedance.data.entity.AdvertiserAvatar;
-import cn.com.ctop.job.bytedance.data.entity.AdvertiserNameInfo;
-import cn.com.ctop.job.bytedance.data.entity.AdvertiserToolsSite;
-import cn.com.ctop.job.bytedance.data.mapper.BytedanceRefreshTokenMapper;
-import cn.com.ctop.job.bytedance.data.mapper.ToolsSiteMapper;
-import cn.com.ctop.job.bytedance.data.service.IToolsSiteService;
-import cn.com.ctop.job.bytedance.data.utils.Check;
-import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
-import cn.com.ctop.job.bytedance.data.utils.Okhttp3Utils;
-import cn.com.ctop.job.bytedance.utils.RateLimitUtil;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Service
-@Slf4j
-public class ToolsSiteServiceImpl implements IToolsSiteService {
-    @Autowired
-    private ToolsSiteMapper toolsSiteMapper;
-
-    @Autowired
-    private BytedanceRefreshTokenMapper tokenMapper;
-
-    @Autowired
-    private RateLimitUtil rateLimitUtil;
-
-    @Override
-    public List<Long> getAvatarAdvertiserIds() {
-        return toolsSiteMapper.getAvatarAdvertiserIds();
-    }
-
-    @Override
-    public void updateAvatarStatus(Long advertiserId) {
-        JSONObject authConfig = tokenMapper.getAuthConfig(advertiserId);
-        if (Check.isNull(authConfig)) {
-            log.info("账户id:{},获取token为空", advertiserId);
-        }
-        String accessToken = authConfig.getString("access_token");
-        String devAppId = authConfig.getString("app_id");
-        JSONObject params = new JSONObject();
-        params.put("advertiser_id", advertiserId);
-        String url = "https://ad.oceanengine.com/open_api/2/advertiser/avatar/get/";
-        JSONObject obj = null;
-        if (rateLimitUtil.acquire(devAppId,url)){
-            obj = Okhttp3Utils.bytedanceGetRequest(accessToken, url, params);
-        }
-        if (!Check.isNull(obj)) {
-            Integer code = obj.getInteger("code");
-            if (code == 0) {
-                AdvertiserAvatar advertiserAvatar = new AdvertiserAvatar(obj.getJSONObject("data"));
-                advertiserAvatar.setReason("");
-                if (!toolsSiteMapper.updateAdvertiserAvatar(advertiserAvatar)) {
-                    toolsSiteMapper.insertAdvertiserAvatar(advertiserAvatar);
-                }
-            } else {
-                log.error("更新广告主账户头像失败,返回结果:{}", obj);
-            }
-        } else {
-            log.error("更新广告主账户头像失败.");
-        }
-    }
-
-    @Override
-    public List<Long> getNameAdvertiserIds() {
-        return toolsSiteMapper.getNameAdvertiserIds();
-    }
-
-    @Override
-    public void updateNameStatus(Long advertiserId) {
-        JSONObject authConfig = tokenMapper.getAuthConfig(advertiserId);
-        if (Check.isNull(authConfig)) {
-            log.info("账户id:{},获取token为空", advertiserId);
-        }
-        String accessToken = authConfig.getString("access_token");
-        String devAppId = authConfig.getString("app_id");
-        Map<String, Object> params = new HashMap<>();
-        params.put("account_ids", new JSONArray(Collections.singletonList(advertiserId)));
-        String url = "https://api.oceanengine.com/open_api/2/agent/advertiser_info/query/";
-        String results = null;
-        if (rateLimitUtil.acquire(devAppId,url)){
-            results = HttpUtils.httpGet(url, params, HttpUtils.postMHeaders(accessToken));
-        }
-        JSONObject obj = JSONObject.parseObject(results);
-        if (!Check.isNull(obj) && 0 == obj.getInteger("code")) {
-            JSONArray array = obj.getJSONObject("data").getJSONArray("account_detail_list");
-            JSONObject object = array.getJSONObject(0);
-            if (!Check.isNull(object)) {
-                AdvertiserNameInfo nameInfo = new AdvertiserNameInfo(advertiserId, object.getString("advertiser_name"), object.getString("advertiser_status"));
-                nameInfo.setReason("");
-                if (!toolsSiteMapper.updateAdvertiserNameInfo(nameInfo)) {
-                    toolsSiteMapper.insertAdvertiserNameInfo(nameInfo);
-                }
-            }
-        } else {
-            log.error("更新广告主账户名称失败,返回结果:{}", obj);
-        }
-    }
-
-    @Override
-    public List<JSONObject> getTimeOutAppList() {
-        return toolsSiteMapper.getTimeOutAppList();
-    }
-
-    @Override
-    public void pushAgain(JSONObject app) {
-        String taskId = app.getString("task_id");
-        Long advertiserId = app.getLong("advertiser_id");
-        publishSiteStatus(advertiserId, taskId);
-    }
-
-    @Override
-    public List<Long> getAppAdvertiserIds(String platType) {
-        return toolsSiteMapper.getAppAdvertiserIds(platType);
-    }
-
-    @Override
-    public void updateWxAppStatus(Long advertiserId, String searchType, Integer page) {
-        boolean nextPage = false;
-        JSONObject authConfig = tokenMapper.getAuthConfig(advertiserId);
-        if (Check.isNull(authConfig)) {
-            log.info("账户id:{},获取token为空", advertiserId);
-        }
-        String accessToken = authConfig.getString("access_token");
-        String devAppId = authConfig.getString("app_id");
-        JSONObject params = new JSONObject();
-        params.put("advertiser_id", advertiserId);
-        params.put("page", page);
-        //页面大小,默认值为10,最大值100
-        params.put("page_size", 100);
-        JSONObject filtering = new JSONObject();
-        //CREATE_ONLY本户创建,SHARE_ONLY 只查共享应用
-        filtering.put("search_type", searchType);
-       /*
-       //AUDIT_ACCEPTED 审核通过、AUDITING 审核中、AUDIT_REJECTED 审核不通过。不传表示全部状态
-        filtering.put("audit_status", "AUDIT_ACCEPTED");
-        */
-           /* JSONObject createTime = new JSONObject();
-            createTime.put("start_time", startDate);
-            createTime.put("end_time", DateUtils.getLastDay(endDate, -1));
-            filtering.put("create_time", createTime);*/
-        params.put("filtering", filtering);
-        //获取微信小程序列表
-        String url = "https://api.oceanengine.com/open_api/v3.0/tools/wechat_applet/list/";
-        JSONObject obj = null;
-        if(rateLimitUtil.acquire(devAppId,url)){
-            obj = Okhttp3Utils.bytedanceGetRequest(accessToken, url, params);
-        }
-        if (!Check.isNull(obj) && obj.getInteger("code") == 0) {
-            JSONObject data = obj.getJSONObject("data");
-            Integer totalPage = data.getJSONObject("page_info").getInteger("total_page");
-            if (totalPage != 0 && totalPage != data.getJSONObject("page_info").getInteger("page")) {
-                nextPage = true;
-            }
-            JSONArray list = data.getJSONArray("list");
-            for (int i = 0; i < list.size(); i++) {
-                JSONObject resultObj = list.getJSONObject(i);
-                AdvertiserApplet advertiserApplet = new AdvertiserApplet(advertiserId, resultObj, "1");
-                if ("SHARE_ONLY".equals(searchType)) {
-                    advertiserApplet.setAppShare("1");
-                    advertiserApplet.setShareAdvertiserId(resultObj.getLong("advertiser_id"));
-                } else {
-                    //小程序审核成功,判断是否主动创建落地页
-                    if ("AUDIT_ACCEPTED".equals(advertiserApplet.getAuditStatus()))
-                        pushCreateSite(advertiserId, advertiserApplet.getInstanceId());
-                }
-                if (!toolsSiteMapper.updateAdvertiserAppList(advertiserApplet))
-                    toolsSiteMapper.insertAdvertiserAppList(advertiserApplet);
-            }
-        } else {
-            log.error("获取微信小程序列表失败,{}", obj);
-        }
-        if (nextPage) {
-            updateWxAppStatus(advertiserId, searchType, page + 1);
-        }
-    }
-
-
-    @Override
-    public void updateTTAppStatus(Long advertiserId, String searchType, Integer page) {
-        List<AdvertiserApplet> advertiserApplets = toolsSiteMapper.queryAdvertiserAppList(advertiserId, "2");
-        //判断小程序状态是否在“审核中”状态,若存在则去拉取状态,并针对该对象修改,若不存在,则不执行。
-        if (!Check.isNull(advertiserApplets)) {
-            for (AdvertiserApplet advertiserApplet : advertiserApplets) {
-                if ("AUDITING".equals(advertiserApplet.getAuditStatus())) {
-                    getTTList(advertiserApplet, advertiserId, searchType, page);
-                }
-            }
-        } else {
-            getTTList(null, advertiserId, searchType, page);
-        }
-    }
-
-    private void getTTList(AdvertiserApplet targetApplet, Long advertiserId, String searchType, Integer page) {
-        boolean nextPage = false;
-        JSONObject authConfig = tokenMapper.getAuthConfig(advertiserId);
-        if (Check.isNull(authConfig)) {
-            log.info("账户id:{},获取token为空", advertiserId);
-        }
-        String accessToken = authConfig.getString("access_token");
-        String devAppId = authConfig.getString("app_id");
-        JSONObject params = new JSONObject();
-        params.put("advertiser_id", advertiserId);
-        params.put("page", page);
-        //页面大小,默认值为10,最大值100
-        params.put("page_size", 100);
-        JSONObject filtering = new JSONObject();
-        //CREATE_ONLY本户创建,SHARE_ONLY 只查共享应用
-        filtering.put("search_type", searchType);
-        params.put("filtering", filtering);
-        //获取微信小程序列表
-        String url = "https://api.oceanengine.com/open_api/v3.0/tools/micro_app/list/";
-        JSONObject obj = null;
-        if(rateLimitUtil.acquire(devAppId,url)){
-            obj = Okhttp3Utils.bytedanceGetRequest(accessToken, url, params);
-        }
-        if (!Check.isNull(obj) && 0 == obj.getInteger("code")) {
-            JSONObject data = obj.getJSONObject("data");
-            Integer totalPage = data.getJSONObject("page_info").getInteger("total_page");
-            if (totalPage != 0 && totalPage != data.getJSONObject("page_info").getInteger("page")) {
-                nextPage = true;
-            }
-            JSONArray list = data.getJSONArray("list");
-            for (int i = 0; i < list.size(); i++) {
-                JSONObject resultObj = list.getJSONObject(i);
-                AdvertiserApplet advertiserApplet = new AdvertiserApplet(advertiserId, resultObj, "2");
-                if ("SHARE_ONLY".equals(searchType)) {
-                    advertiserApplet.setAppShare("1");
-                    advertiserApplet.setShareAdvertiserId(resultObj.getLong("advertiser_id"));
-                }
-                if (targetApplet == null) {
-                    if (!toolsSiteMapper.updateAdvertiserAppList(advertiserApplet)) {
-                        toolsSiteMapper.insertAdvertiserAppList(advertiserApplet);
-                    }
-                } else {
-                    advertiserApplet.setTaskId(targetApplet.getTaskId());
-                    toolsSiteMapper.updateAdvertiserAppList2(advertiserApplet);
-                }
-            }
-        } else {
-            log.error("获取字节小程序列表失败,{}", obj);
-        }
-        if (nextPage) {
-            updateTTAppStatus(advertiserId, searchType, page + 1);
-        }
-    }
-
-    @Override
-    public List<Long> getSiteAdvertiserIds() {
-        return toolsSiteMapper.getsiteAdvertiserIds();
-    }
-
-    @Override
-    public List<JSONObject> getSiteAdvertiserIds2() {
-        return toolsSiteMapper.getsiteAdvertiserIds2();
-    }
-
-    @Override
-    public void updateSiteStatus(Long advertiserId, Integer page) {
-        JSONObject authConfig = tokenMapper.getAuthConfig(advertiserId);
-        if (Check.isNull(authConfig)) {
-            log.info("账户id:{},获取token为空", advertiserId);
-        }
-        String accessToken = authConfig.getString("access_token");
-        String devAppId = authConfig.getString("app_id");
-        boolean nextPage = false;
-        Map<String, Object> params = new HashMap<>();
-        params.put("advertiser_id", advertiserId);
-        //查询所有
-        params.put("status", "SITE_ALL");
-        params.put("page", page);
-        params.put("page_size", 100);//默认值为10,范围:20~300
-        String url = "https://ad.oceanengine.com/open_api/2/tools/site/get/";
-        JSONObject obj = null;
-        if(rateLimitUtil.acquire(devAppId,url)){
-            obj = Okhttp3Utils.bytedanceGetRequest(accessToken, url, params);
-        }
-        if (!Check.isNull(obj) && 0 == obj.getInteger("code")) {
-            JSONObject data = obj.getJSONObject("data");
-            Integer totalPage = data.getJSONObject("page_info").getInteger("total_page");
-            if (totalPage != 0 && totalPage != data.getJSONObject("page_info").getInteger("page")) {
-                nextPage = true;
-            }
-            JSONArray jsList = data.getJSONArray("list");
-            for (int i = 0; i < jsList.size(); i++) {
-                AdvertiserToolsSite advertiserToolsSite = new AdvertiserToolsSite(jsList.getJSONObject(i), advertiserId, "1");
-                if (!toolsSiteMapper.updateAdvertiserToolsSite(advertiserToolsSite)) {
-                    toolsSiteMapper.insertAdvertiserToolsSite(advertiserToolsSite);
-                }
-            }
-        } else {
-            log.error("获取字节小程序列表失败,{}", obj);
-        }
-        if (nextPage) {
-            updateSiteStatus(advertiserId, page + 1);
-        }
-    }
-
-    @Override
-    public void publishSiteStatus(Long advertiserId, String taskId) {
-        if (Check.isNull(taskId) || Check.isNull(advertiserId)) {
-            return;
-        }
-        String url = "https://api.deepthink.artlinkworld.cn/task/createTask";
-        Map<String, Object> param = new HashMap<>();
-        param.put("taskId", taskId);
-        param.put("advertiserId", advertiserId);
-        String s = HttpUtils.httpPostRequest(url, param, null);
-        JSONObject jsonObject = JSONObject.parseObject(s);
-        if (!Check.isNull(jsonObject) && jsonObject.getInteger("code") == 0) {
-            log.info("任务id:{},advertiserId: {} 执行创建落地页", taskId, advertiserId);
-        }
-    }
-
-    //主动去创建落地页
-    private void pushCreateSite(Long advertiserId, Long instanceId) {
-        List<JSONObject> objectList = toolsSiteMapper.queryIsCreateSite(advertiserId, instanceId);
-        //有数据 说明还没有创建落地页,执行创建
-        if (!Check.isNull(objectList)) {
-            for (JSONObject object : objectList) {
-                Long taskId = object.getLong("task_id");
-                String url = "https://api.deepthink.artlinkworld.cn/task/createTask";
-                Map<String, Object> param = new HashMap<>();
-                param.put("taskId", taskId);
-                param.put("advertiserId", advertiserId);
-                String s = HttpUtils.httpPostRequest(url, param, null);
-                JSONObject jsonObject = JSONObject.parseObject(s);
-                if (!Check.isNull(jsonObject) && jsonObject.getInteger("code") == 0) {
-                    log.info("任务:{}({}),advertiserId: {} 执行创建落地页", object.getString("task_name"), taskId, advertiserId);
-                }
-            }
-        }
-    }
-}

+ 0 - 621
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ZtPolicyRunServiceImpl.java

@@ -1,621 +0,0 @@
-package cn.com.ctop.job.bytedance.data.service.impl;
-
-import cn.com.ctop.job.bytedance.data.constants.ReportsConstants;
-import cn.com.ctop.job.bytedance.data.entity.*;
-import cn.com.ctop.job.bytedance.data.mapper.ZtPolicyMapper;
-import cn.com.ctop.job.bytedance.data.service.IBytedanceBudgetStatusService;
-import cn.com.ctop.job.bytedance.data.service.IZtPolicyRunService;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import cn.com.ctop.job.bytedance.utils.RedisUtil;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-import org.redisson.Redisson;
-import org.redisson.api.RAtomicLong;
-import org.redisson.api.RedissonClient;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.time.*;
-import java.time.format.DateTimeFormatter;
-import java.time.temporal.ChronoUnit;
-import java.util.*;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-
-@Service
-@Slf4j
-public class ZtPolicyRunServiceImpl implements IZtPolicyRunService {
-    private static final ExecutorService EXTRACTED_EXECUTOR = Executors.newFixedThreadPool(10);
-
-    @Resource
-    ZtPolicyMapper ztPolicyConfigMapper;
-    @Autowired
-    RedissonClient redissonClient;
-    @Autowired
-    IBytedanceBudgetStatusService bytedanceBudgetStatusService;
-
-    @Override
-    public void test() {
-        run(27L);
-//        run(24L);
-//        run(25L);
-//        run(30021L);
-    };
-
-    @Override
-    public void run(Long policyId) {
-        final String runId = UUID.randomUUID().toString().replace("-", "").substring(0,16);
-        ZtPolicy policy = getConfig(policyId);
-        /**已完成扫描
-        //指标选择- 获取indicator信息
-        //指标分类
-        //ID按500个一组,分别获取普通指标/项目信息/余额的数据
-         //在程序中处理判断
-        */
-        if (policy == null){
-            return;
-        }
-        if (policy.getTargetResIds() == null || policy.getTargetResIds().isEmpty()){
-            return;
-        }
-        ZtPolicyRunInfo ztPolicyRunInfo = new ZtPolicyRunInfo();
-        ztPolicyRunInfo.setRunId(runId);
-        ztPolicyRunInfo.setPolicyConfigId(policyId);
-        ztPolicyRunInfo.setScheduledTime(new Date());
-        ztPolicyRunInfo.setStartTime(new Date());
-        ztPolicyConfigMapper.insertPolicyRunRecord(ztPolicyRunInfo);
-
-        List<ZtPolicyCondition> conditions = policy.getConditions();
-        List<Long> indicatorIds = conditions.stream().map(ZtPolicyCondition::getIndicatorId).collect(Collectors.toList());
-
-
-        List<JSONObject> indicatorList = ztPolicyConfigMapper.indicatorList(indicatorIds);
-        Map<Long, JSONObject> indicatorMap = indicatorList.stream().collect(Collectors.toMap(o -> o.getLong("indicator_id"), o -> o));
-
-
-        /**---------------------------------------获取指标数据----------------------------------------------------*/
-
-        Map<String, ZtTargetRunInfo> runRecordMap = new HashMap<>();
-        for (ZtPolicyCondition condition : conditions) {
-            Long indicatorId = condition.getIndicatorId();
-            JSONObject indicator = indicatorMap.get(indicatorId);
-            String indicatorName = indicator.getString("indicator_name");
-            String indicatorCode = indicator.getString("indicator_code");
-            String dataSource =  indicator.getString("data_source");
-            String formula = indicator.getString("formula");
-
-            //批量查询过程
-            Map<String, JSONObject> matchConditionExtraRecordInfo = new HashMap<>();//记录的额外信息
-            Map<String, Object> dataResMap = new HashMap<>();//id -> 查询结果
-            if (dataSource.startsWith("bytedance")){//几个特殊字段获取
-                for (int index = 0; index < policy.getTargetResIds().size(); ) {
-                    List<String> subResIds = policy.getTargetResIds().subList(index, Math.min(index+500, policy.getTargetResIds().size()));
-                    List<JSONObject> data = null;
-                    if ("bytedance_project_status".equals(indicatorCode)){
-                        data = ztPolicyConfigMapper.promotionGroupToProjectData(subResIds);
-                    }else if ("bytedance_promote_status".equals(indicatorCode)){
-                        data = ztPolicyConfigMapper.promotionData(subResIds);
-                    }else if ("bytedance_advertiser_balance".equals(indicatorCode)){
-                        data = ztPolicyConfigMapper.balanceData(subResIds);
-                    }else {
-                        data = ztPolicyConfigMapper.projectData(subResIds);
-                    }
-                    data.forEach(o -> dataResMap.put(o.getString("target_id"), o.get(indicatorCode)));
-                    index += 500;
-                }
-            }else {//自定义指标通用字段
-                JSONObject requestParams = new JSONObject();
-                Integer timeType = policy.getScheduleType() == 3 ? 1: 2;
-                requestParams.put("timeType", timeType);
-                requestParams.put("mediaAdColumns", ReportsConstants.mediaSelectStr);
-                requestParams.put("userDataColumns", ReportsConstants.userSelectStr);
-                requestParams.put("selectIndicator", formula);
-                requestParams.put("managedDimension", policy.getManagedDimension());
-                Integer taskTimeType = condition.getTimeType();
-                String today = DateUtils.getNowDate("yyyy-MM-dd");
-                Long todayLong = Long.parseLong(today.replaceAll("-", ""));
-                if (timeType == 1){
-                    if (taskTimeType == 1){
-                        requestParams.put("startDate", todayLong);
-                        requestParams.put("endDate", todayLong);
-                    }else if (taskTimeType == 2){
-                        String startDate = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
-                        Long startDateLong = Long.parseLong(startDate.replaceAll("-", ""));
-                        requestParams.put("startDate", startDateLong);
-                        requestParams.put("endDate", startDateLong);
-                    }else if (taskTimeType == 3){
-                        String startDate = DateUtils.getNowAddDate("yyyy-MM-dd", -2);
-                        Long startDateLong = Long.parseLong(startDate.replaceAll("-", ""));
-                        requestParams.put("startDate", startDateLong);
-                        requestParams.put("endDate", todayLong);
-                    }else if (taskTimeType == 4){
-                        String startDate = DateUtils.getNowAddDate("yyyy-MM-dd", -6);
-                        Long startDateLong = Long.parseLong(startDate.replaceAll("-", ""));
-                        requestParams.put("startDate", startDateLong);
-                        requestParams.put("endDate", startDateLong);
-                    }else {
-                        log.error("智投助手任务失败:判断条件配置错误,策略ID: {}", policyId);
-                    }
-                }else {
-                    if (taskTimeType == 11){
-                        requestParams.put("date", todayLong);
-                    }else if (taskTimeType == 12){
-                        ZoneId zone = ZoneId.systemDefault();
-                        LocalDateTime lastHour = LocalDateTime.now(zone).minusHours(1);
-                        String yyyyMMdd = lastHour.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
-                        Long date = Long.parseLong(yyyyMMdd);
-                        int H = lastHour.getHour(); // 0-23,不补零
-                        requestParams.put("date", date);
-                        requestParams.put("hour", H);
-                    }else {
-                        log.error("智投助手任务失败:判断条件配置错误,策略ID: {}", policyId);
-                    }
-                }
-                for (int index = 0; index < policy.getTargetResIds().size(); ) {
-                    List<String> subResIds = policy.getTargetResIds().subList(index, Math.min(index+500, policy.getTargetResIds().size()));
-                    requestParams.put("idList", subResIds);
-                    List<JSONObject> data = ztPolicyConfigMapper.adData(requestParams);
-                    data.forEach(o -> dataResMap.put(o.getString("target_id"), o.get(indicatorCode)));
-                    index += 500;
-                }
-            }
-
-            /**--------------------------------------指标数据判断阈值-----------------------------------------------------*/
-            //处理dataResMap,和condition条件做  比较,顺便做记录
-            for (String targetId : policy.getTargetResIds()){
-                ZtTargetRunInfo runInfo = new ZtTargetRunInfo();
-                final String recordId = UUID.randomUUID().toString().replace("-", "").substring(0,16); //记录,runId
-                runInfo.setPolicyId(policyId);
-                runInfo.setRunId(runId);
-                runInfo.setUuid(recordId);
-                runInfo.setManagedDimension(policy.getManagedDimension());
-                runInfo.setTargetId(targetId);
-                runInfo.setIndicatorInfo(indicator);
-                runInfo.setCondition(condition);
-                Object indValueObj = dataResMap.get(targetId);
-                String indValue = indValueObj == null ? "0" : String.valueOf(indValueObj);
-                runInfo.setCurrentValue(indValue);
-                //判断是否触发操作
-                boolean isExecute = false;
-                String operator = condition.getOperator();
-                if (operator.equals("BETWEEN")){
-                    Double value = Double.parseDouble(indValue);
-                    Double compareValueMin = condition.getCompareValueJsonObject().getDoubleValue("min");
-                    Double compareValueMax = condition.getCompareValueJsonObject().getDoubleValue("max");
-                    if (value >= compareValueMin && value <= compareValueMax){
-                        isExecute = true;
-                    }
-                    String matchedConditionDesc = indicatorName + ": "+value + "介于"+compareValueMin+", "+compareValueMax;
-                    runInfo.setMatchedConditionDesc(matchedConditionDesc);
-                }else if (operator.equals("EQ")){
-                    String value = indValue;
-                    String compareValue = condition.getCompareValueJsonObject().getString("value");
-                    if (Objects.equals(value, compareValue)){
-                        isExecute = true;
-                    }
-                    String matchedConditionDesc = indicatorName + ": "+ value+" 等于 "+value;
-                    runInfo.setMatchedConditionDesc(matchedConditionDesc);
-                }else if (operator.equals("NEQ")){
-                    String value = indValue;
-                    String compareValue = condition.getCompareValueJsonObject().getString("value");
-                    if (!Objects.equals(value, compareValue)){
-                        isExecute = true;
-                    }
-                    String matchedConditionDesc = indicatorName + ": "+ value+" 不等于 "+value;
-                    runInfo.setMatchedConditionDesc(matchedConditionDesc);
-                }else {
-                    Double value = Double.parseDouble(indValue);
-                    Double compareValue = condition.getCompareValueJsonObject().getDoubleValue("value");
-                    if (operator.equals("GT")){
-                        isExecute = value > compareValue;
-                        String matchedConditionDesc = indicatorName + ": "+ value + " > "+compareValue;
-                        runInfo.setMatchedConditionDesc(matchedConditionDesc);
-                    }else if (operator.equals("LT")){
-                        isExecute = value < compareValue;
-                        String matchedConditionDesc = indicatorName + ": "+ value + " < "+compareValue;
-                        runInfo.setMatchedConditionDesc(matchedConditionDesc);
-                    }else if (operator.equals("GE")){
-                        isExecute = value >= compareValue;
-                        String matchedConditionDesc = indicatorName + ": "+ value + " >= "+compareValue;
-                        runInfo.setMatchedConditionDesc(matchedConditionDesc);
-                    }else {
-                        log.error("智投助手任务报错-判断符号无效,任务中止。任务ID:{}条件ID:{}", policyId, condition.getId());
-                    }
-
-                }
-                runInfo.setIsExecute(isExecute);
-                runInfo.setTriggerTime(new Date());
-
-                JSONObject matchedConditionJson = new JSONObject();
-                matchedConditionJson.put("indicatorCode", indicatorCode);
-                matchedConditionJson.put("operator",  operator);
-                matchedConditionJson.put("compareValue", condition.getCompareValueJson());
-                matchedConditionJson.put("currentValue", indValue);
-                runInfo.setMatchedConditionJson(matchedConditionJson);
-                runInfo.setMatchedConditionJsonStr(matchedConditionJson.toJSONString());
-                runInfo.setConditionId(runInfo.getCondition().getId());
-                if (policy.getManagedDimension() == 1){
-                    runInfo.setAdvertiserId(Long.valueOf(targetId));
-                }else {
-                    String advId = policy.getTargetFromAdvertiserId().get(targetId);
-                    runInfo.setAdvertiserId(Long.valueOf(advId));
-                }
-
-                runRecordMap.put(targetId+"_"+condition.getId(), runInfo);
-            }
-        }
-        //condition结束
-        // 存储condition的记录
-        List<ZtTargetRunInfo> runInfoList = new ArrayList<>(runRecordMap.values());
-        ztPolicyConfigMapper.insertRunRecords(runInfoList);
-
-
-        /**---------------------------------------所有指标做且/或判断----------------------------------------------------*/
-        //挑拣出达到阈值的,走执行
-        Integer conditionLogic = policy.getConditionLogic();//1且2或
-        List<String> executeTargetList = new ArrayList<>();//执行列表
-        for (String targetId : policy.getTargetResIds()){
-            if (conditionLogic == 1){//且
-                boolean notMatched = false;
-                for (ZtPolicyCondition c : policy.getConditions()){
-                    ZtTargetRunInfo runInfo = runRecordMap.get(targetId+"_"+c.getId());
-                    if (!runInfo.getIsExecute()) {
-                        notMatched = true;
-                        break;
-                    }
-                }
-                if (!notMatched){
-                    executeTargetList.add(targetId);
-                }
-            }else {//或
-                boolean isExecute = false;
-                for (ZtPolicyCondition c : policy.getConditions()){
-                    ZtTargetRunInfo runInfo = runRecordMap.get(targetId+"_"+c.getId());
-                    if (runInfo.getIsExecute()){
-                        isExecute = true;
-                        break;
-                    }
-                }
-                if (isExecute){
-                    executeTargetList.add(targetId);
-                }
-            }
-        }
-
-
-        System.out.println(">>>>>执行列表");
-        System.out.println(JSON.toJSONString(executeTargetList));
-        //没有要执行的,记录一下然后结束
-        if (executeTargetList.isEmpty()){
-            ztPolicyRunInfo.setEndTime(new Date());
-            ztPolicyRunInfo.setTriggered(0);
-            ztPolicyRunInfo.setResultStatus(1);
-            ztPolicyRunInfo.setErrorMessage("成功");
-            ztPolicyConfigMapper.updatePolicyRunRecord(ztPolicyRunInfo);
-            return;
-        }else {
-            ztPolicyRunInfo.setTriggered(1);
-            ztPolicyRunInfo.setTriggerNum(executeTargetList.size());
-            ztPolicyConfigMapper.updatePolicyRunRecord(ztPolicyRunInfo);
-        }
-
-        /**-------------------------------------执行------------------------------------------------------*/
-        //根据executeTargetList来执行
-
-        List<ZtPolicyAction> actions = policy.getActions();
-        for (ZtPolicyAction action : actions){
-            ZtActionLog actionLog = new ZtActionLog();
-            actionLog.setActionId(action.getId());
-            actionLog.setId(UUID.randomUUID().toString().replace("-","").substring(0,16));
-            actionLog.setRunId(runId);
-            actionLog.setPolicyId(policyId);
-            actionLog.setTargetType(policy.getManagedDimension());
-            actionLog.setActionType(action.getActionType());
-
-            String operateFreqCircle = action.getActionRuleJsonObject().getString("operateFreqCircle");
-            Integer operateFreqLimit = action.getActionRuleJsonObject().getInteger("operateFreqLimit");
-
-            if (action.getActionType() == 1 || action.getActionType() == 2 || action.getActionType() == 3){//调账号预算
-
-                List<Future<?>> futures = new ArrayList<>();
-                for (String executeTarget : executeTargetList){
-                    ZtActionLog currentActionLog = copyActionLog(actionLog, executeTarget);
-                    if (!isOperation(policyId, executeTarget, action.getId(), operateFreqLimit)){
-                        //达到频控,不执行
-                        recordActionSkip(currentActionLog, 2);
-                        continue;
-                    }
-                    futures.add(EXTRACTED_EXECUTOR.submit(() -> extracted(policyId, action, executeTarget, policy, operateFreqCircle, currentActionLog)));
-                }
-                for (Future<?> future : futures){
-                    try {
-                        future.get();
-                    } catch (InterruptedException e) {
-                        Thread.currentThread().interrupt();
-                        break;
-                    } catch (Exception e) {
-                        // extracted 内部已做异常处理,这里兜住线程池执行层异常
-                    }
-                }
-                //end for
-
-            }
-        }
-
-    }
-
-    private ZtActionLog copyActionLog(ZtActionLog source, String targetId) {
-        ZtActionLog copied = new ZtActionLog();
-        copied.setId(source.getId());
-        copied.setRunId(source.getRunId());
-        copied.setPolicyId(source.getPolicyId());
-        copied.setTargetType(source.getTargetType());
-        copied.setActionId(source.getActionId());
-        copied.setActionType(source.getActionType());
-        copied.setTargetId(targetId);
-        return copied;
-    }
-
-    private void extracted(Long policyId, ZtPolicyAction action, String executeTarget, ZtPolicy policy, String operateFreqCircle, ZtActionLog actionLog) {
-        Integer changeForward =  action.getActionRuleJsonObject().getInteger("changeForward");
-        BigDecimal changeRate = action.getActionRuleJsonObject().getBigDecimal("changeRate");
-        BigDecimal changeAmountLimit =  action.getActionRuleJsonObject().getBigDecimal("changeAmountLimit");
-        JSONObject budgetInfo;
-        if (action.getActionType() == 1){
-            budgetInfo = bytedanceBudgetStatusService.getAdvertiserBudget(Long.valueOf(executeTarget));
-        }else if (action.getActionType() == 2){
-            String advertiserId = policy.getTargetFromAdvertiserId().get(executeTarget);
-            budgetInfo = bytedanceBudgetStatusService.getProjectBudget(Long.valueOf(advertiserId), Long.valueOf(executeTarget));
-        }else{
-            String advertiserId = policy.getTargetFromAdvertiserId().get(executeTarget);
-            budgetInfo = bytedanceBudgetStatusService.getPromotionBudget(Long.valueOf(advertiserId), Long.valueOf(executeTarget));
-        }
-        if (budgetInfo != null){
-            String budget_mode =  budgetInfo.getString("budget_mode");
-            BigDecimal budget = budgetInfo.getBigDecimal("budget");
-            //计算调整之后的预算
-            BigDecimal change;
-            change = budget.multiply(changeRate).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
-            if (changeAmountLimit != null && change.compareTo(changeAmountLimit) > 0){
-                change = changeAmountLimit;
-            }
-            BigDecimal budgetChange;
-            if (changeForward == 1){
-                budgetChange = budget.add(change);
-            }else {
-                budgetChange = budget.subtract(change);
-            }
-
-            try {
-                JSONObject operationResult = null;
-                if (action.getActionType() == 1){
-                    operationResult = bytedanceBudgetStatusService.updateAdvertiserBudget(Long.valueOf(executeTarget), budget_mode, budgetChange);
-                }else if (action.getActionType() == 2){
-                    String advertiserId = policy.getTargetFromAdvertiserId().get(executeTarget);
-                    operationResult = bytedanceBudgetStatusService.updateProjectBudget(Long.valueOf(advertiserId), Long.valueOf(executeTarget), budget_mode, budgetChange);
-                }else{
-                    String advertiserId = policy.getTargetFromAdvertiserId().get(executeTarget);
-                    operationResult = bytedanceBudgetStatusService.updatePromotionBudget(Long.valueOf(advertiserId), Long.valueOf(executeTarget), budget_mode, budgetChange);
-                }
-                recordOperation(policyId, executeTarget, action.getId(), operateFreqCircle);
-                if (operationResult == null){
-                    recordActionError(actionLog, "调整预算失败,调整值:"+budgetChange);
-                }else {
-                    Integer code =  operationResult.getInteger("code");
-                    if (code == null){
-                        recordActionError(actionLog, "获取调整预算接口结果失败,调整值:"+budgetChange);
-                    }else if (code != 0){
-                        recordActionError(actionLog, "调整预算接口错误, message:"+operationResult.getString("message")+", 调整值:"+budgetChange);
-                    }else {
-                        recordActionSuccess(actionLog);
-                    }
-                }
-
-                recordActionSuccess(actionLog);
-            }catch (Exception e){
-                String message = e.getMessage();
-                if (message.length()>500){
-                    message=message.substring(0,500);
-                }
-                recordActionError(actionLog, "调整预算出现错误:"+message);
-            }
-        }else {
-            recordActionError(actionLog, "未找到目标的预算信息");
-        }
-    }
-
-    //记录操作被跳过
-    private void recordActionSkip(ZtActionLog log, Integer skipReason){
-        recordActionInfo(log, 0, skipReason, 1, null);
-    }
-
-    //记录操作失败
-    private void recordActionError(ZtActionLog log, String errorMessage){
-        recordActionInfo(log, 1, null, 2, errorMessage);
-    }
-
-    //记录操作成功
-    private void recordActionSuccess(ZtActionLog log){
-        recordActionInfo(log, 1, null, 1, null);
-    }
-
-    //记录操作信息
-    private void recordActionInfo(ZtActionLog log, Integer executed, Integer skipReason, Integer resultStatus, String errorMessage){
-        log.setExecuted(executed);
-        log.setSkipReason(skipReason);
-        log.setResultStatus(resultStatus);
-        log.setErrorMessage(errorMessage);
-        ztPolicyConfigMapper.insertActionLog(Collections.singletonList(log));
-    }
-
-    private boolean isOperation(Long policyId, String targetId, Long actionId, Integer operateFreqLimit){
-        if (operateFreqLimit == null || operateFreqLimit == 0){
-            return true;
-        }
-        String rkey = "zt:"+policyId+":"+actionId+":"+targetId;
-        RAtomicLong rAtomicLong = redissonClient.getAtomicLong(rkey);
-        if (!rAtomicLong.isExists()){
-            return true;
-        }
-        long value = rAtomicLong.get();
-        return value < operateFreqLimit;
-    }
-
-    private void recordOperation(Long policyId, String targetId, Long actionId, String operateFreqCircle){
-        String rkey = "zt:"+policyId+":"+actionId+":"+targetId;
-        RAtomicLong rAtomicLong = redissonClient.getAtomicLong(rkey);
-        if (!rAtomicLong.isExists()){
-            if ("HOUR".equals(operateFreqCircle)){
-                rAtomicLong.set(0);
-                ZoneId zone = ZoneId.systemDefault();
-                Instant hourEnd = ZonedDateTime.now(zone)
-                        .truncatedTo(ChronoUnit.HOURS)
-                        .plusHours(1)
-                        .toInstant();
-                rAtomicLong.expire(hourEnd);
-            }else {//DAY
-                rAtomicLong.set(0);
-                ZoneId zone = ZoneId.systemDefault();
-                Instant dayEnd = LocalDate.now(zone)
-                        .plusDays(1)
-                        .atStartOfDay(zone)
-                        .toInstant();
-                rAtomicLong.expire(dayEnd);
-            }
-        }
-        long nowCount = rAtomicLong.incrementAndGet();
-    }
-
-
-
-    private ZtPolicy getConfig(Long policyId){
-        ZtPolicy policy = null;
-        if (policyId != null){
-            policy = ztPolicyConfigMapper.getPolicyDetail(policyId);
-            if (policy.getStatus() == 0){
-                return null;
-            }
-            if (policy.getTargetScope()==1){
-                List<ZtPolicyTargetFilter> filterList = ztPolicyConfigMapper.getTargetFilters(policyId);
-                Map<Integer, List<ZtPolicyTargetFilter>> scopeFilterMap =
-                        filterList.stream().collect(Collectors.groupingBy(ZtPolicyTargetFilter::getFilterKey));
-                for (Map.Entry<Integer, List<ZtPolicyTargetFilter>> entry : scopeFilterMap.entrySet()) {
-                    Integer key = entry.getKey();
-                    List<ZtPolicyTargetFilter> value = entry.getValue();
-                    if (key == 1){
-                        policy.setAppId(value.stream().map(ZtPolicyTargetFilter::getFilterValue).collect(Collectors.toList()));
-                    }else if (key == 2){
-                        policy.setBusinessLine(value.stream().map(f -> Integer.valueOf(f.getFilterValue())).collect(Collectors.toList()));
-                    }else if (key == 3){
-                        policy.setBusinessMethod(value.stream().map(ZtPolicyTargetFilter::getFilterValue).collect(Collectors.toList()));
-                    }else if (key == 4){
-                        List<String> optimizerIdStringList = value.stream().map(ZtPolicyTargetFilter::getFilterValue).collect(Collectors.toList());
-                        List<Long>  optimizerIdList = optimizerIdStringList.stream().map(Long::parseLong).collect(Collectors.toList());
-                        policy.setOptimizerId(optimizerIdList);
-                    }else if (key == 5){
-                        List<String> deptIdStringList = value.stream().map(ZtPolicyTargetFilter::getFilterValue).collect(Collectors.toList());
-                        List<Long> deptIdList = deptIdStringList.stream().map(Long::parseLong).collect(Collectors.toList());
-                        policy.setDeptId(deptIdList);
-                    }else if (key == 6){
-                        policy.setMovieId(value.stream().map(ZtPolicyTargetFilter::getFilterValue).collect(Collectors.toList()));
-                    }
-                }
-
-                Map<String, String> targetFromAdvertiserId = new HashMap<>();
-                List<String> rList = new ArrayList<>();
-                List<JSONObject> resIds = Collections.emptyList();
-                if (policy.getManagedDimension() == 1){
-                    resIds = ztPolicyConfigMapper.advFilterList(policy.getAppId(), policy.getBusinessLine(),
-                            policy.getBusinessMethod(), policy.getOptimizerId(), policy.getDeptId(), policy.getMovieId());
-                    for (JSONObject resId : resIds) {
-                        rList.add(resId.getString("advertiser_id"));
-                        targetFromAdvertiserId.put(resId.getString("advertiser_id"), resId.getString("advertiser_id"));
-                    }
-                }else if (policy.getManagedDimension() == 2){
-                    resIds = ztPolicyConfigMapper.adProjFilterList(policy.getAppId(), policy.getBusinessLine(),
-                            policy.getBusinessMethod(), policy.getOptimizerId(), policy.getDeptId(), policy.getMovieId());
-                    for (JSONObject resId : resIds) {
-                        rList.add(resId.getString("a_id"));
-                        targetFromAdvertiserId.put(resId.getString("a_id"), resId.getString("advertiser_id"));
-                    }
-                }else  if (policy.getManagedDimension() == 3){
-                    resIds = ztPolicyConfigMapper.adPromFilterList(policy.getAppId(), policy.getBusinessLine(),
-                            policy.getBusinessMethod(), policy.getOptimizerId(), policy.getDeptId(), policy.getMovieId());
-                    for (JSONObject resId : resIds) {
-                        rList.add(resId.getString("ad_id"));
-                        targetFromAdvertiserId.put(resId.getString("ad_id"), resId.getString("advertiser_id"));
-                    }
-                }
-                policy.setTargetResIds(rList);
-                policy.setTargetFromAdvertiserId(targetFromAdvertiserId);
-            }else {
-                List<ZtPolicyTargetIds> ids =  ztPolicyConfigMapper.getTargetIds(policyId);
-                policy.setTargetScopeIds(ids.stream().map(ZtPolicyTargetIds::getTargetId).collect(Collectors.toList()));
-
-                if (policy.getManagedDimension() == 1 && policy.getTargetScope() == 2){
-                    List<String> resIds = ztPolicyConfigMapper.advListFromAdvIds(policyId);
-                    policy.setTargetResIds(resIds);
-                }else if (policy.getManagedDimension() == 2 && policy.getTargetScope() == 2){
-                    List<JSONObject> resIds = ztPolicyConfigMapper.projectListFromAdvIds(policyId);
-                    List<String> rList = new ArrayList<>();
-                    Map<String, String> targetFromAdvertiserId = new HashMap<>();
-                    for (JSONObject resId : resIds) {
-                        rList.add(resId.getString("a_id"));
-                        targetFromAdvertiserId.put(resId.getString("a_id"), resId.getString("advertiser_id"));
-                    }
-                    policy.setTargetResIds(rList);
-                    policy.setTargetFromAdvertiserId(targetFromAdvertiserId);
-                }else if (policy.getManagedDimension() == 2 && policy.getTargetScope() == 3){
-                    List<JSONObject> resIds = ztPolicyConfigMapper.projectListFromProjIds(policyId);
-                    List<String> rList = new ArrayList<>();
-                    Map<String, String> targetFromAdvertiserId = new HashMap<>();
-                    for (JSONObject resId : resIds) {
-                        rList.add(resId.getString("a_id"));
-                        targetFromAdvertiserId.put(resId.getString("a_id"), resId.getString("advertiser_id"));
-                    }
-                    policy.setTargetResIds(rList);
-                    policy.setTargetFromAdvertiserId(targetFromAdvertiserId);
-                }else if (policy.getManagedDimension() == 3 && policy.getTargetScope() == 2){
-                    List<JSONObject> resIds = ztPolicyConfigMapper.adListFromAdvIds(policyId);
-                    List<String> rList = new ArrayList<>();
-                    Map<String, String> targetFromAdvertiserId = new HashMap<>();
-                    for (JSONObject resId : resIds) {
-                        rList.add(resId.getString("ad_id"));
-                        targetFromAdvertiserId.put(resId.getString("ad_id"), resId.getString("advertiser_id"));
-                    }
-                    policy.setTargetResIds(rList);
-                    policy.setTargetFromAdvertiserId(targetFromAdvertiserId);
-                }else if (policy.getManagedDimension() == 3 && policy.getTargetScope() == 4){
-                    List<JSONObject> resIds = ztPolicyConfigMapper.adListFromAdIds(policyId);
-                    List<String> rList = new ArrayList<>();
-                    Map<String, String> targetFromAdvertiserId = new HashMap<>();
-                    for (JSONObject resId : resIds) {
-                        rList.add(resId.getString("ad_id"));
-                        targetFromAdvertiserId.put(resId.getString("ad_id"), resId.getString("advertiser_id"));
-                    }
-                    policy.setTargetResIds(rList);
-                    policy.setTargetFromAdvertiserId(targetFromAdvertiserId);
-                }
-
-            }
-
-        }
-
-        for (ZtPolicyCondition condition : policy.getConditions()){
-            condition.setCompareValueJsonObject(JSON.parseObject(condition.getCompareValueJson()));
-        }
-        for (ZtPolicyAction action : policy.getActions()){
-            action.setActionRuleJsonObject(JSON.parseObject(action.getActionRuleJson()));
-        }
-        return policy;
-    }
-
-
-}

+ 0 - 43
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/AdminAdvertiserListJob.java

@@ -3,18 +3,13 @@ package cn.com.ctop.job.bytedance.handler;
 
 import cn.com.ctop.job.bytedance.data.service.IAdminAdvertiserListService;
 import cn.com.ctop.job.bytedance.data.utils.Check;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.google.common.collect.Lists;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.GetMapping;
 
-import java.util.ArrayList;
-import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -30,35 +25,6 @@ public class AdminAdvertiserListJob {
     @Autowired
     private IAdminAdvertiserListService adminAdvertiserListService;
     private static ExecutorService adminService = Executors.newFixedThreadPool(2);
-    private static ExecutorService agentExecutorService = Executors.newFixedThreadPool(3);
-
-
-    @XxlJob("agentData")
-    public void agentData() {
-        List<JSONObject> adminAdvertiserList = adminAdvertiserListService.getNotAgentAdvertiserList();
-
-        for (JSONObject adminAdvertiserJson : adminAdvertiserList) {
-            Long adminAdvertiserId = adminAdvertiserJson.getLong("adminAdvertiserId");
-            String accessToken = adminAdvertiserJson.getString("accessToken");
-            Long advertiserId = adminAdvertiserJson.getLong("advertiserId");
-            List<Long> ids = new ArrayList<>();
-            ids.add(advertiserId);
-            agentExecutorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    if (!Check.isNull(accessToken)) {
-                        try {
-                            adminAdvertiserListService.getAgentInfo(adminAdvertiserId, accessToken, ids);
-                        } catch (InterruptedException e) {
-                            throw new RuntimeException(e);
-                        }
-
-                    }
-                }
-            });
-
-        }
-    }
 
 
     @XxlJob("getAdminAdvertiserList")
@@ -92,13 +58,4 @@ public class AdminAdvertiserListJob {
     }
 
 
-    @XxlJob("batchUpdateAdvertiserName")
-    public void batchUpdateAdvertiserName() throws Exception {
-        List<JSONObject> infos = adminAdvertiserListService.getAdvertiserInfos();
-        if (!Check.isNull(infos)) {
-            adminAdvertiserListService.batchUpdateAdvertiserName(infos);
-        }
-    }
-
-
 }

+ 0 - 31
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BaiduYunJob.java

@@ -1,31 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-
-import cn.com.ctop.job.bytedance.data.service.IBytedanceRefreshTokenService;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-
-/**
- * 广告主定时任务
- *
- * @throws Exception
- */
-@Slf4j
-@Component
-public class BaiduYunJob {
-    @Autowired
-    private IBytedanceRefreshTokenService refreshTokenService;
-
-    /**
-     * 刷新百度云token
-     * https://pan.baidu.com/union/doc/al0rwqzzl
-     */
-    @XxlJob("refreshBaiduYunToken")
-    public void refreshBaiduYunToken() throws Exception {
-        refreshTokenService.refreshBaiduYunToken();
-    }
-
-}

+ 0 - 81
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceFlowDetailsReportJob.java

@@ -1,81 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-import cn.com.ctop.job.bytedance.data.enums.AccountTypeEnum;
-import cn.com.ctop.job.bytedance.data.mapper.BytedanceCdpProjectMapper;
-import cn.com.ctop.job.bytedance.data.service.IByteDanceFlowDetailsReportService;
-import cn.com.ctop.job.bytedance.data.utils.Check;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import com.alibaba.fastjson.JSONObject;
-import com.xxl.job.core.context.XxlJobHelper;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * @author lining
- * @ClassName ByteDanceFlowDetailsReportJob
- * @description: TODO
- * @date 2025年04月16日
- * @version: 1.0
- */
-@Slf4j
-@Component
-public class ByteDanceFlowDetailsReportJob {
-    @Autowired
-    private BytedanceCdpProjectMapper bytedanceCdpProjectMapper;
-
-    @Autowired
-    private IByteDanceFlowDetailsReportService byteDanceFlowDetailsReportService;
-
-    private static ExecutorService executorService = Executors.newFixedThreadPool(2);
-
-    @XxlJob("flowDetailsDaily")
-    public void flowDetailsDaily() throws Exception {
-        String param = XxlJobHelper.getJobParam(); // 执行参数
-        if (Check.isNull(param)) {
-            log.error("入参为空");
-            return;
-        }
-
-        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String data = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
-        String[] s = param.split("_");
-        Long advertiserId = Long.valueOf(s[0]);
-        String accessToken = s[1];
-
-        executorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                if (!Check.isNull(accessToken)) {
-                    byteDanceFlowDetailsReportService.getBytedanceFlowDetailsDailyReport(advertiserId, accessToken, AccountTypeEnum.AD.getValue(), data, data, 1, null);
-                }
-            }
-        });
-    }
-
-    @XxlJob("uniFlowDetailsDaily")
-    public void uniFlowDetailsDaily() throws Exception {
-        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String date = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
-
-        List<JSONObject> jsonObjects = bytedanceCdpProjectMapper.queryUniCostAdvertiserIds(date.replace("-", ""), date.replace("-", ""));
-        for (JSONObject jsonObject : jsonObjects) {
-            Long advertiserId = jsonObject.getLong("advertiser_id");
-            String accessToken = jsonObject.getString("access_token");
-
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    if (!Check.isNull(accessToken)) {
-                        byteDanceFlowDetailsReportService.getBytedanceFlowDetailsDailyReport(advertiserId, accessToken, AccountTypeEnum.AD.getValue(), date, date, 1, null);
-                    }
-                }
-            });
-        }
-    }
-}

+ 0 - 41
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAppletTokenRefreshJob.java

@@ -1,41 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-import cn.com.ctop.job.bytedance.data.service.BytedanceAppletTokenRefreshService;
-import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
-import com.xxl.job.core.context.XxlJobHelper;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-/**
- * 抖音小程序clientToke刷新
- */
-@Slf4j
-@Component
-public class BytedanceAppletTokenRefreshJob {
-
-    @Autowired
-    private BytedanceAppletTokenRefreshService tokenRefreshService;
-
-    private final String KEY = "bb3648b0b93f2f82135a6dac38dc418f808346a434";
-
-    @XxlJob("bytedanceAppletTokenRefreshJob")
-    public void bytedanceAppletTokenRefreshJob() {
-        log.info("[bytedanceAppletTokenRefreshJob] 任务开始");
-        try {
-            // 生成小程序token
-            tokenRefreshService.buildAppletTokens();
-        } catch (Exception e) {
-            XxlJobHelper.handleFail("[bytedanceAppletTokenRefreshJob] 异常 + " + e.getMessage());
-        }
-
-
-        //机器人预警,当抖音剧集episode_id不为空,platform_config中不包含episode_id时,预警
-        String url2 = "https://api.cms.artlinkworld.cn/thirtPartVideo/checkEpisodesIds";
-        HttpUtils.httpGet(String.format("%s?id=%s", url2, KEY), null, null);
-
-    }
-
-
-}

+ 0 - 204
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCdpProjectJob.java

@@ -1,204 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-
-import cn.com.ctop.job.bytedance.data.service.IBytedanceCdpProjectService;
-import cn.com.ctop.job.bytedance.data.utils.Check;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import com.alibaba.fastjson.JSONObject;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-
-/**
- * 拉取账户对应项目List
- */
-@Slf4j
-@Component
-public class BytedanceCdpProjectJob {
-
-    @Autowired
-    private IBytedanceCdpProjectService cdpProjectService;
-
-    private static ExecutorService allService = Executors.newFixedThreadPool(6);
-    private static ExecutorService allttService = Executors.newFixedThreadPool(2);
-    private static ExecutorService allwxService = Executors.newFixedThreadPool(2);
-    private static ExecutorService allt2Service = Executors.newFixedThreadPool(2);
-
-    private static ExecutorService projectExecutorService = Executors.newFixedThreadPool(3);
-    private static ExecutorService promExecutorService = Executors.newFixedThreadPool(3);
-    private static ExecutorService ttAppsExecutorService = Executors.newFixedThreadPool(3);
-    private static ExecutorService wxAppsExecutorService = Executors.newFixedThreadPool(3);
-    private static ExecutorService createiveAppsExecutorService = Executors.newFixedThreadPool(3);
-    private static ExecutorService pageAppsExecutorService = Executors.newFixedThreadPool(3);
-
-    @XxlJob("getAll")
-    public void getAll() {
-        log.info("[getAll] 任务启动...");
-        List<Long> ids = cdpProjectService.queryAllAdverIdList("");
-        if (!Check.isNull(ids)) {
-            log.info("总数:{}", ids.size());
-//            ids.forEach(id -> allService.submit(() -> cdpProjectService.getProjectList(id, null, null, null)));
-//            ids.forEach(id -> createiveAppsExecutorService.submit(() -> cdpProjectService.getAdqCreatives(id, "2025-07-09", "2025-07-09")));
-
-            List<String> days = DateUtils.getDays("2025-06-01", "2025-07-22");
-            for (String day : days) {
-                ids.forEach(id -> projectExecutorService.submit(() -> cdpProjectService.getProjectList(id, null, null, day,null,1)));
-                ids.forEach(id -> promExecutorService.submit(() -> cdpProjectService.getPromotionList(id, null, day,null,1)));
-            }
-        }
-    }
-
-    @XxlJob("errAppAgain")
-    public void errAppAgain() {
-        log.info("[errAppAgain] 任务启动...");
-        List<Long> ttList = cdpProjectService.queryErrApps("tt");
-        if (!Check.isNull(ttList)) {
-            if (cdpProjectService.delErrApps("tt"))
-                log.info("[errAppAgain] ---移除抖小失败记录");
-            ttList.forEach(id -> allttService.submit(() -> cdpProjectService.getByteAppInfo(id)));
-        }
-
-        List<Long> wxlist = cdpProjectService.queryErrApps("wx");
-        if (!Check.isNull(wxlist)) {
-            if (cdpProjectService.delErrApps("wx"))
-                log.info("[errAppAgain] ---移除微小失败记录");
-            wxlist.forEach(id -> allwxService.submit(() -> cdpProjectService.getWxAppInfo(id)));
-        }
-    }
-
-    @XxlJob("nowProjects")
-    public void nowProjects() {
-        log.info("[nowProjects] 任务启动...");
-        try {
-            //拉取今天数据
-            String today = DateUtils.getNowDate("yyyy-MM-dd");
-            List<Long> nowAdIds = cdpProjectService.queryAdvertiserIds("bytedance_advertiser_report_hour", DateUtils.getYYMMDDTime(today));
-            if (!Check.isNull(nowAdIds)) {
-                nowAdIds.forEach(id -> projectExecutorService.submit(() -> cdpProjectService.getProjectList(id, null, null, today,null,1)));
-                nowAdIds.forEach(id -> promExecutorService.submit(() -> cdpProjectService.getPromotionList(id, null, today,null,1)));
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("[nowProjects]" + e.getMessage());
-        }
-    }
-
-    @XxlJob("yesProjects")
-    public void yesProjects() {
-        log.info("[yesProjects] 任务启动...");
-        try {
-            //拉取昨天数据
-            String yesterday = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
-            List<Long> adIds = cdpProjectService.queryAdvertiserIds("bytedance_advertiser_report_daily", DateUtils.getYYMMDDTime(yesterday));
-            if (!Check.isNull(adIds)) {
-                adIds.forEach(id -> projectExecutorService.submit(() -> cdpProjectService.getProjectList(id, null, null, yesterday,null,1)));
-                adIds.forEach(id -> promExecutorService.submit(() -> cdpProjectService.getPromotionList(id, null, yesterday,null,1)));
-            }
-            //拉取前天数据
-            String yesterday2 = DateUtils.getNowAddDate("yyyy-MM-dd", -2);
-            List<Long> adIds2 = cdpProjectService.queryAdvertiserIds("bytedance_advertiser_report_daily", DateUtils.getYYMMDDTime(yesterday2));
-            if (!Check.isNull(adIds2)) {
-                adIds2.forEach(id -> projectExecutorService.submit(() -> cdpProjectService.getProjectList(id, null, null, yesterday2,null,1)));
-                adIds2.forEach(id -> promExecutorService.submit(() -> cdpProjectService.getPromotionList(id, null, yesterday2,null,1)));
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("[yesProjects]" + e.getMessage());
-        }
-    }
-
-    @XxlJob("nowApps")
-    public void nowApps() {
-        log.info("[nowApps] 任务启动...");
-        try {
-            String today = DateUtils.getNowDate("yyyy-MM-dd");
-            //BYTE_APP 字节小程序, WECHAT_APP:微信小程序
-            List<Long> ttList = cdpProjectService.queryMediaAdverIds(today, "BYTE_APP");
-            if (!Check.isNull(ttList)) {
-                ttList.forEach(id -> ttAppsExecutorService.submit(() -> cdpProjectService.getByteAppInfo(id)));
-            }
-            List<Long> wxlist = cdpProjectService.queryMediaAdverIds(today, "WECHAT_APP");
-            if (!Check.isNull(wxlist)) {
-                wxlist.forEach(id -> wxAppsExecutorService.submit(() -> cdpProjectService.getWxAppInfo(id)));
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("[nowApps]" + e.getMessage());
-        }
-    }
-
-    @XxlJob("yesApps")
-    public void yesApps() {
-        log.info("[yesApps] 任务启动...");
-        try {
-            //昨天
-            String yesterday = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
-            //BYTE_APP 字节小程序, WECHAT_APP:微信小程序
-            List<Long> ttList = cdpProjectService.queryMediaAdverIds(yesterday, "BYTE_APP");
-            if (!Check.isNull(ttList)) {
-                ttList.forEach(id -> ttAppsExecutorService.submit(() -> cdpProjectService.getByteAppInfo(id)));
-            }
-            List<Long> wxlist = cdpProjectService.queryMediaAdverIds(yesterday, "WECHAT_APP");
-            if (!Check.isNull(wxlist)) {
-                wxlist.forEach(id -> wxAppsExecutorService.submit(() -> cdpProjectService.getWxAppInfo(id)));
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("[yesApps]" + e.getMessage());
-        }
-    }
-
-
-    @XxlJob("nowDynamicCreateives")
-    public void nowDynamicCreateives() {
-        log.info("[nowDynamicCreateives] 任务启动...");
-        try {
-            //拉取今天数据
-            String today = DateUtils.getNowDate("yyyy-MM-dd");
-            List<Long> ids = cdpProjectService.queryAdvertiserIds("adq_advertiser_report_hour", DateUtils.getYYMMDDTime(today));
-            if (!Check.isNull(ids)) {
-                ids.forEach(id -> createiveAppsExecutorService.submit(() -> cdpProjectService.getAdqCreatives(id, today, today)));
-            }
-
-            List<JSONObject> iids = cdpProjectService.queryPageAdvertiserIds();
-            if (!Check.isNull(iids)) {
-                for (JSONObject iid : iids) {
-                    Long pageId = iid.getLong("page_id");
-                    Long advertiserId = iid.getLong("advertiser_id");
-                    pageAppsExecutorService.submit(() -> cdpProjectService.getAdqWechatPages(advertiserId, pageId));
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("[nowDynamicCreateives]" + e.getMessage());
-        }
-    }
-
-    @XxlJob("yesDynamicCreateives")
-    public void yesDynamicCreateives() {
-        log.info("[yesDynamicCreateives] 任务启动...");
-        try {
-            //拉取昨天数据
-            String yesterday = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
-            List<Long> ids = cdpProjectService.queryAdvertiserIds("adq_advertiser_report_daily", DateUtils.getYYMMDDTime(yesterday));
-            if (!Check.isNull(ids)) {
-                ids.forEach(id -> createiveAppsExecutorService.submit(() -> cdpProjectService.getAdqCreatives(id, yesterday, yesterday)));
-            }
-            //拉取前天数据
-            String yesterday2 = DateUtils.getNowAddDate("yyyy-MM-dd", -2);
-            List<Long> ids2 = cdpProjectService.queryAdvertiserIds("adq_advertiser_report_daily", DateUtils.getYYMMDDTime(yesterday2));
-            if (!Check.isNull(ids2)) {
-                ids2.forEach(id -> createiveAppsExecutorService.submit(() -> cdpProjectService.getAdqCreatives(id, yesterday2, yesterday2)));
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("[yesDynamicCreateives]" + e.getMessage());
-        }
-    }
-}

+ 0 - 37
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceMiniAppJob.java

@@ -1,37 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-
-import cn.com.ctop.job.bytedance.data.service.IBytedanceMiniAppService;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-
-@Slf4j
-@Component
-public class BytedanceMiniAppJob {
-    @Autowired
-    private IBytedanceMiniAppService bytedanceMiniAppService;
-
-    @XxlJob("yesterdayMaEcpm")
-    public void yesterdayMaEcpm() throws Exception {
-        List<String> iaaAppIds = bytedanceMiniAppService.getIaaAppIds();
-        for (String iaaAppId : iaaAppIds) {
-            String date = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
-            bytedanceMiniAppService.getMaEcpm(date, date, iaaAppId, 1, null, null);
-        }
-    }
-
-    @XxlJob("miniAppAdPlacement")
-    public void miniAppAdPlacement() throws Exception {
-        List<String> appIds = bytedanceMiniAppService.getAllAppIds();
-        for (String appId : appIds) {
-            bytedanceMiniAppService.getAdPlacement(appId);
-        }
-    }
-
-}

+ 0 - 41
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceProductUploadJob.java

@@ -1,41 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-import cn.com.ctop.job.bytedance.data.service.IBytedanceProductUpdateService;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Slf4j
-@Component
-public class BytedanceProductUploadJob {
-    @Autowired
-    IBytedanceProductUpdateService bytedanceProductUpdateService;
-
-    /**
-     * 创建和更新推广链
-     * @throws Exception
-     */
-    @XxlJob("productUploadJob")
-    public void productUploadJob() throws Exception {
-        bytedanceProductUpdateService.runMp();
-    }
-
-    /**
-     * 初始化推广链接用的字节小程序
-     */
-    @XxlJob("initProductLinkApp")
-    public void initProductLinkApp(){
-        bytedanceProductUpdateService.initNew();
-    }
-
-    @XxlJob("bytedanceProductUploadAlbum")
-    public void uploadAlbum() throws Exception {
-        bytedanceProductUpdateService.uploadAlbum();
-    }
-
-    @XxlJob("bytedanceProductRefreshAlbumStatus")
-    public void refreshAlbumStatus() throws Exception {
-        bytedanceProductUpdateService.refreshAlbumStatus();
-    }
-}

+ 0 - 112
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePromoterReportJob.java

@@ -2,18 +2,14 @@ package cn.com.ctop.job.bytedance.handler;
 
 
 import cn.com.ctop.job.bytedance.data.service.IBytedanceMaterialReportService;
-import cn.com.ctop.job.bytedance.data.service.IBytedanceProductReportService;
-import cn.com.ctop.job.bytedance.data.service.IBytedancePromoterReportService;
 import cn.com.ctop.job.bytedance.data.utils.Check;
 import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import com.alibaba.fastjson.JSONObject;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -27,106 +23,11 @@ import java.util.concurrent.Executors;
 @Component
 public class BytedancePromoterReportJob {
     @Autowired
-    private IBytedanceProductReportService productReportService;
-    @Autowired
-    private IBytedancePromoterReportService promoterReportService;
-    @Autowired
     private IBytedanceMaterialReportService bytedanceMaterialReportService;
 
     private static ExecutorService dailyExecutorService = Executors.newFixedThreadPool(8);
-    private static ExecutorService hourExecutorService = Executors.newFixedThreadPool(4);
-    private static ExecutorService productDailyExecutor = Executors.newFixedThreadPool(2);
-
-
-    @XxlJob("yesHourPromoterReport")
-    public void yesHourPromoterReport() throws Exception {
-        String param = XxlJobHelper.getJobParam(); // 执行参数
-        if (Check.isNull(param)) {
-            log.error("入参为空");
-            return;
-        }
-
-        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String date = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
-        String[] s = param.split("_");
-        Long advertiserId = Long.valueOf(s[0]);
-        String accessToken = s[1];
-        hourExecutorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                promoterReportService.getBytedancePromoterHour(advertiserId, accessToken, date, date, 1, 1);
-            }
-        });
-    }
 
 
-    @XxlJob("yesReportPromoterReport")
-    public void yesReportPromoterReport() throws Exception {
-        String param = XxlJobHelper.getJobParam(); // 执行参数
-        if (Check.isNull(param)) {
-            log.error("入参为空");
-            return;
-        }
-
-        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String data = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
-        String[] s = param.split("_");
-        Long advertiserId = Long.valueOf(s[0]);
-        String accessToken = s[1];
-
-        dailyExecutorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                promoterReportService.getBytedancePromoterDaily(advertiserId, accessToken, data, data, 1, 1);
-            }
-        });
-    }
-
-    @XxlJob("productReport")
-    public void productReport() throws Exception {
-        String param = XxlJobHelper.getJobParam(); // 执行参数
-        if (Check.isNull(param)) {
-            log.error("入参为空");
-            return;
-        }
-
-        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String data = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
-        String[] s = param.split("_");
-        Long advertiserId = Long.valueOf(s[0]);
-        String accessToken = s[1];
-
-        productDailyExecutor.submit(new Runnable() {
-            @Override
-            public void run() {
-                productReportService.deleteBytedanceProductDailyReport(advertiserId, data, data);
-                productReportService.getBytedanceProductDailyReport(advertiserId, accessToken, data, data, 1, null, 1, null);
-            }
-        });
-    }
-
-
-    @XxlJob("ltv3ReportPromoterReport")
-    public void ltv3ReportPromoterReport() throws Exception {
-        String param = XxlJobHelper.getJobParam(); // 执行参数
-        if (Check.isNull(param)) {
-            log.error("入参为空");
-            return;
-        }
-        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String end = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
-        String start = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -4);
-        String[] s = param.split("_");
-        Long advertiserId = Long.valueOf(s[0]);
-        String accessToken = s[1];
-        dailyExecutorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                promoterReportService.getBytedancePromoterDaily(advertiserId, accessToken, start, end, 1, 1);
-            }
-        });
-    }
-
     @XxlJob("yesMaterialReportDaily")
     public void yesMaterialReportDaily() throws Exception {
         String param = XxlJobHelper.getJobParam(); // 执行参数
@@ -149,18 +50,5 @@ public class BytedancePromoterReportJob {
         });
     }
 
-    @XxlJob("todayMaterialVideoGet")
-    public void materialVideoGet() throws Exception {
-        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String date = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
-        List<JSONObject> costAccount = productReportService.getCostAccount(null, nowDate, nowDate);
-        for (JSONObject jsonObject : costAccount) {
-            dailyExecutorService.submit(() -> {
-                Long adverId = jsonObject.getLong("advertiserId");
-                bytedanceMaterialReportService.getBytedanceMaterialVideo(adverId, null, date, nowDate, 1, null, 1, 0, 1);
-            });
-        }
-    }
-
 
 }

+ 0 - 10
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceRefreshTokenJob.java

@@ -25,14 +25,4 @@ public class BytedanceRefreshTokenJob {
     }
 
 
-    @XxlJob("refreshAppletTokens")
-    public void refreshAppletTokens() {
-        try {
-            bytedanceRefreshTokenService.refreshAppletTokens();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-
 }

+ 1 - 165
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceReportRetryJob.java

@@ -98,55 +98,7 @@ public class BytedanceReportRetryJob {
                 if (Check.isNull(accessToken)) {
                     continue;
                 }
-                if ("custom".equals(dataDimension)) {
-                    dailyPromoterRetrExecutorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            customReportService.getCustomReport(dataType, advertiserId, accessToken, startDate, endDate, 0, id);
-                        }
-                    });
-                } else if ("uni_project_list".equals(dataDimension)) {
-                    dailyPromoterRetrExecutorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            cdpProjectService.getUniProjectList(advertiserId, null, null, null, null, id, 0);
-                        }
-                    });
-                } else if ("uni_project_material".equals(dataDimension)) {
-                    JSONObject msgObject = JSONObject.parseObject(msg);
-                    String materialType = msgObject.getString("material_type");
-                    Long projectId = msgObject.getLong("project_id");
-                    dailyPromoterRetrExecutorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            cdpProjectService.getOcProjectMaterial(materialType, advertiserId, projectId, id, 0);
-                        }
-                    });
-                } else if ("promoter".equals(dataDimension)) {
-                    if (dataType.equals("hour")) { // 广告时报
-                        hourPromoterRetrExecutorService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                promoterReportService.getBytedanceRetryPromoterHourReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
-                            }
-                        });
-                    }
-                    if (dataType.equals("daily")) { // 广告日报
-                        dailyPromoterRetrExecutorService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                promoterReportService.getBytedancePromoterRetryDailyReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
-                            }
-                        });
-                    }
-                } else if ("product".equals(dataDimension)) {
-                    productDailyRetrExecutor.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            productReportService.getBytedanceProductDailyReport(advertiserId, accessToken, startDate, endDate, 1, id, null, isSend);
-                        }
-                    });
-                } else if ("account".equals(dataDimension)) {
+                if ("account".equals(dataDimension)) {
                     if (dataType.equals("hour")) { // 账户时报
                         hourAccountRetrExecutorService.submit(new Runnable() {
                             @Override
@@ -213,122 +165,6 @@ public class BytedanceReportRetryJob {
         }
 
 
-        List<JSONObject> changDuRetry = channelService.getChangDuRetry();
-        if (!Check.isNull(changDuRetry)) {
-            for (int i = 0; i < changDuRetry.size(); i++) {
-                JSONObject jsonObject = changDuRetry.get(i);
-                Long id = jsonObject.getLong("id");
-                String startDate = jsonObject.getString("startDate");
-                String endDate = jsonObject.getString("endDate");
-                String dataDimension = jsonObject.getString("dataDimension");
-                //String dataType = jsonObject.getString("dataType");
-                Integer isSend = jsonObject.getInteger("isSend");
-                String channelAccountId = jsonObject.getString("channelAccountId");
-                String secretKey = jsonObject.getString("secretKey");
-                String appId = jsonObject.getString("channelAppId");
-                String appName = jsonObject.getString("channelAppName");
-                if ("changdu_order".equals(dataDimension)) {
-                    changduExecutorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            channelService.getOrderList(startDate, endDate, appId, appName, channelAccountId, secretKey, 1, id, isSend);
-                        }
-                    });
-                }
-            }
-        } else {
-            log.info("常读重试列表为空");
-        }
-
-        List<JSONObject> maEcpmRetryJob = miniAppService.getMaEcpmRetryJob();
-        if (!Check.isNull(maEcpmRetryJob)) {
-            for (int i = 0; i < maEcpmRetryJob.size(); i++) {
-                JSONObject jsonObject = maEcpmRetryJob.get(i);
-                Long id = jsonObject.getLong("id");
-                String startDate = jsonObject.getString("startDate");
-                String endDate = jsonObject.getString("endDate");
-                String dataDimension = jsonObject.getString("dataDimension");
-                Integer isSend = jsonObject.getInteger("isSend");
-                if (dataDimension != null && dataDimension.startsWith("ma_ecpm:")) {
-                    String appId = dataDimension.split(":")[1];
-                    changduExecutorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            miniAppService.getMaEcpm(startDate, endDate, appId, 0, id, isSend);
-                        }
-                    });
-                }
-            }
-        } else {
-            log.info("抖小IAA重试列表为空");
-        }
-
-        List<JSONObject> xingTuRetryJob = bytedanceXingTuService.getXingTuRetryJob();
-        if (!Check.isNull(xingTuRetryJob)) {
-            for (int i = 0; i < xingTuRetryJob.size(); i++) {
-                JSONObject jsonObject = xingTuRetryJob.get(i);
-                Long id = jsonObject.getLong("id");
-                Long advertiserId = jsonObject.getLong("advertiserId");
-                String startDate = jsonObject.getString("startDate");
-                String endDate = jsonObject.getString("endDate");
-                String dataDimension = jsonObject.getString("dataDimension");
-                Integer isSend = jsonObject.getInteger("isSend");
-                String accessToken = jsonObject.getString("accessToken");
-                if ("xingtu_task_list".equalsIgnoreCase(dataDimension)) {
-                    xingTuExecutorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            bytedanceXingTuService.getXingTuTaskList(advertiserId, accessToken, startDate, endDate, 1, id, null, isSend);
-                        }
-                    });
-                } else if ("xingtu_task_info".equalsIgnoreCase(dataDimension)) {
-                    Long taskId = jsonObject.getJSONObject("msg").getLong("taskId");
-                    xingTuExecutorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            bytedanceXingTuService.getXingTuTaskInfo(advertiserId, taskId, accessToken, id, null, isSend);
-                        }
-                    });
-                } else if ("xingtu_task_report".equalsIgnoreCase(dataDimension)) {
-                    Long taskId = jsonObject.getJSONObject("msg").getLong("taskId");
-                    xingTuExecutorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            bytedanceXingTuService.getXingTuTaskReport(advertiserId, taskId, accessToken, 1, id, null, isSend);
-                        }
-                    });
-                }
-            }
-        } else {
-            log.info("巨量星图重试列表为空");
-        }
-
-        List<JSONObject> dzRetry = dianZhongService.getDZRetry();
-        if (!Check.isNull(dzRetry)) {
-            for (int i = 0; i < dzRetry.size(); i++) {
-                JSONObject jsonObject = dzRetry.get(i);
-                Long id = jsonObject.getLong("id");
-                String clientId = jsonObject.getString("advertiserId");
-                String startDate = jsonObject.getString("startDate");
-                String endDate = jsonObject.getString("endDate");
-                String dataDimension = jsonObject.getString("dataDimension");
-                String dataType = jsonObject.getString("dataType");
-                String token = dianZhongConfig.getToken(clientId);
-                if ("dianzhong_url".equals(dataDimension)) {
-                    changduExecutorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            if (!Check.isNull(token)) {
-                                dianZhongService.getDownloadUrl(dataType, clientId, token, startDate, endDate, id, false);
-                            }
-                        }
-                    });
-                }
-            }
-        } else {
-            log.info("点众重试列表为空");
-        }
-
     }
 
 

+ 0 - 32
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceTestJob.java

@@ -1,32 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
-
-
-
-/**
- * 广告主定时任务
- *
- * @throws Exception
- */
-@Slf4j
-@Component
-public class BytedanceTestJob {
-
-
-    /**
-     * 获取广告主日报-遗漏数据补充
-     *
-     * @throws Exception
-     */
-    @XxlJob("testJob")
-    public void testJob() throws Exception {
-        System.err.println("定时任务调用成功了");
-
-    }
-
-
-}

+ 0 - 79
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceUniProjectJob.java

@@ -1,79 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-import cn.com.ctop.job.bytedance.data.mapper.BytedanceCdpProjectMapper;
-import cn.com.ctop.job.bytedance.data.service.IBytedanceCdpProjectService;
-import cn.com.ctop.job.bytedance.data.service.ICustomReportService;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import com.alibaba.fastjson.JSONObject;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * 全域
- */
-@Slf4j
-@Component
-public class BytedanceUniProjectJob {
-    @Autowired
-    private BytedanceCdpProjectMapper bytedanceCdpProjectMapper;
-    @Autowired
-    private ICustomReportService customReportService;
-    @Autowired
-    private IBytedanceCdpProjectService cdpProjectService;
-    private static final ExecutorService projectExecutorService = Executors.newFixedThreadPool(6);
-
-    @XxlJob("yesterdayUniReportDaily")
-    public void getYesterdayUniReportDaily() {
-        String yesterday = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
-        List<JSONObject> jsonObjects = bytedanceCdpProjectMapper.queryUniCostAdvertiserIds(yesterday.replace("-", ""), yesterday.replace("-", ""));
-        for (JSONObject jsonObject : jsonObjects) {
-            Long advertiserId = jsonObject.getLong("advertiser_id");
-            String access_token = jsonObject.getString("access_token");
-            projectExecutorService.submit(() -> customReportService.getCustomReport("uni_project_daily", advertiserId, access_token, yesterday, yesterday, 1, null));
-            projectExecutorService.submit(() -> customReportService.getCustomReport("uni_project_material_daily", advertiserId, access_token, yesterday, yesterday, 1, null));
-        }
-
-    }
-
-    @XxlJob("yesterdayUniProjectList")
-    public void getYesterdayUniProjectList() {
-        String yesterday = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
-        List<JSONObject> jsonObjects = bytedanceCdpProjectMapper.queryUniCostProjectIds(yesterday.replace("-", ""), yesterday.replace("-", ""));
-        HashSet<Long> submitAdvertiserIds = new HashSet<>();
-        for (JSONObject jsonObject : jsonObjects) {
-            Long advertiserId = jsonObject.getLong("advertiser_id");
-            Long projectId = jsonObject.getLong("cdp_project_id");
-            projectExecutorService.submit(() -> cdpProjectService.getOcProjectMaterial("OTHER", advertiserId, projectId, null, 1));
-            if (!submitAdvertiserIds.contains(advertiserId)) {
-                submitAdvertiserIds.add(advertiserId);
-                projectExecutorService.submit(() -> cdpProjectService.getUniProjectList(advertiserId, null, null, null, null, null, 1));
-            }
-        }
-
-    }
-
-    @XxlJob("todayUniProjectList")
-    public void getTodayUniProjectList() {
-        String today = DateUtils.getToday();
-        List<JSONObject> jsonObjects = bytedanceCdpProjectMapper.queryUniCostProjectIds(today.replace("-", ""), today.replace("-", ""));
-        HashSet<Long> submitAdvertiserIds = new HashSet<>();
-        for (JSONObject jsonObject : jsonObjects) {
-            Long advertiserId = jsonObject.getLong("advertiser_id");
-            Long projectId = jsonObject.getLong("cdp_project_id");
-            projectExecutorService.submit(() -> cdpProjectService.getOcProjectMaterial("OTHER", advertiserId, projectId, null, 1));
-            if (!submitAdvertiserIds.contains(advertiserId)) {
-                submitAdvertiserIds.add(advertiserId);
-                projectExecutorService.submit(() -> cdpProjectService.getUniProjectList(advertiserId, null, null, null, null, null, 1));
-            }
-        }
-
-    }
-
-}

+ 0 - 73
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceXingTuJob.java

@@ -1,73 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-
-import cn.com.ctop.job.bytedance.data.service.IBytedanceXingTuService;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import com.alibaba.fastjson.JSONObject;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-
-@Slf4j
-@Component
-public class BytedanceXingTuJob {
-    private static final ExecutorService executorService = Executors.newFixedThreadPool(4);
-    @Autowired
-    private IBytedanceXingTuService bytedanceXingTuService;
-
-    @XxlJob("xingTuTaskList")
-    public void taskList() {
-        String startDate = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
-        String endDate = DateUtils.getNowDate("yyyy-MM-dd");
-        List<JSONObject> xingTuAccount = bytedanceXingTuService.getXingTuAccount(null);
-        for (JSONObject jsonObject : xingTuAccount) {
-            Long advId = jsonObject.getLong("advertiser_id");
-            String accessToken = jsonObject.getString("access_token");
-            bytedanceXingTuService.getXingTuTaskList(advId, accessToken, startDate, endDate, 1, null, 1, null);
-            bytedanceXingTuService.getXingTuChallengeList(advId, accessToken, 1);
-        }
-
-    }
-
-    @XxlJob("xingTuTaskInfo")
-    public void taskInfo() {
-        List<JSONObject> xingTuTasks = bytedanceXingTuService.getXingTuActiveTask(null);
-        for (JSONObject taskJson : xingTuTasks) {
-            Long advId = taskJson.getLong("advertiser_id");
-            Long taskId = taskJson.getLong("task_id");
-            String accessToken = taskJson.getString("access_token");
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    bytedanceXingTuService.getXingTuTaskInfo(advId, taskId, accessToken, null, 1, null);
-                }
-            });
-        }
-
-    }
-
-    @XxlJob("xingTuTaskReport")
-    public void taskReport() {
-        List<JSONObject> xingTuTasks = bytedanceXingTuService.getXingTuReportTask(null);
-        for (JSONObject taskJson : xingTuTasks) {
-            Long advId = taskJson.getLong("advertiser_id");
-            Long taskId = taskJson.getLong("task_id");
-            String accessToken = taskJson.getString("access_token");
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    bytedanceXingTuService.getXingTuTaskReport(advId, taskId, accessToken, 1, null, 1, null);
-                }
-            });
-        }
-
-    }
-
-
-}

+ 0 - 55
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/CLMaterialTaskJob.java

@@ -1,55 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-
-import cn.com.ctop.job.bytedance.data.service.IBytedanceAccountReportService;
-import cn.com.ctop.job.bytedance.data.service.IClTaskStatusService;
-import cn.com.ctop.job.bytedance.data.utils.Check;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import com.alibaba.fastjson.JSONObject;
-import com.xxl.job.core.context.XxlJobHelper;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-
-/**
- * 广告主定时任务
- *
- * @throws Exception
- */
-@Slf4j
-@Component
-public class CLMaterialTaskJob {
-    @Autowired
-    private IBytedanceAccountReportService accountReportService;
-
-    @Autowired
-    private IClTaskStatusService clTaskStatusService;
-
-
-    /**
-     * 账户时报
-     *
-     * @throws Exception
-     */
-
-    @XxlJob("clTaskStatus")
-    public void clTaskStatus() throws Exception {
-        List<JSONObject> taskList = clTaskStatusService.getClTaskListByStatus("0");
-        if (!Check.isNull(taskList)) {
-            for (int i = 0; i < taskList.size(); i++) {
-                JSONObject jsonObject = taskList.get(i);
-                Long id = jsonObject.getLong("id");
-                String batchId = jsonObject.getString("batch_id");
-                clTaskStatusService.downLoadTaskResult(id, batchId);
-            }
-        }
-    }
-
-
-}

+ 0 - 72
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/CPSReportJob.java

@@ -1,72 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-
-import cn.com.ctop.job.bytedance.data.service.ICPSReportService;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-
-/**
- * thirtpart.cps_link_data_report
- */
-@Slf4j
-@Component
-public class CPSReportJob {
-    @Autowired
-    private ICPSReportService cpsReportService;
-
-    /**
-     * 清洗CPS报表
-     */
-    @XxlJob("dayCleanCPSDailyReports")
-    public void dayCleanCPSDailyReports() throws Exception {
-        log.info("[dayCleanCPSDailyReports] 任务启动...");
-        try {
-            String nowDate = DateUtils.getNowDate("yyyyMMdd");
-            cpsReportService.cleanCPSDailyReports(nowDate);
-            log.info("[dayCleanCPSDailyReports] 任务完成");
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error(e.getMessage());
-        }
-    }
-
-    /**
-     * 清洗CPS报表
-     */
-    @XxlJob("yesCleanCPSDailyReports")
-    public void yesCleanCPSDailyReports() throws Exception {
-        log.info("[yesCleanCPSDailyReports] 任务启动...");
-        try {
-            String nowDate = DateUtils.getNowDate("yyyyMMdd");
-            String yesterday = DateUtils.getNowAddDate("yyyyMMdd", -1);
-            cpsReportService.cleanCPSDailyReports(yesterday);
-            log.info("[yesCleanCPSDailyReports] 任务完成");
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error(e.getMessage());
-        }
-    }
-
-
-    @XxlJob("runCPSIapSettlementData")
-    public void runCPSIapSettlementData() throws Exception {
-        log.info("[runCPSIapSettlementData] 任务启动...");
-        try {
-            String nowDate = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
-            cpsReportService.runCPSSettlementData(nowDate);
-            nowDate = DateUtils.getNowAddDate("yyyy-MM-dd", -2);
-            cpsReportService.runCPSSettlementData(nowDate);
-            nowDate = DateUtils.getNowAddDate("yyyy-MM-dd", -3);
-            cpsReportService.runCPSSettlementData(nowDate);
-            log.info("[runCPSIapSettlementData] 任务完成");
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error(e.getMessage());
-        }
-    }
-
-}

+ 0 - 65
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ChangDuJob.java

@@ -1,65 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-
-import cn.com.ctop.job.bytedance.data.service.IBytedancePromoterReportService;
-import cn.com.ctop.job.bytedance.data.service.IChannelService;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import com.alibaba.fastjson.JSONObject;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-@Slf4j
-@Component
-public class ChangDuJob {
-    @Autowired
-    private IBytedancePromoterReportService promoterReportService;
-    @Autowired
-    private IChannelService channelService;
-
-    /**
-     * 番茄数据拉取
-     */
-    @XxlJob("getPromoterList")
-    public void getPromoterList() throws Exception {
-        List<JSONObject> channelList = channelService.getChannelInfoList();
-        for (int i = 0; i < channelList.size(); i++) {
-            JSONObject jsonObject = channelList.get(i);
-            String channelAccountId = jsonObject.getString("channelAccountId");
-            String secretKey = jsonObject.getString("secretKey");
-            String startDate = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
-            String endDate = DateUtils.getNowDate("yyyy-MM-dd");
-            channelService.getPromotionIdList(startDate, endDate, channelAccountId, secretKey, 0);
-        }
-    }
-
-    @XxlJob("changDuOrder")
-    public void changDuOrder() throws Exception {
-        List<JSONObject> channelList = channelService.getChannelInfoList();
-        for (int i = 0; i < channelList.size(); i++) {
-            JSONObject jsonObject = channelList.get(i);
-            String channelAccountId = jsonObject.getString("channelAccountId");
-            String secretKey = jsonObject.getString("secretKey");
-            String appId = jsonObject.getString("channelAppId");
-            String appName = jsonObject.getString("channelAppName");
-            String date = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
-            channelService.getOrderList(date, date, appId, appName, channelAccountId, secretKey, 1, null, null);
-        }
-    }
-
-    @XxlJob("distributorConfig")
-    public void distributorConfig() {
-        channelService.getDistributorConfig();
-    }
-
-    @XxlJob("syncMovieId")
-    public void syncMovieId() {
-        String startDate = DateUtils.getNowAddDate("yyyy-MM-dd", -1);
-        String endDate = DateUtils.getNowDate("yyyy-MM-dd");
-        channelService.syncMovieId(startDate, endDate);
-    }
-
-}

+ 0 - 23
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/DeepthinkHealthCheckJob.java

@@ -1,23 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-import cn.com.ctop.job.bytedance.data.service.IHealthCheckService;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Slf4j
-@Component
-public class DeepthinkHealthCheckJob {
-    @Autowired
-    IHealthCheckService healthCheckService;
-
-    @XxlJob("deepthinkHealthCheckJob")
-    public void deepthinkHealthCheckJob(){
-        try {
-            healthCheckService.check();
-        } catch (Exception e) {
-            log.error("DeepthinkHealthCheckJob error: ", e);
-        }
-    }
-}

+ 0 - 55
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/DianZhongJob.java

@@ -1,55 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-
-import cn.com.ctop.job.bytedance.config.DianZhongConfig;
-import cn.com.ctop.job.bytedance.data.service.IDianZhongService;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-@Slf4j
-@Component
-public class DianZhongJob {
-    @Autowired
-    private IDianZhongService dianZhongService;
-
-    @Resource
-    private DianZhongConfig dianZhongConfig;
-
-    /**
-     * 获取点众IAP数据url
-     */
-    @XxlJob("dzDownloadUrl")
-    public void dzDownloadUrl() {
-        List<DianZhongConfig.DZConfig> dzConfig = dianZhongConfig.getDzConfig();
-        for (DianZhongConfig.DZConfig config : dzConfig) {
-            if ("iaa".equals(config.getType())) {
-                continue;
-            }
-            String statDate = DateUtils.dateAddByType(new Date(), -10, Calendar.MINUTE, "yyyy-MM-dd");
-            String clientId = config.getClientId();
-            String token = config.getToken();
-            String queryStartTime = DateUtils.getQueryStartTime(statDate, "yyyy-MM-dd HH:mm:ss", false);
-            String queryEndTime = DateUtils.getQueryEndTime(statDate, "yyyy-MM-dd HH:mm:ss", false);
-            dianZhongService.getDownloadUrl("user", clientId, token, queryStartTime, queryEndTime, null, true);
-            dianZhongService.getDownloadUrl("order", clientId, token, queryStartTime, queryEndTime, null, true);
-        }
-    }
-
-    /**
-     * 点众IAP数据下载
-     */
-    @XxlJob("dzUrlData")
-    public void dzUrlData() {
-        String statDate = DateUtils.dateAddByType(new Date(), -10, Calendar.MINUTE, "yyyy-MM-dd");
-        dianZhongService.getUrlData(statDate);
-    }
-
-}

+ 0 - 35
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/DianzhongConfigJob.java

@@ -1,35 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-import cn.com.ctop.job.bytedance.data.service.IDianzhongConfigService;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.io.IOException;
-
-@Slf4j
-@Component
-public class DianzhongConfigJob {
-    @Autowired
-    IDianzhongConfigService dianzhongConfigService;
-
-    @XxlJob("pullDianzhongChannel")
-    public void pullDianzhongChannel(){
-        dianzhongConfigService.pullChannelInfo();
-    }
-
-    @XxlJob("pullDianzhongMovie")
-    public void pullDianzhongMovie() throws IOException {
-        try {
-            dianzhongConfigService.pullMovie();
-        }catch (Exception e){
-            log.error("点众短剧同步失败", e);
-        }
-    }
-
-    @XxlJob("pullDianzhongPromoteList")
-    public void pullDianzhongPromoteList(){
-        dianzhongConfigService.syncPromoteLinkInfo();
-    }
-}

+ 0 - 113
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/PromoteLinkRefreshJob.java

@@ -1,113 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-import cn.com.ctop.job.bytedance.data.service.IBytedancePromoteRefreshService;
-
-import cn.com.ctop.job.bytedance.data.utils.Check;
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
-import com.alibaba.fastjson.JSONObject;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-@Slf4j
-@Component
-public class PromoteLinkRefreshJob {
-
-    private static ExecutorService linkRefreshExecutorService = Executors.newFixedThreadPool(5);
-    @Autowired
-    IBytedancePromoteRefreshService bytedancePromoteRefreshService;
-
-    @XxlJob("promoteLinkRefreshJob")
-    public void promoteLinkRefreshJob() throws IOException {
-        List<JSONObject> list = bytedancePromoteRefreshService.getRefreshList();
-
-        if (Check.isNull(list) || list.isEmpty()) {
-            return; // 没有需要刷新的链接
-        }
-
-        List<Future<String>> failMessages = new ArrayList<>();
-        for (JSONObject obj : list){
-            Future<String> failMessage = linkRefreshExecutorService.submit(() -> {
-                try {
-                    JSONObject response = bytedancePromoteRefreshService.refreshLink(obj);
-                    if (response.getInteger("code") != 0) {
-                        log.error("刷新链接失败: " + response.getString("msg"));
-                        return response.getString("msg");
-                    }
-                } catch (Exception e) {
-                    log.error("刷新链接时发生异常: " + e.getMessage(), e);
-                    String msg = e.getMessage();
-                    if (msg.length() > 100){
-                        msg = msg.substring(0, 100) + "...";
-                    }
-                    return "刷新链接时发生异常: " + msg;
-                }
-                return "";
-            });
-            failMessages.add(failMessage);
-        }
-    }
-
-    @XxlJob("runAdvertiserTaskStatus")
-    public void runAdvertiserTaskStatusJob() throws IOException {
-        try {
-            // 生成当前时间三小时前的时间字符串(格式:yyyy-MM-dd HH:mm:ss)
-            java.util.Calendar cal = java.util.Calendar.getInstance();
-            cal.add(java.util.Calendar.HOUR_OF_DAY, -1);
-            String startTime = DateUtils.formatDate(cal.getTime(), "yyyy-MM-dd HH:mm:ss");
-            String endTime = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
-            log.info("startTime: " + startTime + ", endTime: " + endTime);
-
-            bytedancePromoteRefreshService.runAdvertiserTaskStatus(startTime, endTime);
-        }catch (Exception e){
-            log.error("批量开户执行状态更新任务-失败", e);
-        }
-    }
-
-    /**
-     * runAdvertiserTaskStatus任务未正常运行时,恢复历史数据用
-     */
-    public void runHistoryAdvertiserTaskStatus(){
-        //恢复数据
-        // 生成从 2025-04-01 开始的 2 天窗口,直到 2026-01-04(end 不超过 2026-01-04 23:59:59)
-        java.time.LocalDate endLimitDate = java.time.LocalDate.of(2026, 1, 1);
-        java.time.LocalDateTime endLimit = endLimitDate.atTime(23, 59, 59);
-
-        // 初始 start 日
-        java.time.LocalDate current = java.time.LocalDate.of(2025, 4, 1);
-
-        while (true) {
-            java.time.LocalDateTime startDateTime = current.atStartOfDay(); // 当天 00:00:00
-            java.time.LocalDateTime endDateTime = current.plusDays(1).atTime(23, 59, 59); // 下一天 23:59:59
-
-            // 若计算出的 end 超过限制,截断到限制时间
-            if (endDateTime.isAfter(endLimit)) {
-                endDateTime = endLimit;
-            }
-
-            // 将时间格式化为 "yyyy-MM-dd HH:mm:ss"
-            String startTime = startDateTime.format(cn.com.ctop.job.bytedance.data.utils.DateUtils.FORMATTER_DATETIME_SECOND);
-            String endTime = endDateTime.format(cn.com.ctop.job.bytedance.data.utils.DateUtils.FORMATTER_DATETIME_SECOND);
-
-            // 使用 startTime / endTime 做你需要的操作(示例:打印或调用方法)
-            System.out.println("startTime=" + startTime + ", endTime=" + endTime);
-            bytedancePromoteRefreshService.runAdvertiserTaskStatus(startTime, endTime);
-            // 例: cpsReportService.runCPSSettlementDataRange(startTime, endTime);
-
-            // 如果已经到达或超过限制,就退出
-            if (!current.plusDays(1).isBefore(endLimitDate)) { // 若 current+1 >= endLimitDate,说明已达到最后一段
-                break;
-            }
-
-            // 步进 2 天
-            current = current.plusDays(2);
-        }
-    }
-}

+ 0 - 135
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ToolsSiteJob.java

@@ -1,135 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-
-import cn.com.ctop.job.bytedance.data.service.IToolsSiteService;
-import cn.com.ctop.job.bytedance.data.utils.Check;
-import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
-import com.alibaba.fastjson.JSONObject;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-
-/**
- * 批量搭建 各状态更新
- */
-@Slf4j
-@Component
-public class ToolsSiteJob {
-    @Autowired
-    private IToolsSiteService toolsSiteService;
-
-    private static ExecutorService avatarExecutorService = Executors.newFixedThreadPool(3);
-    private static ExecutorService nameExecutorService = Executors.newFixedThreadPool(3);
-    private static ExecutorService appExecutorService = Executors.newFixedThreadPool(3);
-    private static ExecutorService wxappExecutorService = Executors.newFixedThreadPool(3);
-    private static ExecutorService ttappExecutorService = Executors.newFixedThreadPool(3);
-    private static ExecutorService siteExecutorService = Executors.newFixedThreadPool(3);
-
-    @XxlJob("getToolsSiteList")
-    public void getToolsSiteList() throws Exception {
-        log.info("[批量创建,各状态更新] 任务启动...");
-//        String param = XxlJobHelper.getJobParam(); // 执行参数
-//        if (Check.isNull(param)) {
-//            log.error("入参为空");
-//            return;
-//        }
-        //头像待更新的广告主id集
-        List<Long> avatarIds = toolsSiteService.getAvatarAdvertiserIds();
-        if (!Check.isNull(avatarIds)) {
-            avatarIds.forEach(id -> avatarExecutorService.submit(() -> toolsSiteService.updateAvatarStatus(id)));
-        }
-
-        //广告名称待更新的广告主id集
-        List<Long> nameIds = toolsSiteService.getNameAdvertiserIds();
-        if (!Check.isNull(nameIds)) {
-            nameIds.forEach(id -> nameExecutorService.submit(() -> toolsSiteService.updateNameStatus(id)));
-        }
-
-        List<JSONObject> appList = toolsSiteService.getTimeOutAppList();
-        if (!Check.isNull(appList)) {
-            appList.forEach(app -> appExecutorService.submit(() -> toolsSiteService.pushAgain(app)));
-        }
-
-        //微信
-        List<Long> wxappIds = toolsSiteService.getAppAdvertiserIds("1");
-        if (!Check.isNull(wxappIds)) {
-            wxappIds.forEach(id -> wxappExecutorService.submit(() -> {
-                //创建
-                toolsSiteService.updateWxAppStatus(id, "CREATE_ONLY", 1);
-                //复制
-                toolsSiteService.updateWxAppStatus(id, "SHARE_ONLY", 1);
-            }));
-        }
-
-        //字节
-        List<Long> ttappIds = toolsSiteService.getAppAdvertiserIds("2");
-        if (!Check.isNull(ttappIds)) {
-            ttappIds.forEach(id -> ttappExecutorService.submit(() -> {
-                //创建
-                toolsSiteService.updateTTAppStatus(id, "CREATE_ONLY", 1);
-                //复制
-                toolsSiteService.updateTTAppStatus(id, "SHARE_ONLY", 1);
-            }));
-        }
-
-        //更新落地页状态
-        List<Long> siteIds = toolsSiteService.getSiteAdvertiserIds();
-        if (!Check.isNull(siteIds)) {
-            siteIds.forEach(id -> siteExecutorService.submit(() -> {
-                toolsSiteService.updateSiteStatus(id, 1);
-            }));
-        }
-
-        //发布落地页
-        List<JSONObject> sids = toolsSiteService.getSiteAdvertiserIds2();
-        if (!Check.isNull(siteIds)) {
-            sids.forEach(o -> siteExecutorService.submit(() -> {
-                toolsSiteService.publishSiteStatus(o.getLong("advertiser_id"), o.getString("task_id"));
-            }));
-        }
-
-        //更新短剧剧集时长字段
-        String url = "https://api.deepthink.artlinkworld.cn/hrJava/videos/getVideosInfo";
-        HttpUtils.httpPostRequest(url, null, null);
-
-
-    }
-
-    private final String  KEY = "bb3648b0b93f2f82135a6dac38dc418f808346a434";
-
-    @XxlJob("regularUpdatesState")
-    public void regularUpdatesState() throws Exception {
-        log.info("执行更新短剧上下架状态...");
-        //更新短剧上下架状态
-        String url = "https://api.cms.artlinkworld.cn/videoAppletShow/regularUpdatesState";
-        HttpUtils.httpGet(String.format("%s?id=%s", url, KEY), null, null);
-
-        //授权IAA微信小程序,(当配置完iaa上架时间后,根据上架时间,提前30分钟进行授权)
-        String url2 = "https://api.cms.artlinkworld.cn/videoAppletShow/authorizedIaaWechatApp";
-        HttpUtils.httpGet(String.format("%s?id=%s", url2, KEY), null, null);
-    }
-
-    @XxlJob("regularUpdateVideoInfo")
-    public void regularUpdateVideoInfo() throws Exception {
-        log.info("定期更新短剧审核信息...");
-        //定期更新短剧审核信息
-        String url = "https://api.cms.artlinkworld.cn/thirtPartVideo/regularUpdateVideoInfo";
-        HttpUtils.httpGet(String.format("%s?platform=1&id=%s", url, KEY), null, null);
-        HttpUtils.httpGet(String.format("%s?platform=2&id=%s", url, KEY), null, null);
-    }
-
-    @XxlJob("regularUpdateUploadEpisodesStatus")
-    public void regularUpdateUploadEpisodesStatus() throws Exception {
-        log.info("定期更新短剧剧集上传状态信息...");
-        //定期更新短剧剧集上传状态信息
-        String url = "https://api.cms.artlinkworld.cn/thirtPartVideo/regularUpdateUploadEpisodesStatus";
-        HttpUtils.httpGet(String.format("%s?platform=1&id=%s", url, KEY), null, null);
-        HttpUtils.httpGet(String.format("%s?platform=2&id=%s", url, KEY), null, null);
-    }
-}

+ 0 - 31
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/TrackJob.java

@@ -1,31 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-
-import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * kafka异常数据处理
- */
-@Slf4j
-@Component
-public class TrackJob {
-
-    /**
-     * kafka 重发失败消息
-     */
-    @XxlJob("sendAgainKfkinfo")
-    public void sendAgainKfkinfo() throws Exception {
-        String url = "https://track.artlinkworld.cn/information/sendAgainKfkinfo";
-        Map<String, Object> param = new HashMap<>();
-        param.put("id", "hr_3bf560ad31e50f2ff18e4490b37b20f8WU0l4zVgFsOoquFxmQwqfg8vtO");
-        String s = HttpUtils.httpGet(url, param, null);
-    }
-
-}

+ 0 - 95
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ZtPolicyKob.java

@@ -1,95 +0,0 @@
-package cn.com.ctop.job.bytedance.handler;
-
-
-import cn.com.ctop.job.bytedance.data.service.IZtPolicyRunService;
-import cn.com.ctop.job.bytedance.data.utils.Check;
-import com.xxl.job.core.context.XxlJobHelper;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-
-@Slf4j
-@Component
-public class ZtPolicyKob {
-    @Autowired
-    private IZtPolicyRunService policyRunService;
-    private static ExecutorService halfHourExecutorService = Executors.newFixedThreadPool(5);
-    private static ExecutorService oneHourExecutorService = Executors.newFixedThreadPool(5);
-    private static ExecutorService oneDayExecutorService = Executors.newFixedThreadPool(5);
-
-
-    /**
-     * 智投助手-半小时
-     *
-     * @throws Exception
-     */
-
-    @XxlJob("halfHourJob")
-    public void halfHourJob() throws Exception {
-        String param = XxlJobHelper.getJobParam(); // 执行参数
-        if (Check.isNull(param)) {
-            log.error("入参为空");
-            return;
-        }
-        Long policyId = Long.valueOf(param);
-        halfHourExecutorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                policyRunService.run(policyId);
-            }
-        });
-    }
-
-
-    /**
-     * 智投助手-一小时
-     *
-     * @throws Exception
-     */
-
-    @XxlJob("oneHourJob")
-    public void oneHourJob() throws Exception {
-        String param = XxlJobHelper.getJobParam(); // 执行参数
-        if (Check.isNull(param)) {
-            log.error("入参为空");
-            return;
-        }
-        Long policyId = Long.valueOf(param);
-        oneHourExecutorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                policyRunService.run(policyId);
-            }
-        });
-    }
-
-
-    /**
-     * 智投助手-一天
-     *
-     * @throws Exception
-     */
-
-    @XxlJob("oneDayJob")
-    public void oneDayJob() throws Exception {
-        String param = XxlJobHelper.getJobParam(); // 执行参数
-        if (Check.isNull(param)) {
-            log.error("入参为空");
-            return;
-        }
-        Long policyId = Long.valueOf(param);
-        oneDayExecutorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                policyRunService.run(policyId);
-            }
-        });
-    }
-
-
-}

+ 66 - 3
nj_job-bytedance/src/main/java/cn/com/ctop/job/bytedance/utils/RedisConfig.java

@@ -1,17 +1,24 @@
 package cn.com.ctop.job.bytedance.utils;
 
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
 import org.redisson.Redisson;
 import org.redisson.api.RedissonClient;
 import org.redisson.config.Config;
+import org.redisson.config.SingleServerConfig;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
 import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
 import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
+import org.springframework.data.redis.connection.lettuce.LettucePoolingClientConfiguration;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
 import org.springframework.data.redis.serializer.StringRedisSerializer;
 
+import java.time.Duration;
+
 @Configuration
 public class RedisConfig {
     @Value("${spring.redis.host}")
@@ -23,16 +30,61 @@ public class RedisConfig {
     @Value("${spring.redis.database}")
     private int database;
 
+    @Value("${spring.redis.username:}")
+    private String username;
+
     @Value("${spring.redis.password}")
     private String password;
 
+    @Value("${spring.redis.lettuce.pool.min-idle:0}")
+    private int poolMinIdle;
+
+    @Value("${spring.redis.lettuce.pool.max-idle:8}")
+    private int poolMaxIdle;
+
+    @Value("${spring.redis.lettuce.pool.max-active:8}")
+    private int poolMaxActive;
+
+    @Value("${spring.redis.lettuce.pool.max-wait:-1ms}")
+    private Duration poolMaxWait;
+
     @Bean
     public RedissonClient redissonClient() {
         Config config = new Config();
-        config.useSingleServer().setAddress("redis://" + host + ":" + port).setDatabase(database).setPassword(password);
+        SingleServerConfig serverConfig = config.useSingleServer().setAddress("redis://" + host + ":" + port).setDatabase(database).setPassword(password);
+        // Redis 6 ACL 认证:配置了用户名时需同时传递用户名
+        if (StringUtils.isNotBlank(username)) {
+            serverConfig.setUsername(username);
+        }
         return Redisson.create(config);
     }
 
+    /**
+     * 全局 RedisConnectionFactory(替代 Spring Boot 自动配置)。
+     * <p>
+     * Spring Boot 2.3 的自动配置不支持 spring.redis.username(Redis 6 ACL 用户名),
+     * 这里自行提供连接工厂,保证 CacheManager 等基于该 Bean 的场景同样携带用户名认证。
+     */
+    @Bean
+    public RedisConnectionFactory redisConnectionFactory() {
+        RedisStandaloneConfiguration config = new RedisStandaloneConfiguration();
+        config.setHostName(host);
+        config.setPort(port);
+        config.setDatabase(database);
+        config.setPassword(getAclPassword());
+
+        GenericObjectPoolConfig<?> poolConfig = new GenericObjectPoolConfig<>();
+        poolConfig.setMinIdle(poolMinIdle);
+        poolConfig.setMaxIdle(poolMaxIdle);
+        poolConfig.setMaxTotal(poolMaxActive);
+        poolConfig.setMaxWaitMillis(poolMaxWait.toMillis());
+        LettucePoolingClientConfiguration clientConfig = LettucePoolingClientConfiguration.builder()
+                .poolConfig(poolConfig)
+                .build();
+
+        return new LettuceConnectionFactory(config, clientConfig);
+    }
+
     @Bean(name = "redisTemplateDefault")
     public RedisTemplate<String, Object> redisTemplateDefault() {
         return createTemplate(database);
@@ -45,16 +97,27 @@ public class RedisConfig {
 
     @Bean(name = "redisTemplate_db5")
     public RedisTemplate<String, Object> redisTemplate5() {
-        // token 缓存固定使用 db5,与 BytedanceRefreshTokenServiceImpl#getJedisToken 中 select(5) 保持一致
+        // token 缓存固定使用 db5
         return createTemplate(5);
     }
 
+    /**
+     * 构建认证密码。
+     * <p>
+     * Lettuce 5.3.x 不支持 ACL 双参认证(AUTH user password),
+     * 阿里云 Redis 支持所有实例使用 "user:password" 兼容格式(即 AUTH user:password),
+     * 因此配置了用户名时按 "用户名:密码" 拼接后作为密码传入。
+     */
+    private String getAclPassword() {
+        return StringUtils.isNotBlank(username) ? username + ":" + password : password;
+    }
+
     private RedisTemplate<String, Object> createTemplate(int dbIndex) {
         RedisStandaloneConfiguration config = new RedisStandaloneConfiguration();
         config.setHostName(host);
         config.setPort(port);
         config.setDatabase(dbIndex);
-        config.setPassword(password);
+        config.setPassword(getAclPassword());
 
         LettuceConnectionFactory factory = new LettuceConnectionFactory(config);
         factory.afterPropertiesSet();

+ 2 - 2
nj_job-bytedance/src/main/resources/application.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8085
+  port: 8086
   ip: 127.0.0.1
   shutdown: graceful   #IMMEDIATE立即停机(默认值)、GRACEFUL
   servlet:
@@ -89,7 +89,7 @@ spring:
     port: 6379
     # 数据库索引
     database: 20
-    # 用户名(阿里云Redis默认账号为实例ID;ACL自定义账号格式为 实例id:账号名)
+    # 用户名(Redis 6 ACL:默认账号为实例ID或 default,自定义账号直接填账号名)
     username: nuojing_only_read
     # 密码
     password: lLze2N_%(CZ%

+ 3 - 3
nj_job-bytedance/src/main/resources/custom-report-config.json

@@ -36,7 +36,7 @@
       "all_pay_amount_income_count_3days_trend", "all_pay_amount_income_count_7days_trend",
       "all_gpm_trend", "all_gpmc_trend", "all_iap_refund_trend"
     ],
-    "dorisDatabase": "media_api",
+    "dorisDatabase": "nuojing_data",
     "dorisTable": "bytedance_uni_project_report_daily"
   },
   "uni_project_hour": {
@@ -76,7 +76,7 @@
       "all_pay_amount_income_count_3days_trend", "all_pay_amount_income_count_7days_trend",
       "all_gpm_trend", "all_gpmc_trend", "all_iap_refund_trend"
     ],
-    "dorisDatabase": "media_api",
+    "dorisDatabase": "nuojing_data",
     "dorisTable": "bytedance_uni_project_report_hour"
   },
   "uni_project_material_daily": {
@@ -104,7 +104,7 @@
       "all_pay_amount_income_count_24h_trend", "all_pay_amount_income_count_0day_trend",
       "all_pay_amount_income_count_3days_trend", "all_gpm_trend", "all_gpmc_trend"
     ],
-    "dorisDatabase": "media_api",
+    "dorisDatabase": "nuojing_data",
     "dorisTable": "bytedance_uni_project_material_report_daily"
   }
 }