Forráskód Böngészése

智能托管修改

yumeng 3 éve
szülő
commit
4172c67ee1

+ 2 - 3
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/hosting/controller/KuaishouHostingTemplateController.java

@@ -80,8 +80,8 @@ public class KuaishouHostingTemplateController {
             queryWrapper.eq("account_id", accountId);
             queryWrapper.eq("status", 0);
             if (!Check.isNull(startDate) && !Check.isNull(endDate)) {
-                Date start = DateUtil.parseDate(startDate + " :00:00:01");
-                Date end = DateUtil.parseDate(endDate + " :23:59:59");
+                Date start = DateUtil.parseDate(startDate += " 00:00:01");
+                Date end = DateUtil.parseDate(endDate += " 23:59:59");
                 queryWrapper.between("stat_date", start, end);
             }
             if (!Check.isNull(name)) {
@@ -104,7 +104,6 @@ public class KuaishouHostingTemplateController {
     @Autowired
     private IUserAllocationService userAllocationService;
 
-
     @Autowired
     private IProjectService projectService;
 

+ 11 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/hosting/service/impl/KuaishouHostingTaskServiceImpl.java

@@ -85,7 +85,7 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
             task.setTaskStatus(1);
             task.setRemarks("待创建");
             task.setPhotoInfos(videoInfo.toString());
-            task.setName(getName(template.getName()));
+            task.setName(getName(template.getName(), task.getAccountId()));
             task.setHostingScene(template.getHostingScene());
             task.setCampaignType(template.getCampaignType());
             if (!Check.isNull(template.getAppId())) {
@@ -155,7 +155,9 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
             task.setPlatformOv(template.getPlatformOv());
             task.setFilterConvertedLevel(template.getFilterConvertedLevel());
             task.setRuleEnable(template.getRuleEnable());
-            task.setCampaignNameRule(getCampaignName(template.getCampaignNameRule()));
+            if (!Check.isNull(template.getCampaignNameRule())) {
+                task.setCampaignNameRule(getCampaignName(template.getCampaignNameRule(), task.getAccountId()));
+            }
             task.setUnitNameRule(template.getUnitNameRule());
             task.setCreativeNameRule(template.getCreativeNameRule());
             addList.add(task);
@@ -378,6 +380,7 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
             /*---------    视频组装  ---------*/
             JSONArray videoInfo = getPhotoArray(photoArray);
             requestJson.put("photo_infos", videoInfo);
+            log.info("创建智能托管,accountId:{},入参:{}", task.getAccountId(), requestJson);
             JSONObject hosting = createHosting(task.getAccountId(), token.getAccessToken(), requestJson);
             if (!Check.isNull(hosting)) {
                 Integer code = hosting.getInteger("code");
@@ -409,9 +412,9 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
         hostingTaskMapper.updateStatusById(id, taskStatus, remarks);
     }
 
-    private String getName(String name) {
+    private String getName(String name, Long accountId) {
         String nowDate = DateUtils.getNowDate("yyyy-MM-dd").replace("-", "");
-        String redisKey = hostingKey + "_" + nowDate;
+        String redisKey = hostingKey + "_" + nowDate + "_" + accountId;
         Object o = redisUtil.get(redisKey);
         Integer count;
         if (Check.isNull(o)) {
@@ -424,9 +427,9 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
         return name + "_" + nowDate + "_" + count;
     }
 
-    private String getCampaignName(String name) {
+    private String getCampaignName(String name, Long accountId) {
         String nowDate = DateUtils.getNowDate("yyyy-MM-dd").replace("-", "");
-        String redisKey = hostingKey + "_" + nowDate;
+        String redisKey = hostingKey + "_" + nowDate + "_" + accountId;
         Object o = redisUtil.get(redisKey);
         Integer count;
         if (Check.isNull(o)) {
@@ -480,10 +483,10 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
             if (Check.isNull(photoId)) {
                 continue;
             }
-          /*  Integer materialType = hostingTaskMapper.getMaterialType(photoId);
+            Integer materialType = hostingTaskMapper.getMaterialType(photoId);
             if (Check.isNull(materialType)) {
                 continue;
-            }*/
+            }
             JSONObject videoJson = new JSONObject();
             videoJson.put("photo_id", photoId);
             videoJson.put("photo_orientation", 1);