浏览代码

添加人群包回显接口

zhaoxian 4 年之前
父节点
当前提交
a8fbeb5917

+ 22 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouDirectionalPackageController.java

@@ -290,7 +290,7 @@ public class KuaishouDirectionalPackageController {
                 pageSize = 10;
             }
             PageHelper.startPage(pageNo, pageSize);
-            return kuaishouDirectionalPackageService.queryPushResults(id, accountIds,requestJson.getString("status"));
+            return kuaishouDirectionalPackageService.queryPushResults(id, accountIds, requestJson.getString("status"));
         } catch (Exception e) {
             log.error("查询推送结果异常", e);
         }
@@ -384,13 +384,11 @@ public class KuaishouDirectionalPackageController {
     }
 
     /**
-     * 通过id查询
+     * 查询待修改的定向包
      *
      * @param id
      * @return
      */
-    @AutoLog(value = "自动投放-定向包详情-通过id查询")
-    @ApiOperation(value = "自动投放-定向包详情-通过id查询", notes = "自动投放-定向包详情-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<Object> queryById(@RequestParam(name = "id", required = true) String id) {
         KuaishouDirectionalPackage kuaishouDirectionalPackage = kuaishouDirectionalPackageService.getById(id);
@@ -406,6 +404,26 @@ public class KuaishouDirectionalPackageController {
     }
 
     /**
+     * 查询待修改的人群包
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping(value = "/queryPopulationPopulationById")
+    public Result<Object> queryPopulationPopulationById(Long templateId, Long accountId) {
+        try {
+            if (Check.isNull(templateId) || Check.isNull(accountId)) {
+                return Result.error("缺少参数");
+            }
+            return kuaishouDirectionalPackageService.queryPopulationPopulationById(templateId, accountId);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+
+    }
+
+    /**
      * 导出excel
      *
      * @param request

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouDirectionalPackageService.java

@@ -44,4 +44,5 @@ public interface IKuaishouDirectionalPackageService extends IService<KuaishouDir
      */
     void createUnitAndTemplate(JSONObject request) throws Exception;
 
+    Result<Object> queryPopulationPopulationById(Long templateId, Long accountId);
 }

+ 26 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouDirectionalPackageServiceImpl.java

@@ -13,8 +13,10 @@ import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouDirectionalPckageRelMapper
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalPackageService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalPckageRelService;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplateTarget;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouTemplateMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouTemplateTargetMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouTemplateService;
@@ -62,6 +64,8 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
     private IKuaiShouUpdateService updateService;
     @Autowired
     private KuaiShouGroupMapper groupMapper;
+    @Autowired
+    private KuaishouTemplateTargetMapper templateTargetMapper;
 
     @Autowired
     private IKuaiShouGroupTemplateService groupTemplateService;
@@ -634,4 +638,26 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
         }
     }
 
+    @Override
+    public Result<Object> queryPopulationPopulationById(Long templateId, Long accountId) {
+        KuaishouTemplateTarget target = templateTargetMapper.queryTemplateTarget(templateId, accountId);
+        if (Check.isNull(target)) {
+            return Result.error("为查询到人群包");
+        }
+        JSONObject data = new JSONObject();
+        String excludePopulation = target.getExcludePopulation();
+        if (!Check.isNull(excludePopulation)) {
+            data.put("excludePopulation", JSONArray.parseArray(excludePopulation));
+        }
+        String population = target.getPopulation();
+        if (!Check.isNull(population)) {
+            data.put("population", JSONArray.parseArray(population));
+        }
+        String paidAudience = target.getPaidAudience();
+        if (!Check.isNull(paidAudience)) {
+            data.put("paidAudience", JSONArray.parseArray(paidAudience));
+        }
+        return Result.ok(data);
+    }
+
 }

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

@@ -16,4 +16,6 @@ import java.util.List;
 public interface KuaishouTemplateTargetMapper extends BaseMapper<KuaishouTemplateTarget> {
 
     void templateTargetList(@Param("templateTargetList") List<KuaishouTemplateTarget> templateTargetList);
+
+    KuaishouTemplateTarget queryTemplateTarget(@Param("templateId") Long templateId, @Param("accountId")Long accountId);
 }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouTemplateMapper.xml

@@ -53,7 +53,7 @@
         select t1.account_id,t1.template_id,t1.template_name,t3.dir_id,t3.project_id
         from ctop_kuaishou_template t1
                  INNER JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
-                 left JOIN ctop_kuaishou_directional_package_rel t3 ON t1.template_name = t3.template_name AND t2.project_id = t3.project_id
+                 left JOIN ctop_kuaishou_directional_package_rel t3 ON t1.template_id = t3.template_id AND t2.project_id = t3.project_id
         where t1.template_id = #{templateId}
     </select>
 

+ 13 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouTemplateTargetMapper.xml

@@ -84,4 +84,17 @@
             )
         </foreach>
     </insert>
+
+    <select id="queryTemplateTarget" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplateTarget">
+        SELECT t1.template_id,
+               population,
+               paid_audience,
+               exclude_population
+        FROM ctop_kuaishou_template_target t1
+                 LEFT JOIN ctop_kuaishou_template t2 ON t1.template_id = t2.template_id
+        WHERE t1.template_id = #{templateId}
+          AND t2.account_id = #{accountId}
+    </select>
+
+
 </mapper>