Quellcode durchsuchen

批量创建--预览数据格式更改

zhaoxian vor 4 Jahren
Ursprung
Commit
361f7407fa

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -187,6 +187,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/batch/kuaiShouGroupTemplate/*", "anon");
         filterChainDefinitionMap.put("/kuaishouBatch/**", "anon");
         filterChainDefinitionMap.put("/kuaishou/creative/*", "anon");
+        filterChainDefinitionMap.put("/explore/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

+ 27 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCampaignPreviewServiceImpl.java

@@ -58,18 +58,42 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         QueryWrapper<KuaishouBatchCampaignPreview> campaignWrapper = new QueryWrapper<>();
         campaignWrapper.eq("batch_id", batchId).eq("account_id", accountId).orderByDesc("create_time");
         List<KuaishouBatchCampaignPreview> campaignPreviewList = campaignPreviewMapper.selectList(campaignWrapper);
-        obj.put("campaignList", campaignPreviewList);
         QueryWrapper<KuaishouBatchGroupPreview> groupWrapper = new QueryWrapper<>();
         groupWrapper.eq("batch_id", batchId).eq("account_id", accountId).orderByDesc("create_time");
         List<KuaishouBatchGroupPreview> groupPreviewList = groupPreviewMapper.selectList(groupWrapper);
-        obj.put("groupList", groupPreviewList);
         QueryWrapper<KuaishouBatchCreativePreview> creativeWrapper = new QueryWrapper<>();
         creativeWrapper.eq("batch_id", batchId).eq("account_id", accountId).orderByDesc("create_time");
         List<KuaishouBatchCreativePreview> creativePreviewList = creativePreviewMapper.selectList(creativeWrapper);
-        obj.put("creativeList", creativePreviewList);
+        obj.put("campaignList", getCampaignList(campaignPreviewList, groupPreviewList, creativePreviewList));
         return obj;
     }
 
+    private List<KuaishouBatchCampaignPreview> getCampaignList(List<KuaishouBatchCampaignPreview> campaignPreviewList, List<KuaishouBatchGroupPreview> kuaishouBatchGroupPreviews, List<KuaishouBatchCreativePreview> kuaishouBatchCreativePreviews) {
+        List<KuaishouBatchGroupPreview> groups = new ArrayList<>();
+        for (KuaishouBatchGroupPreview groupPreview : kuaishouBatchGroupPreviews) {
+            List<KuaishouBatchCreativePreview> creatives = new ArrayList<>();
+            for (KuaishouBatchCreativePreview creativePreview : kuaishouBatchCreativePreviews) {
+                if (groupPreview.getPlanId().equals(creativePreview.getPlanId()) && creativePreview.getGroupId().equals(groupPreview.getId())) {
+                    creatives.add(creativePreview);
+                }
+            }
+            groupPreview.setKuaishouBatchCreativePreviews(creatives);
+            groups.add(groupPreview);
+        }
+        List<KuaishouBatchCampaignPreview> campaigns = new ArrayList<>();
+        for (KuaishouBatchCampaignPreview campaignPreview : campaignPreviewList) {
+            List<KuaishouBatchGroupPreview> groupList = new ArrayList<>();
+            for (KuaishouBatchGroupPreview group : groups) {
+                if (campaignPreview.getId().equals(group.getPlanId())) {
+                    groupList.add(group);
+                }
+            }
+            campaignPreview.setKuaishouBatchGroupPreviews(groupList);
+            campaigns.add(campaignPreview);
+        }
+        return campaigns;
+    }
+
     @Override
     public void addPreviewData(JSONObject data) throws Exception {
         String batchId = data.getString("batchId");

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouGroupExploreServiceImpl.java

@@ -10,6 +10,7 @@ import cn.com.ctop.kuaishou.modules.report.entity.KuaishouGroupExplore;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouGroupExploreMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouGroupExploreService;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
@@ -203,6 +204,12 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
                     if (Check.isNull(kuaishouGroupExplore)) {
                         return Result.error("查询失败,结果为空");
                     }
+                    QueryWrapper<KuaishouGroupExplore> queryWrapper = new QueryWrapper<>();
+                    queryWrapper.eq("unit_id", kuaishouGroupExplore.getUnitId());
+                    KuaishouGroupExplore one = this.getOne(queryWrapper);
+                    if (!Check.isNull(one)) {
+                        kuaishouGroupExplore.setId(one.getId());
+                    }
                     kuaishouGroupExplore.setAccountId(accountId);
                     this.saveOrUpdate(kuaishouGroupExplore);
                     return Result.ok("添加成功");