Przeglądaj źródła

批量 功能优化, 添加媒体定向

zhaoxian 2 lat temu
rodzic
commit
323a4e719f
16 zmienionych plików z 321 dodań i 45 usunięć
  1. 4 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  2. 59 4
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  3. 14 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouBatchGroupTemplate.java
  4. 14 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchGroupPreview.java
  5. 4 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouTemplateTarget.java
  6. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouPopulationMapper.java
  7. 32 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouPopulationMapper.xml
  8. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouTemplateTargetMapper.xml
  9. 11 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  10. 4 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouPopulationService.java
  11. 12 8
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java
  12. 16 18
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCreativePreviewServiceImpl.java
  13. 123 9
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  14. 10 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouPopulationServiceImpl.java
  15. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouTemplateServiceImpl.java
  16. 8 6
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/entity/ReimburseProject.java

+ 4 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -158,6 +158,10 @@ public class KuaishouInterfaceConstant {
      * 获取人群包接口
      */
     public static final String POPULATION_LIST = "/rest/openapi/v2/dmp/population/list";
+    /**
+     * 获取联盟定向媒体包列表
+     */
+    public static final String MEDIA_LIST = "/rest/openapi/v1/asset/media/list";
 
     /**
      * 删除人群包接口

+ 59 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -9,13 +9,42 @@ import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.RandomUtil;
-import cn.com.ctop.kuaishou.modules.batch.entity.*;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouActionBarText;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppInfo;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouDirectionalTemplate;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListParent;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTargetingTags;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouPopulation;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.SpendVo;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTargetingTagsMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.batch.service.IBatchService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouActionBarTextService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAdvertiserBaseInfoService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppInfoService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppListService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDirectionalTemplateService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTargetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouRegionListParentService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouPopulationService;
+import cn.com.ctop.kuaishou.modules.batch.service.ISyncPullMaterialService;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouGroupDailyReportService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -28,7 +57,14 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
@@ -138,7 +174,6 @@ public class BatchController {
             };
             thread1.start();
 
-
             Thread thread2 = new Thread() {
                 @Override
                 public void run() {
@@ -156,6 +191,14 @@ public class BatchController {
                 }
             };
             thread4.start();
+
+            Thread thread5 = new Thread() {
+                @Override
+                public void run() {
+                    iKuaishouInterfaceService.getMediaList(accountId, oauthToken.getAccessToken(), 1);
+                }
+            };
+            thread5.start();
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
@@ -165,6 +208,18 @@ public class BatchController {
         return result;
     }
 
+    /**
+     * 获取联盟定向媒体包列表
+     */
+    @GetMapping(value = "/getMedias")
+    public Result<Object> getMedias(Long accountId) {
+        try {
+            return Result.ok(iKuaishouInterfaceService.getMedias(accountId));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
 
     /**
      * 获取广告计划列表

+ 14 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouBatchGroupTemplate.java

@@ -154,6 +154,20 @@ public class KuaiShouBatchGroupTemplate {
     @Excel(name = "1:固定出价 2:随机出价 值为1时取bid或cpa_bid  2 区 bid_max  bid_min", width = 15)
     @ApiModelProperty(value = "1:固定出价 2:随机出价 值为1时取bid或cpa_bid  2 区 bid_max  bid_min")
     private Integer templateBidType;
+
+    /**
+     * 媒体定向包
+     */
+    @Excel(name = "媒体定向包", width = 15)
+    @ApiModelProperty(value = "媒体定向包")
+    private String media;
+
+    /**
+     * 付费人群包
+     */
+    @Excel(name = "媒体定向排除包", width = 15)
+    @ApiModelProperty(value = "媒体定向排除包")
+    private String excludeMedia;
     /**
      * 创建时间
      */

+ 14 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchGroupPreview.java

@@ -207,6 +207,20 @@ public class KuaishouBatchGroupPreview {
     @Excel(name = "应用列表", width = 15)
     @ApiModelProperty(value = "应用列表")
     private String appStore;
+
+    /**
+     * 媒体定向包
+     */
+    @Excel(name = "媒体定向包", width = 15)
+    @ApiModelProperty(value = "媒体定向包")
+    private String media;
+
+    /**
+     * 付费人群包
+     */
+    @Excel(name = "媒体定向排除包", width = 15)
+    @ApiModelProperty(value = "媒体定向排除包")
+    private String excludeMedia;
     /**
      * 创建时间
      */

+ 4 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouTemplateTarget.java

@@ -72,6 +72,10 @@ public class KuaishouTemplateTarget {
     @ApiModelProperty(value = "年龄最大值")
     private Integer max;
     /**
+     * 已安装用户  0:过滤(默认),1:不限
+     */
+    private Integer disableInstalledAppSwitch;
+    /**
      * 性别 1:女性, 2:男性,0 表示不限
      */
     @Excel(name = "性别 1:女性, 2:男性,0 表示不限", width = 15)

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouPopulationMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouPopulation;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -18,4 +19,8 @@ public interface KuaishouPopulationMapper extends BaseMapper<KuaishouPopulation>
     void replaceBatch(@Param("addList") List<KuaishouPopulation> addList);
 
     void deleteByAccountId(@Param("accountId") Long accountId);
+
+    void replaceBatchMedia(@Param("list") List<JSONObject> list);
+
+    List<JSONObject> getMedias(@Param("accountId")Long accountId);
 }

+ 32 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouPopulationMapper.xml

@@ -33,9 +33,41 @@
         </foreach>
     </insert>
 
+    <insert id="replaceBatchMedia">
+        replace into ctop_kuaishou_media(
+        account_id,
+        media_id,
+        media_name,
+        source_type,
+        pos_ids
+        )
+        values
+        <foreach collection="list" item="media" separator=",">
+            (
+            #{media.accountId},
+            #{media.mediaId},
+            #{media.name},
+            #{media.sourceType},
+            #{media.posIds}
+            )
+        </foreach>
+    </insert>
+
     <delete id="deleteByAccountId">
         delete
         from ctop_kuaishou_population
         where account_id = #{accountId}
     </delete>
+
+    <select id="getMedias" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT  account_id as 'accountId',
+                media_id as 'mediaId',
+                media_name as 'mediaName',
+                source_type as 'sourceType',
+                pos_ids as 'posIds'
+        FROM ctop_kuaishou_media
+        WHERE account_id = #{accountId}
+        ORDER BY update_time DESC
+    </select>
+
 </mapper>

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouTemplateTargetMapper.xml

@@ -13,6 +13,7 @@
         min,
         max,
         gender,
+        disable_installed_app_switch,
         platform_os,
         android_osv,
         ios_osv,
@@ -53,6 +54,7 @@
             #{templateTarget.min},
             #{templateTarget.max},
             #{templateTarget.gender},
+            #{templateTarget.disableInstalledAppSwitch},
             #{templateTarget.platformOs},
             #{templateTarget.androidOsv},
             #{templateTarget.iosOsv},

+ 11 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java

@@ -424,6 +424,15 @@ public interface IKuaishouInterfaceService {
      */
     void getPopulationList(Long accountId, String accessToken, Integer page);
 
+     /**
+     * 获取人群包接口
+     *
+     * @param accountId
+     * @param accessToken
+     * @return
+     */
+    void getMediaList(Long accountId, String accessToken, Integer page);
+
 
     /**
      * 获取定向标签
@@ -506,6 +515,8 @@ public interface IKuaishouInterfaceService {
      * @return
      */
     JSONObject mcbConversionInfos(Long accountId, String accessToken, Integer sceneCategory, Integer campaignType, JSONArray sceneIds, Long appId);
+
+    List<JSONObject> getMedias(Long accountId);
 }
 
 

+ 4 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouPopulationService.java

@@ -106,4 +106,8 @@ public interface IKuaishouPopulationService extends IService<KuaishouPopulation>
     Long predictionPopulation(Long accountId, JSONObject obj, String accessToken);
 
     void replaceBatch(List<KuaishouPopulation> addList);
+
+    void replaceBatchMedia(List<JSONObject> list);
+
+    List<JSONObject> getMedias(Long accountId);
 }

+ 12 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java

@@ -577,20 +577,24 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
             target.put("app_interest", JSONArray.parseArray(templateTarget.getAppInterest()));
         }
 
-        if (!Check.isNull(templateTarget.getAppIds())) {
-            target.put("app_ids", JSONArray.parseArray(templateTarget.getAppIds()));
+        JSONArray appIds = JSONArray.parseArray(templateTarget.getAppIds());
+        if (!Check.isNull(appIds) && !appIds.isEmpty()) {
+            target.put("app_ids", appIds);
         }
 
-        if (!Check.isNull(templateTarget.getPopulation())) {
-            target.put("population", JSONArray.parseArray(templateTarget.getPopulation()));
+        JSONArray population = JSONArray.parseArray(templateTarget.getPopulation());
+        if (!Check.isNull(population) && !population.isEmpty()) {
+            target.put("population", population);
         }
 
-        if (!Check.isNull(templateTarget.getExcludePopulation())) {
-            target.put("exclude_population", JSONArray.parseArray(templateTarget.getExcludePopulation()));
+        JSONArray excludePopulation = JSONArray.parseArray(templateTarget.getExcludePopulation());
+        if (!Check.isNull(excludePopulation) && !excludePopulation.isEmpty()) {
+            target.put("exclude_population", excludePopulation);
         }
 
-        if (!Check.isNull(templateTarget.getPaidAudience())) {
-            target.put("paid_audience", JSONArray.parseArray(templateTarget.getPaidAudience()));
+        JSONArray paidAudience = JSONArray.parseArray(templateTarget.getPaidAudience());
+        if (!Check.isNull(paidAudience) && !paidAudience.isEmpty()) {
+            target.put("paid_audience", paidAudience);
         }
         //-------------兴趣行为定向
     /*    JSONObject behaviorInterest = new JSONObject();

+ 16 - 18
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCreativePreviewServiceImpl.java

@@ -292,6 +292,14 @@ public class KuaishouBatchCreativePreviewServiceImpl extends ServiceImpl<Kuaisho
                     Integer code = unionJson.getInteger("code");
                     if (code == 0) {
                         JSONObject target = unionJson.getJSONObject("target");
+                        JSONArray media = JSONObject.parseArray(groupPreview.getMedia());
+                        if (!Check.isNull(media) && !media.isEmpty()) {
+                            target.put("media", media);
+                        }
+                        JSONArray excludeMedia = JSONObject.parseArray(groupPreview.getExcludeMedia());
+                        if (!Check.isNull(excludeMedia) && !excludeMedia.isEmpty()) {
+                            target.put("exclude_media", excludeMedia);
+                        }
                         unitJson.put("target", target);
                     }
                 }
@@ -405,16 +413,6 @@ public class KuaishouBatchCreativePreviewServiceImpl extends ServiceImpl<Kuaisho
                 createJson.put("image_tokens", Arrays.asList(creativePreview.getImageTokens()));
                 createJson.put("creative_material_type", creativePreview.getMaterialType());
             }
-
-            if (!Check.isNull(creativePreview.getImageTokens())) {
-
-                createJson.put("photo_id", creativePreview.getPhotoId());  // 视频ID
-                KuaiShouVideoGet video = videoGetService.getVideoByPhotoId(Long.valueOf(creativePreview.getPhotoId()));
-                if (!Check.isNull(video)) {
-                    createJson.put("creative_material_type", video.getMaterialType());  // 素材类型
-                }
-            }
-
             if (!Check.isNull(creativePreview.getActionBarText())) {
                 createJson.put("action_bar_text", creativePreview.getActionBarText());  // 行动号召按钮文案
             }
@@ -461,14 +459,14 @@ public class KuaishouBatchCreativePreviewServiceImpl extends ServiceImpl<Kuaisho
                     createJson.put("kol_user_type", creativePreview.getKolUserType());
                 }
             }
-            String image_md5 = creativePreview.getImageSignature();
-            String imageToken = null;
-            if (!Check.isNull(image_md5)) {
-                imageToken = getImageToken(image_md5, oauthToken.getAccountId(), oauthToken.getAccessToken());
-            }
-            if (!Check.isNull(imageToken)) {
-                createJson.put("image_token", imageToken); // 自定义创意封面token
-            }
+//            String image_md5 = creativePreview.getImageSignature();
+//            String imageToken = null;
+//            if (!Check.isNull(image_md5)) {
+//                imageToken = getImageToken(image_md5, oauthToken.getAccountId(), oauthToken.getAccessToken());
+//            }
+//            if (!Check.isNull(imageToken)) {
+//                createJson.put("image_token", imageToken); // 自定义创意封面token
+//            }
             Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(oauthToken.getAccessToken(), oauthToken.getAccountId(), createJson, 1);
             JSONObject returnJson = new JSONObject();
             Integer code = (Integer) creativeMap.get("code");

+ 123 - 9
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -10,18 +10,68 @@ import cn.com.ctop.common.module.service.IMaterialCutFrameService;
 import cn.com.ctop.common.module.service.IMessageTemplate;
 import cn.com.ctop.common.module.service.IOauthConfigService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
-import cn.com.ctop.common.module.utils.*;
-import cn.com.ctop.kuaishou.modules.ai.service.*;
-import cn.com.ctop.kuaishou.modules.batch.entity.*;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.JsonUtil;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiCreativeLimitService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAccountCreativeOverrunInfoService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalPackageService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouLandpagePackageService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouPopulationGroupService;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouDailyFlows;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListChildren;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListParent;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTargetingTags;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouPopulation;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
-import cn.com.ctop.kuaishou.modules.batch.mapper.*;
-import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAdvertiserBaseInfoMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppListMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListChildrenMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListParentMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTargetingTagsMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyFlowsService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouOverRunSendMessageService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouPopulationService;
+import cn.com.ctop.kuaishou.modules.batch.service.IWarningOperationService;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
-import cn.com.ctop.kuaishou.modules.report.entity.*;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCampaign;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreativeStatistic;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyAccount;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCampaign;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreative;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreativeStatistic;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyGroup;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
-import cn.com.ctop.kuaishou.modules.report.service.*;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCampaignService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyAccountService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCampaignService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCreativeService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
+import cn.com.ctop.kuaishou.modules.report.service.IRuleKuaiShouPlanService;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -56,7 +106,11 @@ import java.io.IOException;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -2904,6 +2958,67 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     }
 
+    /**
+     * 获取联盟定向媒体包列表
+     *
+     * @param accountId
+     * @param accessToken
+     * @return
+     */
+    @Override
+    public void getMediaList(Long accountId, String accessToken, Integer page) {
+        List<JSONObject> list = new ArrayList<>();
+        try {
+            log.info("获取人群包列表,accountId:{}", accountId);
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.MEDIA_LIST;
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", accessToken);
+            headers.put("Content-Type", "application/json");
+            JSONObject requestJson = new JSONObject();
+            requestJson.put("advertiser_id", accountId);
+            requestJson.put("page", page);
+            requestJson.put("page_size", 50);
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    JSONObject dataDetailJson = resultJson.getJSONObject("data");
+                    if (Check.isNull(dataDetailJson)) {
+                        return;
+                    }
+                    JSONArray details = dataDetailJson.getJSONArray("details");
+                    if (Check.isNull(details)) {
+                        return;
+                    }
+                    for (int i = 0; i < details.size(); i++) {
+                        JSONObject jsonObject = details.getJSONObject(i);
+                        JSONObject media = jsonObject.getJSONObject("media");
+                        if (!Check.isNull(media)) {
+                            media.put("posIds",media.getString("posIds"));
+                            media.put("accountId",accountId);
+                            list.add(media);
+                        }
+                    }
+                    if (!list.isEmpty()) {
+                        populationService.replaceBatchMedia(list);
+                    }
+                    if (list.size() >= 50) {
+                        getMediaList(accountId, accessToken, page + 1);
+                    }
+                } else {
+                    log.error("获取联盟定向媒体包列表失败,accountId:{},返回:{}", accountId, resultJson);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public List<JSONObject> getMedias(Long accountId) {
+        return populationService.getMedias(accountId);
+    }
 
     /**
      * 获取定向标签
@@ -3522,5 +3637,4 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return returnJson;
     }
 
-
 }

+ 10 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouPopulationServiceImpl.java

@@ -358,4 +358,14 @@ public class KuaishouPopulationServiceImpl extends ServiceImpl<KuaishouPopulatio
         populationMapper.deleteByAccountId(addList.get(0).getAccountId());
         populationMapper.replaceBatch(addList);
     }
+
+    @Override
+    public void replaceBatchMedia(List<JSONObject> list) {
+        populationMapper.replaceBatchMedia(list);
+    }
+
+    @Override
+    public List<JSONObject> getMedias(Long accountId) {
+        return populationMapper.getMedias(accountId);
+    }
 }

+ 3 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouTemplateServiceImpl.java

@@ -114,6 +114,9 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
                         if (!Check.isNull(targetJson.getInteger("gender"))) {
                             templateTarget.setGender(targetJson.getInteger("gender"));
                         }
+                        if (!Check.isNull(targetJson.getInteger("disable_installed_app_switch"))) {
+                            templateTarget.setDisableInstalledAppSwitch(targetJson.getInteger("disable_installed_app_switch"));
+                        }
                         if (!Check.isNull(targetJson.getInteger("platform_os"))) {
                             templateTarget.setPlatformOs(targetJson.getInteger("platform_os"));
                         }

+ 8 - 6
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/entity/ReimburseProject.java

@@ -1,21 +1,17 @@
 package cn.com.ctop.reimburse.mondule.entity;
 
-import java.io.Serializable;
-import java.util.Date;
-
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
+import java.util.Date;
+
 /**
  * 报销申请项目表
  *
@@ -79,6 +75,12 @@ public class ReimburseProject {
     @ApiModelProperty(value = "文件链接集合")
     private Object fileUrls;
     /**
+     * 文件链接集合
+     */
+    @Excel(name = "excel链接集合", width = 15)
+    @ApiModelProperty(value = "excel链接集合")
+    private Object excelUrls;
+    /**
      * 备注
      */
     @Excel(name = "备注", width = 15)