Jelajahi Sumber

素材标签逻辑

syh 4 tahun lalu
induk
melakukan
bd2aa48364
19 mengubah file dengan 421 tambahan dan 85 penghapusan
  1. 160 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialTagInfoController.java
  2. 25 22
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TagInfoController.java
  3. 1 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/controller/FileController.java
  4. 20 10
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  5. 50 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialTagInfo.java
  6. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/TagInfo.java
  7. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialTagInfoMapper.java
  8. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialTagInfoMapper.xml
  9. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/model/TagInfoTreeModel.java
  10. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialTagInfoService.java
  11. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ITagInfoService.java
  12. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountLoginServiceImpl.java
  13. 19 31
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  14. 71 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagInfoServiceImpl.java
  15. 10 3
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/TagInfoServiceImpl.java
  16. 1 3
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/KuaishouUtil.java
  17. 5 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java
  18. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAgentService.java
  19. 8 9
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentServiceImpl.java

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

@@ -0,0 +1,160 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.MaterialTagInfo;
+import cn.com.ctop.common.module.service.IMaterialTagInfoService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+import java.util.Map;
+
+/**
+ * 素材标签信息
+ * @author jeecg-boot
+ * @date   2020-08-27
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="素材标签信息")
+@RestController
+@RequestMapping("/ctop/materialTagInfo")
+public class MaterialTagInfoController {
+	@Autowired
+	private IMaterialTagInfoService materialTagInfoService;
+
+	/**
+	  * 分页列表查询
+	 * @param materialTagInfo
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<MaterialTagInfo>> queryPageList(MaterialTagInfo materialTagInfo,
+                                                        @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                        @RequestParam(name="pageSize", defaultValue="100") Integer pageSize,
+                                                        HttpServletRequest req) {
+		Result<IPage<MaterialTagInfo>> result = new Result<>();
+		QueryWrapper<MaterialTagInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialTagInfo, req.getParameterMap());
+		Page<MaterialTagInfo> page = new Page<>(pageNo, pageSize);
+		queryWrapper.eq("status",1);
+		IPage<MaterialTagInfo> pageList = materialTagInfoService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param materialTagInfo
+	 * @return
+	 */
+	@ApiOperation(value="素材标签信息-添加", notes="素材标签信息-添加")
+	@PostMapping(value = "/add")
+	public Result<MaterialTagInfo> add(@RequestBody MaterialTagInfo materialTagInfo) {
+		Result<MaterialTagInfo> result = new Result<>();
+		try {
+			materialTagInfoService.save(materialTagInfo);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param materialTagInfo
+	 * @return
+	 */
+	@ApiOperation(value="素材标签信息-编辑", notes="素材标签信息-编辑")
+	@PutMapping(value = "/edit")
+	public Result<MaterialTagInfo> edit(@RequestBody MaterialTagInfo materialTagInfo) {
+		Result<MaterialTagInfo> result = new Result<>();
+		MaterialTagInfo materialTagInfoEntity = materialTagInfoService.getById(materialTagInfo.getId());
+		if(materialTagInfoEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = materialTagInfoService.updateById(materialTagInfo);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="素材标签信息-通过id删除", notes="素材标签信息-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			materialTagInfoService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@ApiOperation(value="素材标签信息-批量删除", notes="素材标签信息-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<MaterialTagInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<MaterialTagInfo> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			materialTagInfoService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	@PostMapping("mark")
+	public Map<String,Object> mark(@RequestBody JSONObject data){
+		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		return materialTagInfoService.mark(data,user);
+	}
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="素材标签信息-通过id查询", notes="素材标签信息-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<MaterialTagInfo> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<MaterialTagInfo> result = new Result<>();
+		MaterialTagInfo materialTagInfo = materialTagInfoService.getById(id);
+		if(materialTagInfo==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(materialTagInfo);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+}

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

@@ -9,12 +9,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.modules.system.service.ISysDepartService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
 
  /**
@@ -41,7 +41,7 @@ public class TagInfoController {
 	@GetMapping(value = "/list")
 	public Result<IPage<TagInfo>> queryPageList(TagInfo tagInfo,
 												@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-												@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+												@RequestParam(name="pageSize", defaultValue="100") Integer pageSize,
 												HttpServletRequest req) {
 		Result<IPage<TagInfo>> result = new Result<>();
 		QueryWrapper<TagInfo> queryWrapper = QueryGenerator.initQueryWrapper(tagInfo, req.getParameterMap());
@@ -61,6 +61,26 @@ public class TagInfoController {
 	public Result<TagInfo> add(@RequestBody TagInfo tagInfo) {
 		Result<TagInfo> result = new Result<>();
 		try {
+			tagInfo.setDelFlag(0);
+			tagInfo.setStatus(1);
+			int level = 1;
+			Long parentId = tagInfo.getParentId();
+			if(null!=parentId){
+				TagInfo parentTag = tagInfoService.getById(parentId);
+				if(null == parentTag){
+					result.error500("父级标签不存在");
+					return result;
+				}
+				String tagCode = parentTag.getTagCode()+tagInfo.getTagCode();
+				level = parentTag.getLevel()+1;
+				TagInfo getTag = tagInfoService.getByTagCode(tagCode);
+				if(null!=getTag){
+					result.error500("标签编码已存在");
+					return result;
+				}
+				tagInfo.setTagCode(tagCode);
+			}
+			tagInfo.setLevel(level);
 			tagInfoService.save(tagInfo);
 			result.success("添加成功!");
 		} catch (Exception e) {
@@ -75,13 +95,14 @@ public class TagInfoController {
 	 * @param tagInfo
 	 * @return
 	 */
-	@PutMapping(value = "/edit")
+	@PostMapping("/edit")
 	public Result<TagInfo> edit(@RequestBody TagInfo tagInfo) {
-		Result<TagInfo> result = new Result<TagInfo>();
+		Result<TagInfo> result = new Result<>();
 		TagInfo tagInfoEntity = tagInfoService.getById(tagInfo.getId());
 		if(tagInfoEntity==null) {
 			result.error500("未找到对应实体");
 		}else {
+			tagInfo.setUpdateTime(new Date());
 			boolean ok = tagInfoService.updateById(tagInfo);
 			if(ok) {
 				result.success("修改成功!");
@@ -92,22 +113,6 @@ public class TagInfoController {
 	}
 
 	/**
-	  *   通过id删除
-	 * @param id
-	 * @return
-	 */
-	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
-		try {
-			tagInfoService.removeById(id);
-		} catch (Exception e) {
-			log.error("删除失败",e.getMessage());
-			return Result.error("删除失败!");
-		}
-		return Result.ok("删除成功!");
-	}
-
-	/**
 	  *  批量删除
 	 * @param ids
 	 * @return
@@ -142,8 +147,6 @@ public class TagInfoController {
 		return result;
 	}
 
-	@Autowired
-    private ISysDepartService sysDepartService;
 	@RequestMapping(value = "/queryTreeList", method = RequestMethod.GET)
     public Result<List<TagInfoTreeModel>> queryTreeList() {
 	    Result<List<TagInfoTreeModel>> result = new Result<>();

+ 1 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/controller/FileController.java

@@ -45,8 +45,7 @@ public class FileController {
 
     @PostMapping("/insertV2")
     public Map<String, Object> insertV2(@RequestBody JSONObject json) {
-        LoginUser user = (LoginUser) SecurityUtils.getSubject()
-                .getPrincipal();
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         json.put("userId", user.getId());
         return materialInfoService.correlationUpload(json);
     }

+ 20 - 10
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -43,10 +43,11 @@ public class SampleTest {
 
     @Test
     public void loadBytedanceCreativeData() {
-     //   refreshTokenService.getKuaiShouAgentRefresh();
-        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
-        kuaiShouDailyAgentService.getAgentReportByPage(nowDate, nowDate);
+        List<UserAllocation>allocations = allocationService.getByParams(428L,null,0);
+        for(UserAllocation allocation:allocations){
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
+            reportService.getAdvertiserReport(token,new Date(),new Date(),CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+        }
     }
 
     @Autowired
@@ -57,9 +58,14 @@ public class SampleTest {
     public void loadKuaishouCookie(){
         List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY,1);
         if(list!=null&&!list.isEmpty()){
+            int i=0;
             for (BindAccountLogin login:list) {
                 if(null==login.getCookie()||"".equals(login.getCookie().trim())){
+                    if(i>5){
+                        break;
+                    }
                     kuaishouWebInterfaceService.getkuaishouWebLoginCookie(login);
+                    i++;
                 }
             }
         }
@@ -114,11 +120,15 @@ public class SampleTest {
 //            kuaishouReportDailyAgentService.getReport(currentDate,DateUtils.getNowDate("yyyy-MM-dd"));
 //        }
 //
-//        int currentPage = 1;
-//        while (kuaishouReportDailyAgentService.getAccount(currentPage)){
-//            currentPage++;
-//        }
-        String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(),-1));
-        kuaishouReportDailyAgentService.getReport(currentDate,DateUtils.getNowDate("yyyy-MM-dd"));
+        kuaishouReportDailyAgentService.loginAgent();
+        try {
+            for(int i=1;i<30;i++){
+                kuaishouReportDailyAgentService.getAccount(i);
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+//        String currentDate = D  ateUtils.formatDate(DateUtils.addDay(new Date(),-1));
+//        kuaishouReportDailyAgentService.getReport(currentDate,DateUtils.getNowDate("yyyy-MM-dd"));
     }
 }

+ 50 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialTagInfo.java

@@ -0,0 +1,50 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 素材标签信息
+ * @author jeecg-boot
+ * @date   2020-08-27
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_material_tag_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_material_tag_info对象", description="素材标签信息")
+public class MaterialTagInfo {
+
+	/**id*/
+	@TableId(type = IdType.AUTO)
+    private Long id;
+	private String code;
+	private Integer status;
+	private String tagName;
+	private String tagCode;
+	private String userId;
+	private Date createTime;
+	private Date updateTime;
+
+	public MaterialTagInfo(String code, TagInfo tagInfo,String userId) {
+		this.code = code;
+		this.status = 1;
+		this.tagCode = tagInfo.getTagCode();
+		this.tagName = tagInfo.getTagName();
+		this.userId = userId;
+		this.createTime = new Date();
+		this.updateTime = new Date();
+	}
+
+	public MaterialTagInfo() {
+
+	}
+}

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/TagInfo.java

@@ -33,6 +33,7 @@ public class TagInfo {
 	private Integer tagOrder;
 	private String description;
 	private String tagCode;
+	private Integer level;
 	private Integer status;
 	private Integer delFlag;
 	private Date createTime;

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialTagInfoMapper.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.MaterialTagInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 素材标签信息
+ * @author: jeecg-boot
+ * @date:   2020-08-27
+ * @cersion: V1.0
+ */
+public interface MaterialTagInfoMapper extends BaseMapper<MaterialTagInfo> {
+
+}

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialTagInfoMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.common.module.mapper.MaterialTagInfoMapper">
+
+</mapper>

+ 10 - 0
module-common/src/main/java/cn/com/ctop/common/module/model/TagInfoTreeModel.java

@@ -38,6 +38,7 @@ public class TagInfoTreeModel implements Serializable {
     private String tagCode;
     private Integer status;
     private Integer delFlag;
+    private Integer level;
     private Date createTime;
     private Date updateTime;
     private List<TagInfoTreeModel> children = new ArrayList<>();
@@ -172,6 +173,7 @@ public class TagInfoTreeModel implements Serializable {
         this.delFlag = tagInfo.getDelFlag();
         this.createTime = tagInfo.getCreateTime();
         this.updateTime = tagInfo.getUpdateTime();
+        this.level = tagInfo.getLevel();
     }
 
 
@@ -189,4 +191,12 @@ public class TagInfoTreeModel implements Serializable {
     public TagInfoTreeModel() {
 
     }
+
+    public Integer getLevel() {
+        return level;
+    }
+
+    public void setLevel(Integer level) {
+        this.level = level;
+    }
 }

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialTagInfoService.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.MaterialTagInfo;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.system.vo.LoginUser;
+
+import java.util.Map;
+
+/**
+ * @Description: 素材标签信息
+ * @Author: jeecg-boot
+ * @Date:   2020-08-27
+ * @Version: V1.0
+ */
+public interface IMaterialTagInfoService extends IService<MaterialTagInfo> {
+    Map<String, Object> mark(JSONObject data, LoginUser loginUser);
+}

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/ITagInfoService.java

@@ -16,4 +16,5 @@ public interface ITagInfoService extends IService<TagInfo> {
 
     List<TagInfoTreeModel> queryTreeList();
 
+    TagInfo getByTagCode(String tagCode);
 }

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountLoginServiceImpl.java

@@ -111,6 +111,7 @@ public class BindAccountLoginServiceImpl extends ServiceImpl<BindAccountLoginMap
         if(status!=null){
             queryWrapper.eq("status",status);
         }
+        queryWrapper.orderByDesc("id");
         return this.list(queryWrapper);
     }
 

+ 19 - 31
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -358,18 +358,14 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         try {
             Map<String, Object> requestMap = new HashMap<>();
             requestMap.put("userId", userId);
-
             Integer totalCount = materialInfoMapper.selectCountByMap(requestMap);
             json.put("total", totalCount);
-
             requestMap.put("status", 0);
             Integer waitAudit = materialInfoMapper.selectCountByMap(requestMap);
             json.put("waitAudit", waitAudit);
-
             requestMap.put("status", 1);
             Integer passAudit = materialInfoMapper.selectCountByMap(requestMap);
             json.put("passAudit", passAudit);
-
             requestMap.put("status", 2);
             Integer refuseAudit = materialInfoMapper.selectCountByMap(requestMap);
             json.put("refuseAudit", refuseAudit);
@@ -384,7 +380,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return materialInfoMapper.getRoleCodeByUserId(userId);
     }
 
-
     @Override
     public void getFile(MaterialInfo materialInfo, String mediaId) {
         uploadExecutorService.submit(new Runnable() {
@@ -439,7 +434,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                                 // 默认抽帧 素造供应商
                                 Long templateId = MaterialSupplierEnum.getTemplateIdBySize(Integer.valueOf(width), Integer.valueOf(height));
                                 if (!Check.isNull(templateId)) {
-
                                     Thread thread = new Thread() {
                                         @Override
                                         public void run() {
@@ -447,15 +441,9 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                                         }
                                     };
                                     thread.start();
-
-
                                 }
                             }
-
-
                         }
-
-
                     } catch (FileNotFoundException e) {
                         e.printStackTrace();
                     } catch (IOException e) {
@@ -526,11 +514,11 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         Map<String, Object> resultMap = new HashMap<>();
         try {
             String type = json.getString("type");
+
             String url = "";
             if (!Check.isNull(json.getString("url"))) {
                 url = "https:" + json.getString("url");
             }
-
             MaterialInfo info = new MaterialInfo();
             Long projectId = json.getLong("projectId");
             String code = json.getString("code");
@@ -563,23 +551,19 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 String coverUrl = CloudVideoProcessUtil.videoCutPictureHandle(videoUrl, loadImage);
                 info.setCoverUrl(coverUrl);
                 Thread thread = new Thread() {
-                    @Override
-                    public void run() {
-                        try {
+                        @Override
+                        public void run() { try {
                             log.info("开始抽帧,code:{}", code);
                             materialCutFrameService.getTencentCutFrame(videoUrl, code, coverUrl);
                         } catch (Exception e) {
                             e.printStackTrace();
-                        }
-                    }
+                        } }
                 };
                 thread.start();
             } else {
                 info.setCoverUrl(cutFrame.getUrl());
             }
-
             this.save(info);
-
             JSONArray imageArr = json.getJSONArray("imageArr");
             if (!Check.isNull(imageArr)) {
                 JSONObject imageJson = new JSONObject();
@@ -589,34 +573,27 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 imageJson.put("imageArr", imageArr);
                 materialImageInfoService.insertImage(imageJson);
             }
-
             Map<String, Object> deleteMap = new HashMap<>();
             deleteMap.put("material_id", info.getCode());
             JSONObject ascription = json.getJSONObject("ascription");
             if (!Check.isNull(ascription)) {
                 MaterialAscription materialAscription = new MaterialAscription();
                 materialAscription.setMaterialId(info.getCode());
-                // 剪辑人
                 materialAscription.setClipId(ascription.getString("clipId"));
-                // 拍摄人id
                 materialAscription.setShotId(ascription.getString("shotId"));
-                // 策划id
                 materialAscription.setPlanId(ascription.getString("planId"));
-                //平面id
                 materialAscription.setPlaneId(ascription.getString("planeId"));
                 materialAscriptionMapper.deleteByMap(deleteMap);
-                int i = materialAscriptionMapper.insert(materialAscription);
-                if (i > 0) {
+                int result = materialAscriptionMapper.insert(materialAscription);
+                if (result > 0) {
                     log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
                 }
-
             }
-
             JSONArray tag = json.getJSONArray("tag");
             if (!Check.isNull(tag)) {
                 materialTagMapper.deleteByMap(deleteMap);
-                for (int i = 0; i < tag.size(); i++) {
-                    String tagStr = tag.getString(i);
+                for (int j = 0; j < tag.size(); j++) {
+                    String tagStr = tag.getString(j);
                     if (!Check.isNull(tagStr)) {
                         MaterialTag materialTag = new MaterialTag();
                         materialTag.setMaterialId(info.getCode());
@@ -625,6 +602,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                     }
                 }
             }
+            JSONArray tagList = json.getJSONArray("tagList");
+            for(int m=0;m<tagList.size();m++){
+                Long tagId = tagList.getLong(m);
+                TagInfo tagInfo = tagInfoService.getById(tagId);
+                MaterialTagInfo setTag= new MaterialTagInfo(code,tagInfo,userId);
+                materialTagInfoService.save(setTag);
+            }
             getFile(info, project.getMediaId());
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
@@ -633,6 +617,10 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         }
         return resultMap;
     }
+    @Autowired
+    private ITagInfoService tagInfoService;
+    @Autowired
+    private IMaterialTagInfoService materialTagInfoService;
 
     @Override
     public Map<String, Object> insertImage(JSONObject imageJson) {

+ 71 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagInfoServiceImpl.java

@@ -0,0 +1,71 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.entity.MaterialTagInfo;
+import cn.com.ctop.common.module.entity.TagInfo;
+import cn.com.ctop.common.module.mapper.MaterialTagInfoMapper;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.IMaterialTagInfoService;
+import cn.com.ctop.common.module.service.ITagInfoService;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.common.system.vo.LoginUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 素材标签信息
+ * @author jeecg-boot
+ * @date   2020-08-27
+ * @version V1.0
+ */
+@Service
+public class MaterialTagInfoServiceImpl extends ServiceImpl<MaterialTagInfoMapper, MaterialTagInfo> implements IMaterialTagInfoService {
+    @Autowired
+    private IMaterialInfoService materialInfoService;
+    @Autowired
+    private ITagInfoService tagInfoService;
+    @Override
+    public Map<String, Object> mark(JSONObject data, LoginUser user) {
+        Map<String,Object>result = new HashMap<>();
+        String code = data.getString("code");
+        if(null==code||"".equals(code.trim())){
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
+            return result;
+        }
+        MaterialInfo materialInfo = materialInfoService.getMaterialInfoByCode(code);
+        if(null == materialInfo){
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
+            return result;
+        }
+        JSONArray tagList = data.getJSONArray("tagList");
+        if(null == tagList||tagList.size()<=6){
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
+            return result;
+        }
+        //删除之前的标签信息
+        this.deleteByCode(code);
+        for(int i=0;i<tagList.size();i++){
+            Long tagId = tagList.getLong(i);
+            TagInfo tagInfo = tagInfoService.getById(tagId);
+            MaterialTagInfo setTag= new MaterialTagInfo(code,tagInfo,user.getId());
+            this.save(setTag);
+        }
+        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    private void deleteByCode(String code) {
+        UpdateWrapper<MaterialTagInfo>updateWrapper = new UpdateWrapper<>();
+        updateWrapper.eq("code",code).set("status",0).set("update_time",new Date());
+        this.update(updateWrapper);
+    }
+}

+ 10 - 3
module-common/src/main/java/cn/com/ctop/common/module/service/impl/TagInfoServiceImpl.java

@@ -6,10 +6,9 @@ import cn.com.ctop.common.module.model.TagInfoTreeModel;
 import cn.com.ctop.common.module.service.ITagInfoService;
 import cn.com.ctop.common.module.utils.FindstagInfosChildrenUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.jeecg.common.constant.CacheConstant;
 import org.jeecg.common.constant.CommonConstant;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -26,7 +25,6 @@ public class TagInfoServiceImpl extends ServiceImpl<TagInfoMapper, TagInfo> impl
     /**
      * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端
      */
-    @Cacheable(value = CacheConstant.SYS_TAGINFOS_CACHE)
     @Override
     public List<TagInfoTreeModel> queryTreeList() {
         LambdaQueryWrapper<TagInfo> query = new LambdaQueryWrapper<>();
@@ -37,4 +35,13 @@ public class TagInfoServiceImpl extends ServiceImpl<TagInfoMapper, TagInfo> impl
         List<TagInfoTreeModel> listResult = FindstagInfosChildrenUtil.wrapTreeDataToTreeList(list);
         return listResult;
     }
+
+    @Override
+    public TagInfo getByTagCode(String tagCode) {
+        QueryWrapper<TagInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("tag_code",tagCode);
+        queryWrapper.orderByDesc("id");
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+    }
 }

+ 1 - 3
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/KuaishouUtil.java

@@ -103,9 +103,7 @@ public class KuaishouUtil {
         return crawlerLog;
     }
     private static String randomRequestId() {
-
         int temp = 436669999 - 436650000;
-
         int nextInt = new Random().nextInt(temp) + 436650000;
         return String.valueOf(nextInt);
     }
@@ -114,7 +112,7 @@ public class KuaishouUtil {
         HttpEntity httpEntity = new HttpEntity();
         Map<String,String> staticParams = HttpParamUtil.urlParamToMap(urlParam);
         Map<String,String> dynamicParams = HttpParamUtil.urlParamToMap(bodyParam);
-        List<HttpCookie> cookies = new ArrayList<HttpCookie>();
+        List<HttpCookie> cookies = new ArrayList<>();
         HttpCookie cookie = new HttpCookie();
         cookie.setDomain(url.replace("https://","").replace("http://",""));
         cookie.setName("token");

+ 5 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

@@ -674,10 +674,10 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
             e.printStackTrace();
         }
         ChromeOptions chromeOptions = new ChromeOptions();
-        chromeOptions.addArguments("--headless");
-        chromeOptions.addArguments("--no-sandbox");
-        chromeOptions.addArguments("--disable-dev-shm-usage");
-        chromeOptions.addArguments("--disable-gpu");
+//        chromeOptions.addArguments("--headless");
+//        chromeOptions.addArguments("--no-sandbox");
+//        chromeOptions.addArguments("--disable-dev-shm-usage");
+//        chromeOptions.addArguments("--disable-gpu");
         chromeOptions.addArguments("--window-size=1920,1080");
         chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
         chromeOptions.setAcceptInsecureCerts(true);
@@ -694,7 +694,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
             //点击登录
             webDriver.findElement(By.className("foot")).click();
             //等待2秒用于页面加载,保证Cookie响应全部获取。
-            Thread.sleep(10000);
+            Thread.sleep(1000);
             if (null!=webDriverGetElement(webDriver,By.tagName("iframe"))) {
                 log.error("【错误】快手登录出现验证码!");
                 File scrFile = captureElement(webDriver.findElement(By.tagName("iframe")));

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

@@ -16,4 +16,5 @@ public interface IKuaishouReportDailyAgentService extends IService<KuaishouRepor
     void replaceBatch(List<KuaiShouDailyAgent> list);
     void getReport(String startDate,String endDate);
     boolean getAccount(int currentPage);
+    boolean loginAgent();
 }

+ 8 - 9
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentServiceImpl.java

@@ -78,16 +78,17 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
         }
     }
 
+    @Override
     public boolean loginAgent() {
         boolean loginStatus = false;
         System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
         String url = "https://agent.e.kuaishou.com";
         ChromeOptions chromeOptions = new ChromeOptions();
-        chromeOptions.addArguments("--headless");
-        chromeOptions.addArguments("--no-sandbox");
-        chromeOptions.addArguments("--disable-dev-shm-usage");
-        chromeOptions.addArguments("--incognito");
-        chromeOptions.addArguments("--disable-gpu");
+//        chromeOptions.addArguments("--headless");
+//        chromeOptions.addArguments("--no-sandbox");
+//        chromeOptions.addArguments("--disable-dev-shm-usage");
+//        chromeOptions.addArguments("--incognito");
+//        chromeOptions.addArguments("--disable-gpu");
         chromeOptions.addArguments("--window-size=1920,1080");
         chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
         chromeOptions.setAcceptInsecureCerts(true);
@@ -189,9 +190,6 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
     public boolean getAccount(int currentPage) {
         boolean hasNextPage = false;
         try {
-            if (currentPage == 1 && !loginAgent()) {
-                return hasNextPage;
-            }
             Map<String, String> headerMap = new HashMap<>();
             headerMap.put("Accept", "application/json");
             headerMap.put("Accept-Encoding", "gzip, deflate, br");
@@ -204,6 +202,7 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
             String postData = "{\"pageInfo\":{\"currentPage\":" + currentPage + ",\"pageSize\":200,\"total\":1000},\"reviewStatus\":\"-1\",\"selectType\":1,\"selectValue\":\"\",\"createBeginTime\":0,\"createEndTime\":0}";
             String listUrl = "https://agent.e.kuaishou.com/rest/dsp/agent/account/list";
             String result = HttpUtils2.httpPostRequestTest(listUrl, postData, headerMap);
+            System.out.println(result);
             ObjectMapper mapper = new ObjectMapper();
             mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
             JsonNode resultNode = mapper.readTree(result);
@@ -243,7 +242,7 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
     public void getReport(String startDate, String endDate) {
         try {
             if (!loginAgent()) {
-                return; 
+                return;
             }
             String currentDate = startDate;
             Map<String, String> headerMap = new HashMap<>();