瀏覽代碼

Merge branch 'master' of http://git.tjyourong.com.cn/ctop/adsp-boot

zhaoxian 4 年之前
父節點
當前提交
cf8975ab15
共有 18 個文件被更改,包括 433 次插入150 次删除
  1. 22 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceMusicTypeController.java
  2. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  3. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java
  4. 25 9
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  5. 9 35
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/entity/BytedanceMusicType.java
  6. 3 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/mapper/DictMusicTypeMapper.java
  7. 2 2
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/mapper/xml/DictMusicTypeMapper.xml
  8. 11 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/service/impl/DictMusicTypeServiceImpl.java
  9. 0 74
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java
  10. 15 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  11. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IBatchService.java
  12. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  13. 126 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  14. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java
  15. 194 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  16. 0 3
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatTokenServiceImpl.java
  17. 8 8
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml
  18. 0 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

+ 22 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceMusicTypeController.java

@@ -1,6 +1,8 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.crawler.modules.music.entity.BytedanceMusicInfo;
 import cn.com.ctop.crawler.modules.music.entity.BytedanceMusicType;
+import cn.com.ctop.crawler.modules.music.service.IBytedanceMusicInfoService;
 import cn.com.ctop.crawler.modules.music.service.IBytedanceMusicTypeService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -12,9 +14,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 
- /**
+/**
  * 音乐类型信息
  * @author jeecg-boot
  * @date   2020-10-28
@@ -26,6 +30,8 @@ import java.util.Arrays;
 public class BytedanceMusicTypeController {
 	@Autowired
 	private IBytedanceMusicTypeService bytedanceMusicTypeService;
+	@Autowired
+	private IBytedanceMusicInfoService bytedanceMusicInfoService;
 
 	/**
 	  * 分页列表查询
@@ -40,10 +46,25 @@ public class BytedanceMusicTypeController {
 														   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 														   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 														   HttpServletRequest req) {
+		String typeValue = bytedanceMusicType.getTypeValue();
+		bytedanceMusicType.setTypeValue(null);
 		Result<IPage<BytedanceMusicType>> result = new Result<>();
 		QueryWrapper<BytedanceMusicType> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceMusicType, req.getParameterMap());
+		queryWrapper.like("type_value",typeValue);
 		Page<BytedanceMusicType> page = new Page<>(pageNo, pageSize);
 		IPage<BytedanceMusicType> pageList = bytedanceMusicTypeService.page(page, queryWrapper);
+		List<BytedanceMusicType> records = pageList.getRecords();
+		if(null!=records&&!records.isEmpty()){
+			List<BytedanceMusicType> setRecords = new ArrayList<>();
+			for (BytedanceMusicType type:records) {
+				BytedanceMusicInfo musicInfo = bytedanceMusicInfoService.getById(type.getMusicId());
+				if(null!=musicInfo){
+					type.setMusicInfo(musicInfo);
+				}
+				setRecords.add(type);
+			}
+			pageList.setRecords(setRecords);
+		}
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java

@@ -584,5 +584,9 @@ public class ProjectMemberController {
 
     }
 
+    public static void main(String[] args) {
+
+    }
+
 
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java

@@ -122,7 +122,7 @@ public class SysBaseApiImpl implements ISysBaseApi {
 	}
 
 	@Override
-	@Cacheable(cacheNames=CacheConstant.SYS_USERS_CACHE, key="#username")
+//	@Cacheable(cacheNames=CacheConstant.SYS_USERS_CACHE, key="#username")
 	public LoginUser getUserByName(String username) {
 		if(oConvertUtils.isEmpty(username)) {
 			return null;

文件差異過大導致無法顯示
+ 25 - 9
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java


+ 9 - 35
module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/entity/BytedanceMusicType.java

@@ -1,19 +1,15 @@
 package cn.com.ctop.crawler.modules.music.entity;
 
-import java.io.Serializable;
-import java.util.Date;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 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;
 
 /**
  * 音乐类型信息
@@ -28,39 +24,17 @@ import org.jeecgframework.poi.excel.annotation.Excel;
 @ApiModel(value="ctop_music_type对象", description="音乐类型信息")
 public class BytedanceMusicType {
 
-	/**id*/
-	@TableId(type = IdType.UUID)
-    @ApiModelProperty(value = "id")
-	private Integer id;
-	/**type*/
-	@Excel(name = "type", width = 15)
-    @ApiModelProperty(value = "type")
+	@TableId(type = IdType.AUTO)
+	private Long id;
 	private String type;
-	/**typeValue*/
-	@Excel(name = "typeValue", width = 15)
-    @ApiModelProperty(value = "typeValue")
 	private String typeValue;
-	/**extType*/
-	@Excel(name = "extType", width = 15)
-    @ApiModelProperty(value = "extType")
 	private String extType;
-	/**extTypeValue*/
-	@Excel(name = "extTypeValue", width = 15)
-    @ApiModelProperty(value = "extTypeValue")
 	private String extTypeValue;
-	/**musicId*/
-	@Excel(name = "musicId", width = 15)
-    @ApiModelProperty(value = "musicId")
-	private Integer musicId;
-	/**musicName*/
-	@Excel(name = "musicName", width = 15)
-    @ApiModelProperty(value = "musicName")
+	private Long musicId;
 	private String musicName;
-	/**author*/
-	@Excel(name = "author", width = 15)
-    @ApiModelProperty(value = "author")
 	private String author;
-	/**createTime*/
-    @ApiModelProperty(value = "createTime")
 	private Date createTime;
+
+	@TableField(exist = false)
+	private BytedanceMusicInfo musicInfo;
 }

+ 3 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/mapper/DictMusicTypeMapper.java

@@ -2,6 +2,7 @@ package cn.com.ctop.crawler.modules.music.mapper;
 
 import cn.com.ctop.crawler.modules.music.entity.DictMusicType;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -14,5 +15,6 @@ import java.util.List;
 public interface DictMusicTypeMapper extends BaseMapper<DictMusicType> {
 
     List<DictMusicType> getAllExtTypeZh();
-    List<DictMusicType> getExtTypeValueZhByType(String extType);
+
+    List<DictMusicType> getAllExtInfoByExtTypeZh(@Param(value = "extTypeZh")String extTypeZh);
 }

+ 2 - 2
module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/mapper/xml/DictMusicTypeMapper.xml

@@ -6,8 +6,8 @@
         select distinct ext_type_zh,ext_type from ctop_dict_music_type_zh
     </select>
 
-    <select id="getExtTypeValueZhByType" resultType="cn.com.ctop.crawler.modules.music.entity.DictMusicType">
+    <select id="getAllExtInfoByExtTypeZh" resultType="cn.com.ctop.crawler.modules.music.entity.DictMusicType">
         select distinct ext_type_value,ext_type_zh from ctop_dict_music_type_zh
-        where ext_type = #{extType}
+        where ext_type_zh = #{extTypeZh}
     </select>
 </mapper>

+ 11 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/service/impl/DictMusicTypeServiceImpl.java

@@ -22,7 +22,17 @@ public class DictMusicTypeServiceImpl extends ServiceImpl<DictMusicTypeMapper, D
     private DictMusicTypeMapper musicTypeMapper;
     @Override
     public JSONObject listAll() {
+        JSONObject data = new JSONObject();
         List<DictMusicType> musicTypeList = musicTypeMapper.getAllExtTypeZh();
-        return null;
+        if(null!=musicTypeList&&!musicTypeList.isEmpty()){
+            List<DictMusicType> setList = musicTypeMapper.getAllExtTypeZh();
+            for (DictMusicType type:musicTypeList) {
+                List<DictMusicType>children = musicTypeMapper.getAllExtInfoByExtTypeZh(type.getExtTypeZh());
+                type.setDetail(children);
+                setList.add(type);
+            }
+            data.put("data",setList);
+        }
+        return data;
     }
 }

+ 0 - 74
module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java

@@ -51,81 +51,7 @@ public class TaobaoJhsbybtServiceImpl implements TaobaoJhsbybtService {
         String sign = DigestUtils.md5Hex(token + "&" + paramMap.get("t") + "&" + paramMap.get("appKey") + "&" + paramMap.get("data"));
         paramMap.put("sign", sign);
         headerMap.put("Cookie", cookie);
-//        System.out.println(cookie);
         result = HttpUtils.httpGet(url, paramMap, headerMap);
         return result;
     }
-
-    public static void main(String[] args) {
-        try {
-            PrintStream out = new PrintStream("D:/bybt0929.csv");
-            System.setOut(out);
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        }
-        System.out.println("商品id,商品名,销量,商品logo,设计图,商品图,商品链接,正常价,,,补贴价,补贴券");
-
-        TaobaoJhsbybtServiceImpl tb = new TaobaoJhsbybtServiceImpl();
-        int i = 1;
-        Boolean hasMore = true;
-        while (hasMore) {
-            try {
-                String result = tb.getGoodsList(i);
-                result = result.replace("mtopjsonp2(", "");
-                result = result.substring(0, result.length() - 1);
-                ObjectMapper mapper = new ObjectMapper();
-                JsonNode rootNode = mapper.readTree(result);
-//                System.out.println(HttpUtils.COOKIESTORE.toString());
-//                System.out.println(result);
-                Boolean success = rootNode.get("data").get("resultValue").get("8613423").get("success").asBoolean();
-                while (!success) {
-                    Thread.sleep(3000L);
-                    result = tb.getGoodsList(i);
-                    result = result.replace("mtopjsonp2(", "");
-                    result = result.substring(0, result.length() - 1);
-                    mapper = new ObjectMapper();
-                    rootNode = mapper.readTree(result);
-                    success = rootNode.get("data").get("resultValue").get("8613423").get("success").asBoolean();
-                }
-                hasMore = rootNode.get("data").get("resultValue").get("8613423").get("data").get("hasMore").asBoolean();
-                Iterator<JsonNode> items = rootNode.get("data").get("resultValue").get("8613423").get("data").get("items").iterator();
-                while (items.hasNext()) {
-                    JsonNode itemNode = items.next();
-                    String cjmsItemName = itemNode.get("cjmsItemName").asText();
-                    String itemSoldInfo = itemNode.get("itemSoldInfo").asText();
-                    String picUrl = itemNode.get("picUrl").asText();
-                    String cjmsTaobaoEntrance = itemNode.get("cjmsTaobaoEntrance").asText();
-                    String couponAmount = itemNode.get("couponAmount").asText();
-                    String orgPrice = itemNode.get("orgPrice").asText();
-                    String brandLogo = itemNode.get("brandLogo").asText();
-                    String couponPrice = itemNode.get("couponPrice").asText();
-                    String actPrice = itemNode.get("actPrice").asText();
-                    String cutPrice = itemNode.get("cutPrice").asText();
-                    String itemUrl = itemNode.get("itemUrl").asText();
-                    String itemId = itemNode.get("itemId").asText();
-                    System.out.println(itemId+","+cjmsItemName+","+
-                            itemSoldInfo+","+
-                            brandLogo+","+
-                            picUrl+","+
-                            cjmsTaobaoEntrance+","+
-                            itemUrl+","+
-                            actPrice+","+
-                            cutPrice+","+
-                            orgPrice+","+
-                            couponPrice+","+
-                            couponAmount);
-                }
-                i++;
-
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            try {
-                Thread.sleep(3000L);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-        }
-
-    }
 }

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

@@ -1208,15 +1208,23 @@ public class BatchController {
      * @return
      */
     @PostMapping(value = "/createCreative")
-    public Result<JSONObject> createCreative(@RequestBody JSONObject requestJson) {
-        Result<JSONObject> result = new Result<>();
+    public Result createCreative(@RequestBody JSONObject requestJson) {
+        Result result = new Result<>();
         try {
-            JSONObject creativeJson = batchService.createCreative(requestJson);
-            result.setResult(creativeJson);
-            result.setSuccess(true);
+            Map<String, Object> map = batchService.batchCreateCreative(requestJson);
+            Integer code = (Integer) map.get("code");
+            if (code == 0) {
+                result.setSuccess(true);
+                result.setMessage("创建成功");
+            } else {
+                result.setSuccess(false);
+                result.setMessage((String) map.get("message"));
+            }
+
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
+            result.setMessage("系统错误");
         }
         return result;
     }
@@ -2327,6 +2335,7 @@ public class BatchController {
 
     /**
      * 贴纸类型
+     *
      * @param accountId
      * @return
      */
@@ -2357,6 +2366,7 @@ public class BatchController {
 
     /**
      * 创意分类
+     *
      * @param accountId
      * @return
      */
@@ -2386,7 +2396,4 @@ public class BatchController {
     }
 
 
-
-
-
 }

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

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 
 import java.math.BigDecimal;
+import java.util.Map;
 
 public interface IBatchService {
     /**
@@ -161,9 +162,14 @@ public interface IBatchService {
 
     /**
      * 获取创意分类
+     *
      * @param accountId
      * @param accessToken
      * @return
      */
     JSONArray getCreativeCategory(Long accountId, String accessToken);
+
+
+    Map<String, Object> batchCreateCreative(JSONObject requestJson) throws Exception;
+
 }

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

@@ -501,6 +501,12 @@ public interface IKuaishouInterfaceService {
      * @return
      */
     JSONArray getPageList(Long accountId, String token, Long appId, String viewComp);
+
+
+    Map<String, Object> batchCreativeCreate(String accessToken, Long advertiserId, JSONObject requestJson, Integer count);
+
+    void getCreativeByCreativeIds(String accessToken, Long advertiserId, JSONArray creativeIds);
+
 }
 
 

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

@@ -1398,6 +1398,132 @@ public class BatchServiceImpl implements IBatchService {
     }
 
 
+    @Override
+    public Map<String, Object> batchCreateCreative(JSONObject requestJson) throws Exception {
+        if (Check.isNull(requestJson)) {
+            throw new Exception("入参为空");
+        }
+
+        Long accountId = requestJson.getLong("accountId");
+        if (Check.isNull(accountId)) {
+            throw new Exception("请输入需创建账号");
+        }
+
+        CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+        if (Check.isNull(oauthToken)) {
+            throw new Exception("未获取到账户信息");
+        }
+
+        Long unitId = requestJson.getLong("unitId");
+        if (Check.isNull(unitId)) {
+            throw new Exception("请选择广告组");
+        }
+
+        JSONObject creativeJson = new JSONObject();
+        creativeJson.put("advertiser_id", accountId);
+        creativeJson.put("unit_id", unitId);
+        String click_track_url = requestJson.getString("clickTrackUrl");
+
+
+        // 素材类型
+
+        String action_bar_text = requestJson.getString("actionBarText");
+        String site_id = requestJson.getString("siteId");
+        Integer creativeCategory = requestJson.getInteger("creativeCategory");// 创意分类
+        JSONArray creativeTag = requestJson.getJSONArray("creativeTag");
+
+
+        JSONArray dataJsons = requestJson.getJSONArray("dataJson");
+        Integer content = requestJson.getInteger("content");
+
+        if (!Check.isNull(dataJsons)) {
+            JSONArray creatives = new JSONArray();
+            for (int i = 0; i < dataJsons.size(); i++) {
+                JSONObject dataJson = dataJsons.getJSONObject(i);
+                String creativeMaterialType = dataJson.getString("creativeMaterialType");
+                String shortSlogan = dataJson.getString("shortSlogan");
+                String overlayType = dataJson.getString("overlayType");
+                String stickerTitle = dataJson.getString("stickerTitle");
+                String description = dataJson.getString("description");
+                String photo_id = dataJson.getString("photoId");
+                JSONArray imageArr = dataJson.getJSONArray("imageArr");
+                if (!Check.isNull(imageArr)) {
+                    for (int j = 0; j < imageArr.size(); j++) {
+                        JSONObject imageJson = imageArr.getJSONObject(j);
+                        if (!Check.isNull(imageJson)) {
+                            JSONObject creative = new JSONObject();
+                            content += 1;
+                            String name = imageJson.getString("name") + content;
+                            creative.put("action_bar_text", action_bar_text);
+                            creative.put("description", description.trim());
+                            creative.put("creative_name", name);
+                            creative.put("photo_id", photo_id);
+                            if (!Check.isNull(site_id)) {
+                                creative.put("site_id", site_id);
+                            }
+                            if (!Check.isNull(creativeMaterialType)) {
+                                creative.put("creative_material_type", creativeMaterialType);
+                            }
+                            if (!Check.isNull(overlayType)) {
+                                creative.put("overlay_type", overlayType);
+                            }
+                            if (!Check.isNull(stickerTitle)) {
+                                creative.put("sticker_title", stickerTitle);
+                            }
+                            if (!Check.isNull(creativeCategory) && !Check.isNull(creativeTag)) {
+                                creativeJson.put("creative_category", creativeCategory);
+                                creativeJson.put("creative_tag", creativeTag);
+                            }
+                            if (creativeMaterialType.equals("4")) {
+                                if (!Check.isNull("shortSlogan")) {
+                                    creative.put("short_slogan", shortSlogan);
+                                }
+                            }
+                            String imageToken = null;
+                            String signature = imageJson.getString("signature");
+                            if (!Check.isNull(signature)) {
+                                QueryWrapper<KuaiShouImageGet> queryWrapper = new QueryWrapper<>();
+                                queryWrapper.eq("account_id", accountId);
+                                queryWrapper.eq("signature", signature);
+                                queryWrapper.last("limit 1");
+                                KuaiShouImageGet imageGet = imageGetService.getOne(queryWrapper);
+                                if (!Check.isNull(imageGet)) {
+                                    imageToken = imageGet.getImageToken();
+                                } else {
+                                    String url = imageGetService.getUrlByCode(signature);
+                                    imageToken = uploadService.kuauiShouImageUpload(url, signature, accountId, oauthToken.getAccessToken());
+                                }
+                                if (Check.isNull(imageToken)) {
+                                    continue;
+                                }
+                            }
+                            if (creativeMaterialType.equals("4")) {
+                                JSONArray tokenArr = new JSONArray();
+                                tokenArr.add(imageToken);
+                                creative.put("image_tokens", tokenArr);
+                                creativeJson.put("click_track_url", click_track_url);
+                                creativeJson.put("impression_url", click_track_url);
+                            } else {
+                                creative.put("image_token", imageToken);
+                                creativeJson.put("click_track_url", click_track_url);
+                            }
+
+                            creatives.add(creative);
+                        }
+                    }
+                }
+
+
+            }
+
+            creativeJson.put("creatives", creatives);
+        }
+
+        Map<String, Object> returnUnitMap = kuaishouInterfaceService.batchCreativeCreate(oauthToken.getAccessToken(), accountId, creativeJson, 1);
+        return returnUnitMap;
+    }
+
+
     /**
      * 获取创意信息
      *

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java

@@ -68,7 +68,7 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
         taskQueryWrapper.eq("task_status", 0);
         taskQueryWrapper.eq("account_id", accountId);
         taskQueryWrapper.eq("stat_date", statDate);
-        taskQueryWrapper.eq("view_type", 7);
+       // taskQueryWrapper.eq("view_type", 7);
         taskQueryWrapper.orderByDesc("create_time");
         List<KuaiShouDailyReportTask> dailyTaskList = this.list(taskQueryWrapper);
         if (!Check.isNull(dailyTaskList)) {

+ 194 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -1604,6 +1604,121 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
+    @Override
+    public void getCreativeByCreativeIds(String accessToken, Long advertiserId, JSONArray creativeIds) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_LIST;
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("Content-Type", " application/json");
+        headers.put("Access-Token", accessToken);
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", advertiserId);
+        //  param.put("creative_id", creativeId);
+        if (!Check.isNull(creativeIds)) {
+            param.put("creative_ids", creativeIds);
+        }
+        param.put("page_size", 200);
+        param.put("page", 1);
+        try {
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    JSONObject dataJson = resultJson.getJSONObject("data");
+                    if (!Check.isNull(dataJson)) {
+                        JSONArray details = dataJson.getJSONArray("details");
+                        if (!Check.isNull(details)) {
+                            for (int i = 0; i < details.size(); i++) {
+                                JSONObject detailJson = JSONObject.parseObject(details.get(i).toString());
+                                if (!Check.isNull(detailJson)) {
+                                    KuaiShouCreative creative = new KuaiShouCreative();
+                                    creative.setId("" + advertiserId + detailJson.getLong("creative_id"));
+                                    creative.setAccountId(advertiserId);
+                                    creative.setCampaignId(detailJson.getLong("campaign_id"));
+                                    creative.setUnitId(detailJson.getLong("unit_id"));
+                                    creative.setCreativeId(detailJson.getLong("creative_id"));
+                                    creative.setCreativeName(detailJson.getString("creative_name"));
+                                    creative.setCreativeMaterialType(detailJson.getInteger("creative_material_type"));
+                                    if (!Check.isNull(detailJson.getJSONArray("material_url"))) {
+                                        creative.setMaterialUrl(detailJson.getJSONArray("material_url").toJSONString());
+                                    }
+
+                                    if (!Check.isNull(detailJson.getJSONArray("image_tokens"))) {
+                                        creative.setImageTokens(detailJson.getJSONArray("image_tokens").toJSONString());
+                                    }
+                                    creative.setStatus(detailJson.getInteger("status"));
+                                    creative.setPutStatus(detailJson.getInteger("put_status"));
+                                    creative.setCreateChannel(detailJson.getInteger("create_channel"));
+                                    creative.setReviewDetail(detailJson.getString("review_detail"));
+                                    creative.setCoverUrl(detailJson.getString("cover_url"));
+                                    creative.setImageToken(detailJson.getString("image_token"));
+                                    creative.setCoverWidth(detailJson.getString("cover_width"));
+                                    creative.setCoverHeight(detailJson.getString("cover_height"));
+                                    creative.setOverlayBgUrl(detailJson.getString("overlay_bg_url"));
+                                    creative.setOverlayBgImageToken(detailJson.getString("overlay_bg_image_token"));
+                                    creative.setStickerTitle(detailJson.getString("sticker_title"));
+                                    creative.setOverlayType(detailJson.getString("overlay_type"));
+                                    creative.setClickTrackUrl(detailJson.getString("click_track_url"));
+                                    creative.setImpressionUrl(detailJson.getString("impression_url"));
+                                    creative.setAdPhotoPlayedT3sUrl(detailJson.getString("ad_photo_played_t3s_url"));
+                                    creative.setCreativeCreateTime(detailJson.getDate("create_time"));
+                                    creative.setCreativeUpdateTime(detailJson.getDate("update_time"));
+                                    creative.setFirstFrameType(detailJson.getInteger("first_frame_type"));
+                                    creative.setShortSlogan(detailJson.getString("short_slogan"));
+                                    creative.setActionbarClickUrl(detailJson.getString("actionbar_click_url"));
+                                    JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
+
+                                    creative.setCreativeCategory(detailJson.getInteger("creative_category"));
+                                    if (!Check.isNull(detailJson.getJSONArray("creative_tag"))) {
+                                        creative.setCreativeTag(detailJson.getJSONArray("creative_tag").toJSONString());
+                                    }
+
+                                    if (!Check.isNull(displayInfoJson)) {
+                                        creative.setDescription(displayInfoJson.getString("description"));
+                                        creative.setActionBarText(displayInfoJson.getString("action_bar_text"));
+                                    }
+                                    creative.setCreateTime(new Date());
+                                    creative.setUpdateTime(new Date());
+                                    creative.setSiteId(detailJson.getLong("site_id"));
+                                    creative.setPhotoId(detailJson.getString("photo_id"));
+                                    if (detailJson.getLong("photo_id") == 0) {
+                                        JSONArray photoIds = new JSONArray();
+                                        JSONObject programmed_creative_material = detailJson.getJSONObject("programmed_creative_material");
+                                        if (!Check.isNull(programmed_creative_material)) {
+                                            creative.setProgrammedCreativeMaterial(programmed_creative_material.toJSONString());
+                                            JSONArray materials = programmed_creative_material.getJSONArray("materials");
+                                            if (!Check.isNull(materials)) {
+                                                for (int j = 0; j < materials.size(); j++) {
+                                                    JSONObject materialJson = materials.getJSONObject(j);
+                                                    if (!Check.isNull(materialJson)) {
+                                                        Long photo_id = materialJson.getLong("photo_id");
+                                                        photoIds.add(String.valueOf(photo_id));
+                                                    }
+                                                }
+                                                creative.setPhotoIds(photoIds.toJSONString());
+                                            }
+                                        }
+                                    }
+                                    creativeService.saveOrUpdate(creative);
+                                }
+
+                            }
+
+                        }
+                    }
+                } else {
+                    log.error("获取广告创意组返回结果异常,advertiserId:{},异常信息:{}", advertiserId, resultJson);
+                }
+
+            } else {
+                log.error("获取广告创意返回结果异常,advertiserId:{},异常信息:{}", advertiserId, resultJson);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
     /**
      * 获取token
      *
@@ -1863,6 +1978,85 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
 
     @Override
+    public Map<String, Object> batchCreativeCreate(String accessToken, Long advertiserId, JSONObject requestJson, Integer count) {
+        Map<String, Object> returnMap = new HashMap<>();
+        try {
+            String url = "https://ad.e.kuaishou.com/rest/openapi/v2/creative/batch/update";
+            requestJson.put("advertiser_id", advertiserId);
+            Map<String, String> header = new HashMap<String, String>();
+            header.put("Content-Type", " application/json");
+            header.put("Access-Token", accessToken);
+
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), header);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            log.info("快手创建创意返回:accountId:{},返回结果{}", advertiserId, resultJson);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    JSONObject dataJson = resultJson.getJSONObject("data");
+                    if (!Check.isNull(dataJson)) {
+                        JSONArray add_creative_ids = dataJson.getJSONArray("add_creative_ids");
+                        if (!Check.isNull(add_creative_ids)) {
+                            Thread thread = new Thread() {
+                                @Override
+                                public void run() {
+                                    try {
+                                        Thread.sleep(100);
+                                        getCreativeByCreativeIds(accessToken, advertiserId, add_creative_ids);
+                                    } catch (InterruptedException e) {
+                                        e.printStackTrace();
+                                    }
+
+                                }
+
+                            };
+                            thread.start();
+                        }
+
+                        returnMap.put("code", 0);
+                        returnMap.put("message", "success");
+                        returnMap.put("success", true);
+                    }
+                } else {
+                    if (code == 500000 && count <= 4) {
+                        creativeCreate(accessToken, advertiserId, requestJson, count + 1);
+                    }
+
+                    if (code == 400001 && resultJson.getString("message").equals("/rest/openapi/v2/creative/create已超日限")) {
+                        overRunSendMessageService.creativeOverRunSendMessage(advertiserId);
+                    }
+                    log.error("创建广告创意失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson, count + 1);
+                    returnMap.put("code", -1);
+                    returnMap.put("message", resultJson.getString("message"));
+                    returnMap.put("desc", "创意创建失败");
+                    returnMap.put("success", false);
+                }
+            } else {
+                if (count <= 4) {
+                    batchCreativeCreate(accessToken, advertiserId, requestJson, count + 1);
+                }
+
+                log.error("快手创建广告创意返回内容为空,advertiser_id:{},入参:{}", advertiserId, requestJson);
+                returnMap.put("code", -1);
+                returnMap.put("message", "系统异常");
+                returnMap.put("desc", "result is null");
+                returnMap.put("success", false);
+            }
+
+        } catch (Exception e) {
+            log.error("创建广告创意失败,advertiser_id:{}", advertiserId);
+            returnMap.put("code", -1);
+            returnMap.put("message", "error");
+            returnMap.put("desc", "Interface exception");
+            returnMap.put("success", false);
+            e.printStackTrace();
+        }
+        return returnMap;
+
+    }
+
+
+    @Override
     public Map<String, Object> videoUpload(Long advertiserId, String accessToken, String videoUrl) {
         Map<String, Object> returnMap = new HashMap<>();
         try {
@@ -2620,11 +2814,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             List<KuaiShouImageGet> imageGets = new ArrayList<>();
             for (int i = 0; i < details.size(); i++) {
                 var detailJson = details.getJSONObject(i);
-
-               /* if (Check.isNull(detailJson.getString("signature"))) {
-                    continue;
-                }*/
-
                 var kuaiShouImageGet = JSONObject.toJavaObject(detailJson, KuaiShouImageGet.class);
 
                 if (StringUtils.isBlank(String.valueOf(kuaiShouImageGet.getImageToken()))) {

+ 0 - 3
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatTokenServiceImpl.java

@@ -19,7 +19,6 @@ public class WechatTokenServiceImpl implements IWechatTokenService {
             params.put("corpid", QYWxConstant.QYWX_CORP_ID);
             params.put("corpsecret", QYWxConstant.QYWX_CORP_SECRET);
             String resultStr = HttpUtils.httpGetRequest(QYWxConstant.QYWX_API_URL + QYWxConstant.QYWX_GET_TOKEN, null, params);
-            //System.out.println(resultStr);
             JSONObject resultJson = JSONObject.parseObject(resultStr);
             Integer errcode = resultJson.getInteger("errcode");
             if (errcode == 0) {
@@ -43,7 +42,6 @@ public class WechatTokenServiceImpl implements IWechatTokenService {
             params.put("corpid", QYWxConstant.QYWX_CORP_ID);
             params.put("corpsecret", QYWxConstant.QYWX_OA_CORP_SECRET);
             String resultStr = HttpUtils.httpGetRequest(QYWxConstant.QYWX_API_URL + QYWxConstant.QYWX_GET_TOKEN, null, params);
-            //System.out.println(resultStr);
             JSONObject resultJson = JSONObject.parseObject(resultStr);
             Integer errcode = resultJson.getInteger("errcode");
             if (errcode == 0) {
@@ -74,7 +72,6 @@ public class WechatTokenServiceImpl implements IWechatTokenService {
             params.put("corpid", QYWxConstant.QYWX_CORP_ID);
             params.put("corpsecret", QYWxConstant.QYWX_APPROVA_CORP_SECRET);
             String resultStr = HttpUtils.httpGetRequest(QYWxConstant.QYWX_API_URL + QYWxConstant.QYWX_GET_TOKEN, null, params);
-            //System.out.println(resultStr);
             JSONObject resultJson = JSONObject.parseObject(resultStr);
             Integer errcode = resultJson.getInteger("errcode");
             if (errcode == 0) {

+ 8 - 8
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml

@@ -244,7 +244,7 @@
         sum(report.show_material)                                     as 'show_num',
         sum(report.convert_material)                                  as 'convert',
         report.image_url                                           as 'image_url',
-        report.code                                           as 'signature',
+        report.material_id                                           as 'signature',
         group_concat(distinct report.project_name)                    as 'project_name',
         report.stat_datetime                                          as 'stat_date',
         report.plane_id as 'user_id',
@@ -253,7 +253,7 @@
             left join ctop_bytedance_image_info imageInfo on imageInfo.material_id = report.material_id
         where
         1=1
-        and report.code is not null
+        and report.material_id is not null
         <if test="startDate!=null">
             and report.stat_datetime &gt;= #{startDate}
         </if>
@@ -267,9 +267,9 @@
             </foreach>
         </if>
         <if test="code!=null">
-            and report.code = #{code}
+            and report.material_id = #{code}
         </if>
-        group by report.code
+        group by report.material_id
         order by sum(report.cost) desc
     </select>
 
@@ -333,7 +333,7 @@ where a.plane_id is not null and a.plane_name is null
         sum(report.show_material)                                     as 'show_num',
         sum(report.convert_material)                                  as 'convert',
         report.image_url                                           as 'image_url',
-        report.code                                           as 'signature',
+        report.material_id                                           as 'signature',
         group_concat(distinct report.project_name)                    as 'project_name',
         report.stat_datetime                                          as 'stat_date',
         report.plane_id as 'user_id',
@@ -341,7 +341,7 @@ where a.plane_id is not null and a.plane_name is null
         from ctop_bytedance_report_image_daily report
         where
         1=1
-        and report.code is not null
+        and report.material_id is not null
         <if test="startDate!=null">
             and report.stat_datetime &gt;= #{startDate}
         </if>
@@ -355,9 +355,9 @@ where a.plane_id is not null and a.plane_name is null
             </foreach>
         </if>
         <if test="code!=null">
-            and report.code = #{code}
+            and report.material_id = #{code}
         </if>
-        group by report.code
+        group by report.material_id
         order by sum(report.cost) desc
     </select>
 

+ 0 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

@@ -82,7 +82,6 @@ public class ReportServiceImpl implements IReportService {
         config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase;
         JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(conditions, config));
         JSONObject getObject = getAdvertiserStat(token, jsonObject);
-        System.out.println(getObject);
         if(null == getObject){
             XxlJobLogger.log("头条广告主数据获取异常");
             return;