Pārlūkot izejas kodu

批量 加入创意条数判断

yumeng 5 gadi atpakaļ
vecāks
revīzija
a0f8ab918a

+ 30 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -1060,7 +1060,7 @@ public class BatchController {
      * @return
      */
     @GetMapping(value = "/getCreativeCopywriter")
-    public Result<MaterialInfo> getVideoList(String code, Long accountId) {
+    public Result<MaterialInfo> getCreativeCopywriter(String code, Long accountId) {
         Result<MaterialInfo> result = new Result<>();
         try {
             Long projectId = materialInfoMapper.getProjectIdByAccountId(accountId);
@@ -1550,6 +1550,7 @@ public class BatchController {
 
     /**
      * 批量复制组
+     *
      * @param requestJson
      * @return
      */
@@ -1619,10 +1620,9 @@ public class BatchController {
     }
 
 
-
-
     /**
      * 复制组
+     *
      * @param requestJson
      * @return
      */
@@ -1718,6 +1718,7 @@ public class BatchController {
 
     /**
      * 获取人群包
+     *
      * @param accountId
      * @return
      */
@@ -1749,6 +1750,7 @@ public class BatchController {
 
     /**
      * 获取创意
+     *
      * @param accountId
      * @param campaignId
      * @return
@@ -1781,4 +1783,29 @@ public class BatchController {
     }
 
 
+    /**
+     * 获取当前组下创意数
+     *
+     * @param accountId
+     * @param unitId
+     * @return
+     */
+    @GetMapping(value = "/checkCreativeCount")
+    public Result checkCreativeCount(Long accountId, Long unitId) {
+        Result result = new Result<>();
+        try {
+            if (Check.isNull(unitId) || Check.isNull(accountId)) {
+                throw new Exception("必填参数不能为空");
+            }
+            Integer count = kuaiShouCreativeService.checkCreativeCount(accountId, unitId);
+            result.setResult(count);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+        return result;
+    }
+
+
 }

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

@@ -15,4 +15,6 @@ import java.util.List;
 public interface KuaiShouCreativeMapper extends BaseMapper<KuaiShouCreative> {
 
     void replaceBatch(@Param(value = "creatives") List<KuaiShouCreative> creatives);
+
+    Integer checkCreativeCount(@Param("accountId") Long accountId, @Param("unitId") Long unitId);
 }

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

@@ -76,4 +76,11 @@
             #{creative.updateTime})
         </foreach>
     </insert>
+
+    <select id="checkCreativeCount" resultType="java.lang.Integer">
+     select count(1)
+     from ctop_kuaishou_creative
+     where  account_id = #{accountId}
+     and unit_id = #{unitId}
+    </select>
 </mapper>

+ 10 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCreativeService.java

@@ -17,8 +17,18 @@ public interface IKuaiShouCreativeService extends IService<KuaiShouCreative> {
 
     /**
      * 获取MD5
+     *
      * @param creativeId
      * @return
      */
     String getCodeByCreativeId(Long creativeId);
+
+    /**
+     * 创意条数
+     *
+     * @param accountId
+     * @param unitId
+     * @return
+     */
+    Integer checkCreativeCount(Long accountId, Long unitId);
 }

+ 12 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreativeServiceImpl.java

@@ -53,4 +53,16 @@ public class KuaiShouCreativeServiceImpl extends ServiceImpl<KuaiShouCreativeMap
         }
         return null;
     }
+
+    /**
+     * 创意条数
+     *
+     * @param accountId
+     * @param unitId
+     * @return
+     */
+    @Override
+    public Integer checkCreativeCount(Long accountId, Long unitId) {
+        return kuaiShouCreativeMapper.checkCreativeCount(accountId, unitId);
+    }
 }