Browse Source

添加头条视频关联文案接口

songyh 4 years ago
parent
commit
17484999c1
17 changed files with 459 additions and 211 deletions
  1. 0 2
      jeecg-boot-module-system/pom.xml
  2. 133 69
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  3. 8 8
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  4. 4 11
      jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai
  5. 3 3
      jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/mapper/${entityName}Mapper.javai
  6. 4 4
      jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/service/I${entityName}Service.javai
  7. 1 1
      jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/service/impl/${entityName}ServiceImpl.javai
  8. 1 18
      jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties
  9. 6 80
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  10. 20 13
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  11. 0 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  12. 144 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/BytedanceVideoSlogenInfoController.java
  13. 50 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/BytedanceVideoSlogenInfo.java
  14. 14 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceVideoSlogenInfoMapper.java
  15. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/BytedanceVideoSlogenInfoMapper.xml
  16. 20 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceVideoSlogenInfoService.java
  17. 46 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceVideoSlogenInfoServiceImpl.java

+ 0 - 2
jeecg-boot-module-system/pom.xml

@@ -75,13 +75,11 @@
             <groupId>cn.com.ctop</groupId>
             <artifactId>module-toutiao</artifactId>
             <version>2.0.2</version>
-            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>cn.com.ctop</groupId>
             <artifactId>module-oa</artifactId>
             <version>2.0.2</version>
-            <scope>compile</scope>
         </dependency>
 
         <dependency>

+ 133 - 69
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -6,7 +6,10 @@ import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.*;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
+
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -61,7 +64,15 @@ public class MaterialInfoController {
     @Autowired
     private IMaterialImageInfoService iMaterialImageInfoService;
     @Autowired
-    private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
+    private IProjectService projectService;
+    @Autowired
+    private IMessageTemplate messageTemplate;
+    @Autowired
+    private ISysRoleService roleService;
+    @Autowired
+    private ISendMessageService sendMessageService;
+    @Autowired
+    private IBytedanceVideoSlogenInfoService slogenInfoService;
 
 
     @GetMapping("/supplierWatermark")
@@ -104,12 +115,9 @@ public class MaterialInfoController {
         return result;
     }
 
-
     @PostMapping("/correlationUpload")
     public Map<String, Object> insertFile(@RequestBody JSONObject json) {
-        LoginUser user = (LoginUser) SecurityUtils.getSubject()
-                .getPrincipal();
-
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         json.put("userId", user.getId());
         return materialInfoService.correlationUpload(json);
     }
@@ -132,11 +140,9 @@ public class MaterialInfoController {
         return materialInfoService.report(userId);
     }
 
-
     @GetMapping(value = "/getDetail")
     public JSONObject getDetail(String materialId) {
         return materialInfoService.getDetail(materialId);
-
     }
 
     @PostMapping("watermark")
@@ -160,7 +166,6 @@ public class MaterialInfoController {
         return result;
     }
 
-
     @GetMapping("/excellent/list")
     public Result<IPage<MaterialInfo>> excellentList(MaterialInfo materialInfo,
                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@@ -189,23 +194,18 @@ public class MaterialInfoController {
         return result;
     }
 
-    @Autowired
-    private ISysRoleService roleService;
-
+    @Deprecated
     @GetMapping(value = "/list")
     public Result<IPage<MaterialInfo>> queryPageList(MaterialInfo materialInfo,
                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                      HttpServletRequest req) {
-
         Result<IPage<MaterialInfo>> result = new Result<>();
         String materialName = materialInfo.getMaterialName();
         String startDate = materialInfo.getStartDate();
         String endDate = materialInfo.getEndDate();
         materialInfo.setStartDate(null);
         materialInfo.setEndDate(null);
-
-
         materialInfo.setMaterialName(null);
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         materialInfo.setCreateTime(null);
@@ -272,7 +272,6 @@ public class MaterialInfoController {
                     material.setByteDance(JSONObject.parseObject(byteDanceString));
                 }
 
-
                 Project project = projectService.getById(material.getProjectId());
                 if (!Check.isNull(project)) {
                     material.setMediaId(project.getMediaId());
@@ -283,17 +282,9 @@ public class MaterialInfoController {
                 imageInfoQueryWrapper.eq("video_id", material.getCode());
                 imageInfoQueryWrapper.eq("status", 0);
                 List<MaterialImageInfo> imageInfoList = iMaterialImageInfoService.list(imageInfoQueryWrapper);
-                if (Check.isNull(imageInfoList)) {
-                    material.setWhetherUnaudited(false);
-                } else {
-                    material.setWhetherUnaudited(true);
-                }
-
+                material.setWhetherUnaudited(!Check.isNull(imageInfoList));
             }
-
-
         }
-
         result.setSuccess(true);
         result.setResult(pageList);
         return result;
@@ -337,7 +328,6 @@ public class MaterialInfoController {
         }
     }
 
-
     @AutoLog(value = "素材信息-分页列表查询")
     @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
     @GetMapping(value = "/supplierList")
@@ -345,8 +335,6 @@ public class MaterialInfoController {
                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                     HttpServletRequest req) {
-
-
         Result<IPage<MaterialInfo>> result = new Result<>();
         String materialName = materialInfo.getMaterialName();
         materialInfo.setMaterialName(null);
@@ -356,7 +344,6 @@ public class MaterialInfoController {
         materialInfo.setEndDate(null);
 
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
-
         if (!Check.isNull(materialInfo.getUserId())) {
             String roleCode = roleService.getRoleCodeByUserId(materialInfo.getUserId());
             if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
@@ -408,7 +395,6 @@ public class MaterialInfoController {
 
             }
 
-
         }
 
         result.setSuccess(true);
@@ -468,22 +454,12 @@ public class MaterialInfoController {
     }
 
     /**
-     * 编辑
-     *
+     * 头条素材信息编辑
      * @param materialInfo
      * @return
      */
-    @Autowired
-    private IProjectService projectService;
-    @Autowired
-    private IMessageTemplate messageTemplate;
-    @Autowired
-    private ISendMessageService sendMessageService;
-
-    @AutoLog(value = "素材信息-编辑")
-    @ApiOperation(value = "素材信息-编辑", notes = "素材信息-编辑")
-    @PutMapping(value = "/edit")
-    public Result<MaterialInfo> edit(@RequestBody MaterialInfo materialInfo) {
+    @PutMapping(value = "/bytedance/edit")
+    public Result<MaterialInfo> bytedanceEdit(@RequestBody MaterialInfo materialInfo) {
         Result<MaterialInfo> result = new Result<>();
         MaterialInfo materialInfoEntity = materialInfoService.getById(materialInfo.getId());
         if (materialInfoEntity == null) {
@@ -517,7 +493,6 @@ public class MaterialInfoController {
             } else {
                 materialInfo.setCoverUrl(cutFrame.getUrl());
             }
-
         }
 
         //  修改素材库 相关联code
@@ -541,29 +516,14 @@ public class MaterialInfoController {
                 materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
             }
         }
-
-        //  审核通过自动同步到到媒体后台
-       /* Long projectId = materialInfoEntity.getProjectId();
-        Project project = projectService.getById(projectId);
-        if (!Check.isNull(projectId)) {
-            if ("2".equals(project.getMediaId())) {
-                if (!Check.isNull(materialInfo.getStatus())) {
-                    Integer status = materialInfo.getStatus();
-                    if (status == 1) {
-                        Thread thread = new Thread() {
-                            @Override
-                            public void run() {
-                                log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
-                                uploadService.upload(materialInfoEntity);
-                            }
-                        };
-                        thread.start();
-                    }
-                }
+        //添加视频文案信息
+        if(!Check.isNull(materialInfo.getSlogans())){
+            JSONArray slogans = materialInfo.getSlogans();
+            if(null!=slogans&&!slogans.isEmpty()){
+                LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+                slogenInfoService.insertSlogans(materialInfoEntity.getCode(),slogans,user.getId());
             }
-
-        }*/
-
+        }
         boolean ok = materialInfoService.updateById(materialInfo);
         if (ok) {
             result.success("修改成功!");
@@ -579,8 +539,6 @@ public class MaterialInfoController {
         return result;
 
     }
-
-
     /**
      * 通过id删除
      *
@@ -640,12 +598,19 @@ public class MaterialInfoController {
     @AutoLog(value = "素材信息-通过id查询")
     @ApiOperation(value = "素材信息-通过id查询", notes = "素材信息-通过id查询")
     @GetMapping(value = "/queryById")
-    public Result<MaterialInfo> queryById(@RequestParam(name = "id", required = true) String id) {
+    public Result<MaterialInfo> queryById(@RequestParam(name = "id") String id) {
         Result<MaterialInfo> result = new Result<>();
         MaterialInfo materialInfo = materialInfoService.getById(id);
         if (materialInfo == null) {
             result.error500("未找到对应实体");
         } else {
+            //查询素材下关联的头条文案信息
+            List<BytedanceVideoSlogenInfo>slogenInfos = slogenInfoService.listByParams(materialInfo.getCode(),1);
+            JSONArray slogenArray = new JSONArray();
+            if(null!=slogenInfos&&!slogenInfos.isEmpty()){
+                slogenArray.addAll(slogenInfos);
+            }
+            materialInfo.setSlogans(slogenArray);
             result.setResult(materialInfo);
             result.setSuccess(true);
         }
@@ -696,6 +661,105 @@ public class MaterialInfoController {
         return result;
     }
 
+    @AutoLog(value = "素材信息-编辑")
+    @ApiOperation(value = "素材信息-编辑", notes = "素材信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<MaterialInfo> edit(@RequestBody MaterialInfo materialInfo) {
+        Result<MaterialInfo> result = new Result<>();
+        MaterialInfo materialInfoEntity = materialInfoService.getById(materialInfo.getId());
+        if (materialInfoEntity == null) {
+            return result.error500("未找到对应实体");
+        }
+        String url = materialInfo.getUrl();
+        if (!Check.isNull(url)) {
+            if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                url = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
+            }
+            materialInfo.setUrl(url);
+            materialInfo.setCreateTime(new Date());
+            MaterialCutFrame cutFrame = materialCutFrameService.getCutFrameByCode(materialInfo.getCode());
+            if (Check.isNull(cutFrame)) {
+                String videoUrl = URLDecoder.decode(url).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
+                String loadImage = "cutFrame/" + materialInfo.getCode() + "/zero.jpg";
+                String coverUrl = CloudVideoProcessUtil.videoCutPictureHandle(videoUrl, loadImage);
+                materialInfo.setCoverUrl(coverUrl);
+                Thread thread = new Thread() {
+                    @Override
+                    public void run() {
+                        try {
+                            log.info("开始抽帧,code:{}", materialInfo.getCode());
+                            materialCutFrameService.getTencentCutFrame(videoUrl, materialInfo.getCode(), coverUrl);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                };
+                thread.start();
+            } else {
+                materialInfo.setCoverUrl(cutFrame.getUrl());
+            }
+
+        }
+
+        //  修改素材库 相关联code
+        if (!Check.isNull(materialInfo.getCode())) {
+            String code = materialInfoEntity.getCode();
+            if (!Check.isNull(code)) {
+                MaterialTag updateMaterialTag = new MaterialTag();
+                updateMaterialTag.setMaterialId(materialInfo.getCode());
+                QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
+                tagQueryWrapper.eq("material_id", code);
+                materialTagService.update(updateMaterialTag, tagQueryWrapper);
+                MaterialParameter updateParameter = new MaterialParameter();
+                updateParameter.setMaterialId(materialInfo.getCode());
+                QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+                parameterQueryWrapper.eq("material_id", code);
+                materialParameterService.update(updateParameter, parameterQueryWrapper);
+                MaterialAscription updateMaterialAscription = new MaterialAscription();
+                updateMaterialAscription.setMaterialId(materialInfo.getCode());
+                QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
+                ascriptionQueryWrapper.eq("material_id", code);
+                materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
+            }
+        }
+
+        //  审核通过自动同步到到媒体后台
+       /* Long projectId = materialInfoEntity.getProjectId();
+        Project project = projectService.getById(projectId);
+        if (!Check.isNull(projectId)) {
+            if ("2".equals(project.getMediaId())) {
+                if (!Check.isNull(materialInfo.getStatus())) {
+                    Integer status = materialInfo.getStatus();
+                    if (status == 1) {
+                        Thread thread = new Thread() {
+                            @Override
+                            public void run() {
+                                log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
+                                uploadService.upload(materialInfoEntity);
+                            }
+                        };
+                        thread.start();
+                    }
+                }
+            }
+
+        }*/
+
+        boolean ok = materialInfoService.updateById(materialInfo);
+        if (ok) {
+            result.success("修改成功!");
+        }
+
+        Integer status = materialInfo.getStatus();
+        // 如果状态为2 审核拒绝 给上传人发送消息
+        if (status == 2) {
+            Project project = projectService.getById(materialInfoEntity.getProjectId());
+            String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+            sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
+        }
+        return result;
+    }
+
     /**
      * adlab 新加查询素材库接口
      */

+ 8 - 8
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -100,16 +100,16 @@ spring:
 #          username: data
 #          password: hcst@2021
 #          driver-class-name: com.mysql.jdbc.Driver
-#        master:
-#          url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
-#          username: hcst
-#          password: hcst@2020
-#          driver-class-name: com.mysql.jdbc.Driver
         master:
-          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: data
-          password: hcst@2021
+          url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
+          username: hcst
+          password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver
+#        master:
+#          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+#          username: data
+#          password: hcst@2021
+#          driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:
     database: 0

+ 4 - 11
jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai

@@ -9,8 +9,7 @@ import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.modules.query.QueryGenerator;
-import org.jeecg.common.aspect.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import ${bussiPackage}.${entityPackage}.entity.${entityName};
 import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
@@ -57,7 +56,6 @@ public class ${entityName}Controller {
 	 * @param req
 	 * @return
 	 */
-	@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
 	@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
 	@GetMapping(value = "/list")
 	public Result<IPage<${entityName}>> queryPageList(${entityName} ${entityName?uncap_first},
@@ -78,7 +76,6 @@ public class ${entityName}Controller {
 	 * @param ${entityName?uncap_first}
 	 * @return
 	 */
-	@AutoLog(value = "${tableVo.ftlDescription}-添加")
 	@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
 	@PostMapping(value = "/add")
 	public Result<${entityName}> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
@@ -98,7 +95,6 @@ public class ${entityName}Controller {
 	 * @param ${entityName?uncap_first}
 	 * @return
 	 */
-	@AutoLog(value = "${tableVo.ftlDescription}-编辑")
 	@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
 	@PutMapping(value = "/edit")
 	public Result<${entityName}> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
@@ -121,10 +117,9 @@ public class ${entityName}Controller {
 	 * @param id
 	 * @return
 	 */
-	@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
 	@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+	public Result<?> delete(@RequestParam(name="id") String id) {
 		try {
 			${entityName?uncap_first}Service.removeById(id);
 		} catch (Exception e) {
@@ -135,14 +130,13 @@ public class ${entityName}Controller {
 	}
 
 	/**
-	  *  批量删除
+	 *  批量删除
 	 * @param ids
 	 * @return
 	 */
-	@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
 	@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
-	public Result<${entityName}> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+	public Result<${entityName}> deleteBatch(@RequestParam(name="ids") String ids) {
 		Result<${entityName}> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
@@ -158,7 +152,6 @@ public class ${entityName}Controller {
 	 * @param id
 	 * @return
 	 */
-	@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
 	@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<${entityName}> queryById(@RequestParam(name="id",required=true) String id) {

+ 3 - 3
jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/mapper/${entityName}Mapper.javai

@@ -8,9 +8,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**
  * ${tableVo.ftlDescription}
- * @author: jeecg-boot
- * @date:   ${.now?string["yyyy-MM-dd"]}
- * @cersion: V1.0
+ * @author jeecg-boot
+ * ${.now?string["yyyy-MM-dd"]}
+ * @version V1.0
  */
 public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
 

+ 4 - 4
jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/service/I${entityName}Service.javai

@@ -4,10 +4,10 @@ import ${bussiPackage}.${entityPackage}.entity.${entityName};
 import com.baomidou.mybatisplus.extension.service.IService;
 
 /**
- * @Description: ${tableVo.ftlDescription}
- * @Author: jeecg-boot
- * @Date:   ${.now?string["yyyy-MM-dd"]}
- * @Version: V1.0
+ * ${tableVo.ftlDescription}
+ * @author jeecg-boot
+ * ${.now?string["yyyy-MM-dd"]}
+ * @version V1.0
  */
 public interface I${entityName}Service extends IService<${entityName}> {
 

+ 1 - 1
jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/service/impl/${entityName}ServiceImpl.javai

@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 /**
  * ${tableVo.ftlDescription}
  * @author jeecg-boot
- * @date   ${.now?string["yyyy-MM-dd"]}
+ * ${.now?string["yyyy-MM-dd"]}
  * @version V1.0
  */
 @Service

+ 1 - 18
jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties

@@ -7,21 +7,4 @@ url=jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicod
 username=data
 password=hcst@2021
 database_name=jeecg-boot
-#oracle
-#diver_name=oracle.jdbc.driver.OracleDriver
-#url=jdbc:oracle:thin:@192.168.1.200:1521:ORCL
-#username=scott
-#password=tiger
-#database_name=ORCL
-#postgre
-#diver_name=org.postgresql.Driver
-#url=jdbc:postgresql://localhost:5432/jeecg
-#username=postgres
-#password=postgres
-#database_name=jeecg
-#SQLServer2005\u4ee5\u4e0a
-#diver_name=org.hibernate.dialect.SQLServerDialect
-#url=jdbc:sqlserver://192.168.1.200:1433;DatabaseName=jeecg
-#username=sa
-#password=SA
-#database_name=jeecg
+

+ 6 - 80
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -54,21 +54,9 @@ public class SampleTest {
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired
-    private IKuaiShouVideoGetService videoGetService;
-    @Autowired
-    private IKuaishouVideoRelateCreativesService kuaishouVideoRelateCreativesService;
-    @Autowired
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
-    /*   @Autowired
-       private IByteDanceAdvertiserDataService advertiserDataService;
-
-   */
-    @Autowired
-    private IKuaishouReportDailyGroupService reportDailyGroupService;
-    @Autowired
-    private IEtlKuaiShouAccountMaterialOverviewService kuaiShouAccountMaterialOverviewService;
     @Autowired
     private IKuaiShouGroupService kuaiShouGroupService;
 
@@ -83,63 +71,6 @@ public class SampleTest {
         token.setAccessToken("1c7cebebc3174c39fe941d136df65b1d");
 
         kuaiShouGroupService.getGroupListByPage("90f31a01c2137aa11c8686e86064b630",9845316L,null,1);
-
-//        kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate, "adScene");
-
-     /*   JSONObject materialOverview = kuaiShouAccountMaterialOverviewService.getMaterialOverview(5473041L, "2021-03-09");
-        System.err.println(materialOverview);*/
-
-      /*  CtopOauthToken token = new CtopOauthToken();
-        token.setAccountId(9901975L);
-        token.setAccessToken("e609f9d3f56f3d6b4653f32c98a6d119");
-        kuaiShouAccountMaterialOverviewService.cleanAccountMaterialOverview(9901975L, "2021-03-09");
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse = simpleDateFormat.parse("2021-03-09");
-        reportDailyGroupService.getAdvertiserGroupReportDaily(token, parse, parse);*/
-
-        //    1662234704806924
-       /* CtopOauthToken token = new CtopOauthToken();
-        token.setAccountId(9549277L);
-        token.setAccessToken("bc5327c8f2bd8a67513e51148c9206c8");
-
-
-
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse = simpleDateFormat.parse("2021-02-02");
-        kuaishouInterfaceService.getAdvertiserReportDaily(token, parse, parse);*/
-
-     /*   CtopOauthToken token = new CtopOauthToken();
-        token.setAccountId(9767055L);
-        token.setAccessToken("28e4e6b124e1443d6971ba4c699de6c9");
-
-        kuaishouInterfaceService.getVideoList(token, null, null);
-        kuaishouInterfaceService.getVideoInfo("28e4e6b124e1443d6971ba4c699de6c9", 9767055L, "5208131540349742192");*/
-
-     /*   CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(1662234704806924L);
-        advertiserDataService.getMaterialList(tokenByAccountId);*/
-       /* getVideoByPage(token, "", 1);
-        List<KuaiShouVideoGet> KuaiShouVideoGets = videoGetService.selectPhotoIdsByAccountId(9743746L);
-        if (!Check.isNull(KuaiShouVideoGets)) {
-            JSONArray dateList = new JSONArray();
-            JSONArray photoIds = new JSONArray();
-            Map<String, Object> statdateMap = new HashMap<>();
-            int count = 0;
-            for (KuaiShouVideoGet video : KuaiShouVideoGets) {
-                count++;
-                if (count < 10) {
-                    photoIds.add(video.getPhotoId());
-                    statdateMap.put(video.getPhotoId(), video.getStatDate());
-                } else {
-                    photoIds.add(video.getPhotoId());
-                    statdateMap.put(video.getPhotoId(), video.getStatDate());
-                    dateList.add(photoIds);
-                    photoIds = new JSONArray();
-                    count = 0;
-                }
-            }
-            dateList.add(photoIds);
-            kuaishouVideoRelateCreativesService.videoRelateCreatives(9743746L, dateList, statdateMap);
-        }*/
     }
 
     @Test
@@ -350,18 +281,13 @@ public class SampleTest {
         }
     }
 
+    @Autowired
+    private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
     @Test
-    public void loadKuaishouHourlyReportData() {
-        Date getDate = new Date();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
-        String hour = simpleDateFormat.format(getDate);
-        if ("00".equals(hour)) {
-            getDate = DateUtils.addDay(getDate, -1);
-        }
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        Date finalGetDate = getDate;
-        tokens.forEach(token -> kuaishouInterfaceService.getAdvertiserReportHourly(token, finalGetDate, finalGetDate));
+    public void loadKuaishouMatReportData() {
+        CtopOauthToken token = tokenService.getTokenByAccountId(9677284L);
+        String getDate = "2021-03-15";
+        kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(),token.getAccessToken(), getDate, getDate,1);
     }
 
     @Autowired

+ 20 - 13
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.entity;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
@@ -126,15 +127,21 @@ public class MaterialInfo {
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     private Date updateTime;
 
-    private Integer toutiaoEffiType; //判断是否为头条有效素材0否_1是
+    //判断是否为头条有效素材0否_1是
+    private Integer toutiaoEffiType;
+    // 素造供应商
+    private String supplierCode;
 
-    private Integer kuaishouEffiType; //判断是否为快手有效素材0否_1是
+    //判断是否为快手有效素材0否_1是
+    private Integer kuaishouEffiType;
 
+    //判断是否已经同步到快手平台0否_1是
     @TableField(exist = false)
-    private Integer kuaishouVideoIsUp;  //判断是否已经同步到快手平台0否_1是
+    private Integer kuaishouVideoIsUp;
 
+    //判断是否已经同步到头条平台0否_1是
     @TableField(exist = false)
-    private Integer toutiaoVideoIsUp;  //判断是否已经同步到头条平台0否_1是
+    private Integer toutiaoVideoIsUp;
 
     @TableField(exist = false)
     private JSONObject byteDance;
@@ -142,11 +149,13 @@ public class MaterialInfo {
     @TableField(exist = false)
     private JSONObject kuaiShou;
 
+    //拍摄时候担任的角色
     @TableField(exist = false)
-    private String videoRoleCode;  //拍摄时候担任的角色
+    private String videoRoleCode;
 
+    //原本的角色
     @TableField(exist = false)
-    private String originRoleName;  //原本的角色
+    private String originRoleName;
 
     @TableField(exist = false)
     private BigDecimal cost;
@@ -157,9 +166,9 @@ public class MaterialInfo {
     @TableField(exist = false)
     private String realname;
 
+    // 是否有未审核封面
     @TableField(exist = false)
-    private Boolean whetherUnaudited;  // 是否有未审核封面
-
+    private Boolean whetherUnaudited;
 
     @TableField(exist = false)
     private String mediaId;  // 是否有未审核封面
@@ -167,15 +176,13 @@ public class MaterialInfo {
     @TableField(exist = false)
     private String projectName;  // 是否有未审核封面
 
-
-    private String supplierCode; // 素造供应商
-
-
     @TableField(exist = false)
     private String startDate;  // 是否有未审核封面
 
     @TableField(exist = false)
     private String endDate;  // 是否有未审核封面
 
-
+    //视频关联广告语信息--头条
+    @TableField(exist = false)
+    private JSONArray slogans;
 }

+ 0 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -309,7 +309,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     @Override
     public JSONObject getDetail(String materialId) {
         JSONObject json = new JSONObject();
-
         MaterialInfo materialInfo = this.getById(materialId);
         if (!Check.isNull(materialInfo.getAuditorId())) {
             String auditorName = materialInfoMapper.selectUserNameById(materialInfo.getAuditorId());
@@ -336,7 +335,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         if (!Check.isNull(ascriptionJson)) {
             json.put("ascription", ascriptionJson);
         }
-
         return json;
     }
 

+ 144 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/BytedanceVideoSlogenInfoController.java

@@ -0,0 +1,144 @@
+package cn.com.ctop.toutiao.modules.material.controller;
+
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
+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.vo.LoginUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
+
+/**
+ * 头条视频文案信息
+ * @author jeecg-boot
+ * 2021-04-19
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="头条视频文案信息")
+@RestController
+@RequestMapping("/ctop/bytedanceVideoSlogenInfo")
+public class BytedanceVideoSlogenInfoController {
+	@Autowired
+	private IBytedanceVideoSlogenInfoService bytedanceVideoSlogenInfoService;
+
+	/**
+	  * 分页列表查询
+	 * @param slogenInfo
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@ApiOperation(value="头条视频文案信息-分页列表查询", notes="头条视频文案信息-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BytedanceVideoSlogenInfo>> queryPageList(BytedanceVideoSlogenInfo slogenInfo,
+																 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+																 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+																 HttpServletRequest req) {
+		Result<IPage<BytedanceVideoSlogenInfo>> result = new Result<>();
+		slogenInfo.setStatus(1);
+		QueryWrapper<BytedanceVideoSlogenInfo> queryWrapper = QueryGenerator.initQueryWrapper(slogenInfo, req.getParameterMap());
+		Page<BytedanceVideoSlogenInfo> page = new Page<>(pageNo, pageSize);
+		IPage<BytedanceVideoSlogenInfo> pageList = bytedanceVideoSlogenInfoService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param slogenInfo
+	 * @return
+	 */
+	@ApiOperation(value="头条视频文案信息-添加", notes="头条视频文案信息-添加")
+	@PostMapping(value = "/add")
+	public Result<BytedanceVideoSlogenInfo> add(@RequestBody BytedanceVideoSlogenInfo slogenInfo) {
+		Result<BytedanceVideoSlogenInfo> result = new Result<>();
+		try {
+			bytedanceVideoSlogenInfoService.save(slogenInfo);
+			result.success("添加成功!");
+			return result;
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+			return result;
+		}
+	}
+
+	/**
+	 *  编辑
+	 * @param slogenInfo 文案信息
+	 * @return
+	 */
+	@ApiOperation(value="头条视频文案信息-编辑", notes="头条视频文案信息-编辑")
+	@PostMapping(value = "/edit")
+	public Result<BytedanceVideoSlogenInfo> edit(@RequestBody BytedanceVideoSlogenInfo slogenInfo) {
+		Result<BytedanceVideoSlogenInfo> result = new Result<>();
+		BytedanceVideoSlogenInfo bytedanceVideoSlogenInfoEntity = bytedanceVideoSlogenInfoService.getById(slogenInfo.getId());
+		if(bytedanceVideoSlogenInfoEntity==null) {
+			result.error500("未找到对应实体");
+			return result;
+		}
+		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		slogenInfo.setUpdateBy(user.getId());
+		slogenInfo.setUpdateTime(new Date());
+		bytedanceVideoSlogenInfoService.updateById(slogenInfo);
+		result.success("修改成功!");
+		return result;
+	}
+
+	/**
+	 *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="头条视频文案信息-通过id删除", notes="头条视频文案信息-通过id删除")
+	@PostMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id") String id) {
+		try {
+			BytedanceVideoSlogenInfo slogenInfo = bytedanceVideoSlogenInfoService.getById(id);
+			if(null == slogenInfo||slogenInfo.getStatus() == 0){
+				return Result.ok("此文案不存在或者已经被删除");
+			}
+			slogenInfo.setStatus(0);
+			LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+			slogenInfo.setUpdateTime(new Date());
+			slogenInfo.setCreateBy(user.getId());
+			bytedanceVideoSlogenInfoService.updateById(slogenInfo);
+			return Result.ok("删除成功!");
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+	}
+
+	/**
+	 * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="头条视频文案信息-通过id查询", notes="头条视频文案信息-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BytedanceVideoSlogenInfo> queryById(@RequestParam(name="id") String id) {
+		Result<BytedanceVideoSlogenInfo> result = new Result<>();
+		BytedanceVideoSlogenInfo bytedanceVideoSlogenInfo = bytedanceVideoSlogenInfoService.getById(id);
+		if(bytedanceVideoSlogenInfo==null) {
+			result.error500("未找到对应实体");
+			return result;
+		}
+		result.setResult(bytedanceVideoSlogenInfo);
+		result.setSuccess(true);
+		return result;
+	}
+}

+ 50 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/BytedanceVideoSlogenInfo.java

@@ -0,0 +1,50 @@
+package cn.com.ctop.toutiao.modules.material.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 头条视频文案信息
+ * @author jeecg-boot
+ * 2021-04-19
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_bytedance_video_slogen_info")
+public class BytedanceVideoSlogenInfo {
+
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private Long id;
+	/**videoCode*/
+	private String videoCode;
+	/**slogan*/
+	private String slogan;
+	/**createTime*/
+	private Date createTime;
+	/**updateTime*/
+	private Date updateTime;
+	/**createBy*/
+	private String createBy;
+	/**updateBy*/
+	private String updateBy;
+	/**status*/
+	private Integer status;
+
+	public BytedanceVideoSlogenInfo(String videoCode, String slogan, String userId) {
+		this.videoCode = videoCode;
+		this.slogan = slogan;
+		this.createBy = userId;
+		this.updateBy = userId;
+		this.createTime = new Date();
+		this.updateTime = new Date();
+		this.status = 1;
+	}
+
+	public BytedanceVideoSlogenInfo() {
+	}
+}

+ 14 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceVideoSlogenInfoMapper.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.toutiao.modules.material.mapper;
+
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 头条视频文案信息
+ * @author jeecg-boot
+ * 2021-04-19
+ * @version V1.0
+ */
+public interface BytedanceVideoSlogenInfoMapper extends BaseMapper<BytedanceVideoSlogenInfo> {
+
+}

+ 5 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/BytedanceVideoSlogenInfoMapper.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.toutiao.modules.material.mapper.BytedanceVideoSlogenInfoMapper">
+
+</mapper>

+ 20 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceVideoSlogenInfoService.java

@@ -0,0 +1,20 @@
+package cn.com.ctop.toutiao.modules.material.service;
+
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 头条视频文案信息
+ * @author jeecg-boot
+ * 2021-04-19
+ * @version V1.0
+ */
+public interface IBytedanceVideoSlogenInfoService extends IService<BytedanceVideoSlogenInfo> {
+
+    void insertSlogans(String videoCode, JSONArray slogans, String userId);
+
+    List<BytedanceVideoSlogenInfo> listByParams(String code, Integer status);
+}

+ 46 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceVideoSlogenInfoServiceImpl.java

@@ -0,0 +1,46 @@
+package cn.com.ctop.toutiao.modules.material.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
+import cn.com.ctop.toutiao.modules.material.mapper.BytedanceVideoSlogenInfoMapper;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 头条视频文案信息
+ * @author jeecg-boot
+ * 2021-04-19
+ * @version V1.0
+ */
+@Service
+public class BytedanceVideoSlogenInfoServiceImpl extends ServiceImpl<BytedanceVideoSlogenInfoMapper, BytedanceVideoSlogenInfo> implements IBytedanceVideoSlogenInfoService {
+    @Override
+    public void insertSlogans(String videoCode, JSONArray slogans,String userId){
+        if(null==slogans||slogans.isEmpty()){
+            return;
+        }
+        for(int i=0;i<slogans.size();i++){
+            String slogan = slogans.getString(i);
+            BytedanceVideoSlogenInfo slogenInfo = new BytedanceVideoSlogenInfo(videoCode,slogan,userId);
+            this.save(slogenInfo);
+        }
+    }
+
+    @Override
+    public List<BytedanceVideoSlogenInfo> listByParams(String code, Integer status) {
+        QueryWrapper<BytedanceVideoSlogenInfo>queryWrapper =new QueryWrapper<>();
+        if(!Check.isNull(code)){
+            queryWrapper.eq("video_code",code);
+        }
+        if(!Check.isNull(status)){
+            queryWrapper.eq("status",status);
+        }
+        queryWrapper.orderByDesc("id");
+        return this.list(queryWrapper);
+    }
+}