Browse Source

度小满,初版

zhaoxian 2 năm trước cách đây
mục cha
commit
616507203b
20 tập tin đã thay đổi với 1295 bổ sung18 xóa
  1. 1 0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
  2. 4 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/MaterialTagInfoMapper.java
  3. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialTagInfoMapper.xml
  4. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMaterialTagInfoService.java
  5. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMessageTemplate.java
  6. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagInfoServiceImpl.java
  7. 22 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MessageTemplateImpl.java
  8. 57 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java
  9. 57 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/KuaishouDuXiaoManAPIConstant.java
  10. 22 3
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java
  11. 39 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/shiwan/modules/FileUtil.java
  12. 274 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/controller/DuxiaomanMaterialInfoController.java
  13. 167 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/entity/DuxiaomanMaterialInfo.java
  14. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/mapper/DuxiaomanMaterialInfoMapper.java
  15. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/mapper/xml/DuxiaomanMaterialInfoMapper.xml
  16. 41 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/service/IDuxiaomanMaterialInfoService.java
  17. 550 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/service/impl/DuxiaomanMaterialInfoServiceImpl.java
  18. 14 9
      jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-dev.yml
  19. 6 1
      jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-prod.yml
  20. 6 1
      jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-test.yml

+ 1 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -251,6 +251,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/product/material/**", "anon");
         filterChainDefinitionMap.put("/ctop/materialInfo/**", "anon");
         filterChainDefinitionMap.put("/summary/report/**", "anon");
+        filterChainDefinitionMap.put("/duxiaoman/materialInfo/**", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

+ 4 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/MaterialTagInfoMapper.java

@@ -2,6 +2,9 @@ package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.MaterialTagInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 素材标签信息
@@ -11,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface MaterialTagInfoMapper extends BaseMapper<MaterialTagInfo> {
 
+    List<String> getByCode(@Param("signature") String signature);
 }

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

@@ -2,4 +2,9 @@
 <!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">
 
+    <select id="getByCode" resultType="java.lang.String">
+        select  tag_name  from  ctop_material_tag_info
+        where code = #{signature}
+    </select>
+
 </mapper>

+ 3 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMaterialTagInfoService.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.system.vo.LoginUser;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -19,4 +20,6 @@ public interface IMaterialTagInfoService extends IService<MaterialTagInfo> {
     Map<String, Object> getTagDetail(MaterialTagInfo materialTagInfo);
 
     void deleteByCode(String code);
+
+    List<String> getByCode(String signature);
 }

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMessageTemplate.java

@@ -85,4 +85,6 @@ public interface IMessageTemplate {
     String getCopyCampaignMessage(String oldName, String state);
 
     String getTrackMessage(Long accountId, Long unitId);
+
+    String getDuXiaoManMaterialTemplate(String productName, String projectName, String materialName, String refuseReason, boolean success);
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagInfoServiceImpl.java

@@ -103,4 +103,9 @@ public class MaterialTagInfoServiceImpl extends ServiceImpl<MaterialTagInfoMappe
         wrapper.eq("code",code);
         materialTagInfoMapper.delete(wrapper);
     }
+
+    @Override
+    public List<String> getByCode(String signature) {
+        return materialTagInfoMapper.getByCode(signature);
+    }
 }

+ 22 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MessageTemplateImpl.java

@@ -168,7 +168,7 @@ public class MessageTemplateImpl implements IMessageTemplate {
      */
 
     @Override
-    public String getKuaiShouBidTypeMessage(String projectName, Long advertiserId, Long unitId, String unit_name,String msgType) {
+    public String getKuaiShouBidTypeMessage(String projectName, Long advertiserId, Long unitId, String unit_name, String msgType) {
         StringBuilder text = new StringBuilder();
         text.append("出价方式错误预警").append("<br/>")
                 .append("您的项目:").append(projectName + ",").append("<br/>")
@@ -182,7 +182,7 @@ public class MessageTemplateImpl implements IMessageTemplate {
     }
 
     @Override
-    public String getKuaiShouBidMessage(String projectName, Long advertiserId, Long unitId, String unit_name,String msgBid) {
+    public String getKuaiShouBidMessage(String projectName, Long advertiserId, Long unitId, String unit_name, String msgBid) {
         StringBuilder text = new StringBuilder();
         text.append("出价过高预警").append("<br/>")
                 .append("您的项目:").append(projectName + ",").append("<br/>")
@@ -221,5 +221,25 @@ public class MessageTemplateImpl implements IMessageTemplate {
         return text.toString();
     }
 
+    @Override
+    public String getDuXiaoManMaterialTemplate(String productName, String projectName, String materialName, String refuseReason, boolean success) {
+        StringBuilder text = new StringBuilder();
+        text.append("脚本审核结果通知").append("<br/>")
+                .append("您的产品:").append(productName + ",").append("<br/>")
+                .append("下的项目:").append(projectName + ",").append("<br/>")
+                .append("脚本名为:").append(materialName).append("<br/>");
+        if (success) {
+            text.append("已通过审核");
+        } else {
+            text.append("已被驳回。").append("<br/>");
+        }
+        if (!Check.isNull(refuseReason)) {
+            text.append("驳回原因为:").append(refuseReason).append("</br>");
+
+        }
+        text.append("请您联系相关同学及时调整");
+        return text.toString();
+    }
+
 
 }

+ 57 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java

@@ -22,6 +22,8 @@ import org.apache.http.conn.ssl.TrustStrategy;
 import org.apache.http.cookie.Cookie;
 import org.apache.http.entity.ContentType;
 import org.apache.http.entity.StringEntity;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.apache.http.entity.mime.content.FileBody;
 import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClientBuilder;
@@ -34,6 +36,7 @@ import org.apache.http.util.EntityUtils;
 import javax.net.ssl.SSLContext;
 import javax.servlet.http.HttpServletResponse;
 import java.io.BufferedReader;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.URI;
@@ -659,7 +662,7 @@ public class HttpUtils {
                 String value = entry.getValue().toString();
                 result += (key + "=" + value + seperator);
             }
-          result = result.substring(0, result.length() - seperator.length());
+            result = result.substring(0, result.length() - seperator.length());
         }
         return result;
     }
@@ -997,4 +1000,57 @@ public class HttpUtils {
         }
         return null;
     }
+
+    /**
+     * POST上传file文件
+     *
+     * @Param localUrl 文件本地地址
+     * @Param url 调用链接
+     * @Param params 非file文件格式的其他参数
+     */
+    public static JSONObject fileUpload(String url, String localUrl, JSONObject params) {
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+        // 构造请求
+        HttpPost httpPost = new HttpPost(url);
+        // 文件参数
+        try {
+            FileBody file = new FileBody(new File(localUrl));
+            MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create()
+                    .addPart("file", file);
+            // 其他参数
+            for (String key : params.keySet()) {
+                entityBuilder.addTextBody(key, params.getString(key));
+            }
+            HttpEntity entity = entityBuilder.build();
+            client = HttpClientBuilder.create().build();
+            httpPost.setURI(URI.create(url));
+            httpPost.setEntity(entity);
+            response = client.execute(httpPost);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuilder result = new StringBuilder();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return JSONObject.parseObject(result.toString());
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                if (null != client) {
+                    client.close();
+                }
+            } catch (IOException e) {
+                log.error(e.getMessage(), e);
+            }
+        }
+        return null;
+    }
 }

+ 57 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/KuaishouDuXiaoManAPIConstant.java

@@ -0,0 +1,57 @@
+package cn.com.ctop.common.module.utils;
+
+/**
+ * 快手 度小满 API接口常量
+ */
+public class KuaishouDuXiaoManAPIConstant {
+
+    /**
+     * 查询渠道
+     * GET方式
+     */
+    public static final String MATERIAL_CHANNEL = "/client/api/material_channel";
+
+    /**
+     * 查询通用素材分类
+     * GET方式
+     */
+    public static final String MATERIAL_TYPE = "/client/api/material_type";
+
+    /**
+     * 上传单个文件,用于后续提交报备
+     * POST方式
+     */
+    public static final String MATERIAL_UPLOAD = "/client/api/material_upload";
+
+    /**
+     * 素材报备
+     * POST方式
+     */
+    public static final String MATERIAL_REPORT = "/client/api/material_report";
+
+    /**
+     * 查询报备状态
+     * Get方式
+     */
+    public static final String MATERIAL_DETAIL = "/client/api/material_detail";
+
+    /**
+     * 审核图片预览
+     * Get方式
+     */
+    public static final String MATERIAL_BOS = "/client/api/material_bos";
+
+    /**
+     * 撤回审核任务
+     * POST方式
+     */
+    public static final String MATERIAL_REVOKE = "/client/api/material_revoke";
+
+    /**
+     * 更新任务信息
+     * POST方式
+     */
+    public static final String MATERIAL_UPDATE = "/client/api/material_update";
+
+
+}

+ 22 - 3
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java

@@ -2,11 +2,19 @@ package cn.com.ctop.common.module.utils;
 
 import org.apache.commons.codec.digest.DigestUtils;
 import org.jeecg.common.util.encryption.AesEncryptUtil;
-
-import java.io.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigInteger;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLEncoder;
+import java.security.MessageDigest;
 import java.util.Map;
 
 public class LoadFileUtil {
@@ -68,7 +76,7 @@ public class LoadFileUtil {
      * @return
      * @throws IOException
      */
-    public static String downLoadFromUrlAndName(String urlStr, String savePath,String fileName) {
+    public static String downLoadFromUrlAndName(String urlStr, String savePath, String fileName) {
         try {
             URL url = new URL(urlStr);
 
@@ -235,5 +243,16 @@ public class LoadFileUtil {
         return null;
     }
 
+    public static String getMd5ByFile(MultipartFile file) {
+        try {
+            byte[] uploadBytes = file.getBytes();
+            MessageDigest md5 = MessageDigest.getInstance("MD5");
+            byte[] digest = md5.digest(uploadBytes);
+            return new BigInteger(1, digest).toString(16);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
 
 }

+ 39 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/shiwan/modules/FileUtil.java

@@ -10,6 +10,7 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
 
 import java.io.*;
 import java.net.URL;
+import java.net.URLConnection;
 import java.util.Date;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
@@ -225,6 +226,43 @@ public class FileUtil {
             }
         }
     }
-
+    /**
+     * url资源转化为file流
+     * @param url
+     * @return
+     */
+    public static File urlToFile(URL url) {
+        InputStream is = null;
+        File file = null;
+        FileOutputStream fos = null;
+        try {
+            file = File.createTempFile("tmp", null);
+            URLConnection urlConn = null;
+            urlConn = url.openConnection();
+            is = urlConn.getInputStream();
+            fos = new FileOutputStream(file);
+            byte[] buffer = new byte[4096];
+            int length;
+            while ((length = is.read(buffer)) > 0) {
+                fos.write(buffer, 0, length);
+            }
+            return file;
+        } catch (IOException e) {
+            return null;
+        } finally {
+            if (is != null) {
+                try {
+                    is.close();
+                } catch (IOException e) {
+                }
+            }
+            if (fos != null) {
+                try {
+                    fos.close();
+                } catch (IOException e) {
+                }
+            }
+        }
+    }
 
 }

+ 274 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/controller/DuxiaomanMaterialInfoController.java

@@ -0,0 +1,274 @@
+package org.jeecg.modules.duxiaoman.controller;
+
+import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSONArray;
+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.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.MD5Util;
+import org.jeecg.modules.duxiaoman.entity.DuxiaomanMaterialInfo;
+import org.jeecg.modules.duxiaoman.service.IDuxiaomanMaterialInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 度小满素材信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2022-08-15
+ */
+@Slf4j
+@Api(tags = "度小满素材信息")
+@RestController
+@RequestMapping("/duxiaoman/materialInfo")
+public class DuxiaomanMaterialInfoController {
+    @Autowired
+    private IDuxiaomanMaterialInfoService duxiaomanMaterialInfoService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param duxiaomanMaterialInfo
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "度小满素材信息-分页列表查询", notes = "度小满素材信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<DuxiaomanMaterialInfo>> queryPageList(DuxiaomanMaterialInfo duxiaomanMaterialInfo,
+                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                              HttpServletRequest req) {
+        Result<IPage<DuxiaomanMaterialInfo>> result = new Result<>();
+        QueryWrapper<DuxiaomanMaterialInfo> queryWrapper = QueryGenerator.initQueryWrapper(duxiaomanMaterialInfo, req.getParameterMap());
+
+        if (!Check.isNull(duxiaomanMaterialInfo.getUserId())) {
+            queryWrapper.eq("user_id", duxiaomanMaterialInfo.getUserId());
+        }
+        if (!Check.isNull(duxiaomanMaterialInfo.getType())) {
+            queryWrapper.eq("type", duxiaomanMaterialInfo.getType());
+        }
+        if (!Check.isNull(duxiaomanMaterialInfo.getStatus())) {
+            queryWrapper.eq("status", duxiaomanMaterialInfo.getStatus());
+        }
+        if (!Check.isNull(duxiaomanMaterialInfo.getProductId())) {
+            queryWrapper.eq("product_id", duxiaomanMaterialInfo.getProductId());
+        }
+        if (!Check.isNull(duxiaomanMaterialInfo.getProjectId())) {
+            queryWrapper.eq("project_id", duxiaomanMaterialInfo.getProjectId());
+        }
+        if (!Check.isNull(duxiaomanMaterialInfo.getSignature())) {
+            queryWrapper.eq("signature", duxiaomanMaterialInfo.getSignature());
+        }
+        if (!Check.isNull(duxiaomanMaterialInfo.getEndDate())) {
+            queryWrapper.le("stat_date", duxiaomanMaterialInfo.getEndDate());
+            queryWrapper.gt("stat_date", duxiaomanMaterialInfo.getStartDate());
+        }
+        queryWrapper.orderByDesc("create_time");
+        Page<DuxiaomanMaterialInfo> page = new Page<DuxiaomanMaterialInfo>(pageNo, pageSize);
+        IPage<DuxiaomanMaterialInfo> pageList = duxiaomanMaterialInfoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     */
+    @PostMapping(value = "/add")
+    public Result<Object> add(@RequestBody JSONObject json) {
+        try {
+            return duxiaomanMaterialInfoService.add(json);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+        return Result.error("失败");
+    }
+
+    /**
+     * 批量添加
+     */
+    @PostMapping(value = "/addMore")
+    public Result<Object> addMore(@RequestBody JSONObject json) {
+        try {
+            JSONArray array = json.getJSONArray("videoArray");
+            Long projectId = json.getLong("projectId");
+            for (int i = 0; i < array.size(); i++) {
+                JSONObject data = array.getJSONObject(i);
+                String url = "https:" + data.getString("url");
+                data.put("url", url);
+                data.put("signature", MD5Util.md5ByUrl(url));
+                data.put("projectId", projectId);
+                duxiaomanMaterialInfoService.add(data);
+                Thread.sleep(1000);
+            }
+            return Result.ok("成功");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+        return Result.error("失败");
+    }
+
+    /**
+     * 上传素材
+     */
+    @PostMapping(value = "/upload")
+    public Result<Object> upload(@RequestBody DuxiaomanMaterialInfo materialInfo) {
+        try {
+            return duxiaomanMaterialInfoService.upload(materialInfo);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+        return Result.error("失败");
+    }
+
+    /**
+     * 编辑
+     */
+    @ApiOperation(value = "度小满素材信息-编辑", notes = "度小满素材信息-编辑")
+    @PostMapping(value = "/edit")
+    public Result<DuxiaomanMaterialInfo> edit(@RequestBody DuxiaomanMaterialInfo duxiaomanMaterialInfo) {
+        Result<DuxiaomanMaterialInfo> result = new Result<DuxiaomanMaterialInfo>();
+        DuxiaomanMaterialInfo duxiaomanMaterialInfoEntity = duxiaomanMaterialInfoService.getById(duxiaomanMaterialInfo.getId());
+        if (duxiaomanMaterialInfoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = duxiaomanMaterialInfoService.updateById(duxiaomanMaterialInfo);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+        return result;
+    }
+
+
+    /**
+     * 编辑
+     */
+    @PostMapping(value = "/editMore")
+    public Result<DuxiaomanMaterialInfo> editMore(@RequestBody JSONObject data) {
+        Result<DuxiaomanMaterialInfo> result = null;
+        try {
+            JSONArray array = data.getJSONArray("array");
+            result = new Result<DuxiaomanMaterialInfo>();
+            List<DuxiaomanMaterialInfo> list = JSONArray.parseObject(array.toJSONString(), List.class);
+            boolean ok = duxiaomanMaterialInfoService.updateBatchById(list);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.error500("修改失败");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "度小满素材信息-通过id删除", notes = "度小满素材信息-通过id删除")
+    @GetMapping(value = "/deleteById")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            duxiaomanMaterialInfoService.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<DuxiaomanMaterialInfo> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<DuxiaomanMaterialInfo> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.duxiaomanMaterialInfoService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "度小满素材信息-通过id查询", notes = "度小满素材信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<Object> queryById(@RequestParam(name = "id", required = true) String id) {
+        JSONObject obj = new JSONObject();
+        DuxiaomanMaterialInfo duxiaomanMaterialInfo = duxiaomanMaterialInfoService.getById(id);
+        if (Check.isNull(duxiaomanMaterialInfo)) {
+            return Result.error("未查询到实体");
+        }
+        return duxiaomanMaterialInfoService.getPersonnelInfo(duxiaomanMaterialInfo);
+    }
+
+
+    /**
+     * 将1-待上传状态的素材 进行 上传媒体
+     */
+    @GetMapping(value = "/uploadMaterial")
+    public void uploadMaterial(String id) {
+        DuxiaomanMaterialInfo materialInfo = duxiaomanMaterialInfoService.getById(id);
+        duxiaomanMaterialInfoService.uploadMaterial(materialInfo);
+    }
+
+    /**
+     * 将7-上传成功状态的素材 进行 素材报备
+     */
+    @GetMapping(value = "/materialReport")
+    public void materialReport(String id) {
+        DuxiaomanMaterialInfo materialInfo = duxiaomanMaterialInfoService.getById(id);
+        duxiaomanMaterialInfoService.materialReport(materialInfo);
+    }
+
+
+    /**
+     * 将2-审批中状态的素材 进行 更新报备状态
+     */
+    @GetMapping(value = "/materialDetail")
+    public void materialDetail(String id) {
+        DuxiaomanMaterialInfo materialInfo = duxiaomanMaterialInfoService.getById(id);
+        if ("VIDEO".equals(materialInfo.getType())) {
+            duxiaomanMaterialInfoService.materialDetail(materialInfo);
+        } else {
+            duxiaomanMaterialInfoService.materialDetail2(materialInfo);
+        }
+    }
+
+
+}

+ 167 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/entity/DuxiaomanMaterialInfo.java

@@ -0,0 +1,167 @@
+package org.jeecg.modules.duxiaoman.entity;
+
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 度小满素材信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2022-08-15
+ */
+@Data
+@TableName("ctop_duxiaoman_material_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_duxiaoman_material_info对象", description = "度小满素材信息")
+public class DuxiaomanMaterialInfo {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * signature
+     */
+    @Excel(name = "signature", width = 15)
+    @ApiModelProperty(value = "signature")
+    private String signature;
+    /**
+     * 上传日期
+     */
+    @Excel(name = "statDate", width = 15)
+    @ApiModelProperty(value = "statDate")
+    private String statDate;
+    /**
+     * url
+     */
+    @Excel(name = "url", width = 15)
+    @ApiModelProperty(value = "url")
+    private String url;
+
+    /**
+     * 封面url
+     */
+    @Excel(name = "coverUrl", width = 15)
+    @ApiModelProperty(value = "coverUrl")
+    private String coverUrl;
+    /**
+     * 报备文件id
+     */
+    @Excel(name = "fileId", width = 15)
+    @ApiModelProperty(value = "fileId")
+    private String fileId;
+    /**
+     * 审核任务ID
+     */
+    @Excel(name = "auditTaskId", width = 15)
+    @ApiModelProperty(value = "auditTaskId")
+    private String auditTaskId;
+    /**
+     * 素材名称
+     */
+    @Excel(name = "素材名称", width = 15)
+    @ApiModelProperty(value = "素材名称")
+    private String materialName;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称", width = 15)
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
+    /**
+     * 产品id
+     */
+    @Excel(name = "产品id", width = 15)
+    @ApiModelProperty(value = "产品id")
+    private Long productId;
+    /**
+     * 产品名
+     */
+    @Excel(name = "产品名", width = 15)
+    @ApiModelProperty(value = "产品名")
+    private String productName;
+    /**
+     * 创建人id
+     */
+    @Excel(name = "创建人id", width = 15)
+    @ApiModelProperty(value = "创建人id")
+    private String userId;
+    /**
+     * 审核人
+     */
+    @Excel(name = "审核人", width = 15)
+    @ApiModelProperty(value = "审核人")
+    private String auditorId;
+    /**
+     * 0-待审核,1-预审核,2-待上传,3-上传成功,4-预审拒绝,5-媒体拒绝
+     */
+    @Excel(name = "0-待审核,1-待上传,2-审批中,3-审核通过,4-审核不通过,5-预审核,6-预审核拒绝,7-上传成功,8-上传失败", width = 15)
+    @ApiModelProperty(value = "0-待审核,1-待上传,2-审批中,3-审核通过,4-审核不通过,5-预审核,6-预审核拒绝,7-上传成功,8-上传失败")
+    private Integer status;
+    /**
+     * 通过审核时间
+     */
+    @Excel(name = "通过审核时间", width = 15)
+    @ApiModelProperty(value = "通过审核时间")
+    private String confirmTime;
+    /**
+     * 拒绝原因
+     */
+    @Excel(name = "拒绝原因", width = 15)
+    @ApiModelProperty(value = "拒绝原因")
+    private String refuseReason;
+    /**
+     * 素材类型
+     */
+    @Excel(name = "素材类型", width = 15)
+    @ApiModelProperty(value = "素材类型")
+    private String type;
+    /**
+     * 视频描述
+     */
+    @Excel(name = "视频描述", width = 15)
+    @ApiModelProperty(value = "视频描述")
+    private String materialDescribe;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+    /**
+     * 开始时间
+     */
+    @TableField(exist = false)
+    private String startDate;
+
+    /**
+     * 结束时间
+     */
+    @TableField(exist = false)
+    private String endDate;
+}

+ 15 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/mapper/DuxiaomanMaterialInfoMapper.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.duxiaoman.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.duxiaoman.entity.DuxiaomanMaterialInfo;
+
+/**
+ * 度小满素材信息
+ *
+ * @author jeecg-boot
+ * 2022-08-15
+ * @version V1.0
+ */
+public interface DuxiaomanMaterialInfoMapper extends BaseMapper<DuxiaomanMaterialInfo> {
+
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/mapper/xml/DuxiaomanMaterialInfoMapper.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="org.jeecg.modules.duxiaoman.mapper.DuxiaomanMaterialInfoMapper">
+
+</mapper>

+ 41 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/service/IDuxiaomanMaterialInfoService.java

@@ -0,0 +1,41 @@
+package org.jeecg.modules.duxiaoman.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.duxiaoman.entity.DuxiaomanMaterialInfo;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 度小满素材信息
+ *
+ * @author jeecg-boot
+ * 2022-08-15
+ * @version V1.0
+ */
+public interface IDuxiaomanMaterialInfoService extends IService<DuxiaomanMaterialInfo> {
+
+    /**
+     *查询渠道
+     */
+    public void getMaterialChannel();
+
+    /**
+     *查询渠道
+     */
+    public void getmaterialType();
+
+    Result<Object> upload(DuxiaomanMaterialInfo materialInfo);
+
+    void uploadMaterial(DuxiaomanMaterialInfo materialInfo);
+
+    void materialReport(DuxiaomanMaterialInfo materialInfo);
+
+    void materialDetail(DuxiaomanMaterialInfo materialInfo);
+
+    Result<Object> add(JSONObject json);
+
+    void materialDetail2(DuxiaomanMaterialInfo materialInfo);
+
+    Result<Object> getPersonnelInfo(DuxiaomanMaterialInfo duxiaomanMaterialInfo);
+}

+ 550 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/service/impl/DuxiaomanMaterialInfoServiceImpl.java

@@ -0,0 +1,550 @@
+package org.jeecg.modules.duxiaoman.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialAscription;
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.entity.MaterialParameter;
+import cn.com.ctop.common.module.entity.MaterialTagInfo;
+import cn.com.ctop.common.module.entity.Product;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.entity.TagInfo;
+import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
+import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
+import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
+import cn.com.ctop.common.module.mapper.MaterialTagMapper;
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.IMaterialTagInfoService;
+import cn.com.ctop.common.module.service.IMessageTemplate;
+import cn.com.ctop.common.module.service.IProductService;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.ISendMessageService;
+import cn.com.ctop.common.module.service.ISysUserService;
+import cn.com.ctop.common.module.service.ITagInfoService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CloudVideoProcessUtil;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.KuaishouDuXiaoManAPIConstant;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import it.sauronsoftware.jave.Encoder;
+import it.sauronsoftware.jave.MultimediaInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.entity.SysUser;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.duxiaoman.entity.DuxiaomanMaterialInfo;
+import org.jeecg.modules.duxiaoman.mapper.DuxiaomanMaterialInfoMapper;
+import org.jeecg.modules.duxiaoman.service.IDuxiaomanMaterialInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.net.URLDecoder;
+import java.nio.channels.FileChannel;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 度小满素材信息
+ *
+ * @author jeecg-boot
+ * 2022-08-15
+ * @version V1.0
+ */
+@Slf4j
+@Service
+public class DuxiaomanMaterialInfoServiceImpl extends ServiceImpl<DuxiaomanMaterialInfoMapper, DuxiaomanMaterialInfo> implements IDuxiaomanMaterialInfoService {
+
+    @Value("${duxiaoman.url}")
+    private String duUrl;
+
+    @Value("${duxiaoman.appId}")
+    private String duAppId;
+
+    @Value("${duxiaoman.token}")
+    private String duToken;
+
+    @Value("${oss.replace.download}")
+    private String downloadUrl;
+
+    @Autowired
+    private IMaterialInfoService materialInfoService;
+
+    @Autowired
+    private IMaterialImageInfoService materialImageInfoService;
+
+    @Resource
+    private IMaterialCutFrameService materialCutFrameService;
+
+    @Autowired
+    private IMaterialTagInfoService materialTagInfoService;
+
+    @Autowired
+    private ITagInfoService tagInfoService;
+
+    @Resource
+    private MaterialParameterMapper materialParameterMapper;
+
+    @Resource
+    private MaterialInfoMapper materialInfoMapper;
+
+    @Resource
+    private MaterialAscriptionMapper materialAscriptionMapper;
+
+    @Autowired
+    private ISysUserService userService;
+
+    @Autowired
+    private IProjectService projectService;
+
+    @Autowired
+    private IProductService productService;
+
+    @Autowired
+    private IMessageTemplate messageTemplate;
+
+    @Autowired
+    private ISendMessageService sendMessageService;
+
+
+    static ExecutorService uploadService = Executors.newFixedThreadPool(3);
+    private static ExecutorService uploadExecutorService = Executors.newFixedThreadPool(5);
+
+    @Override
+    public void getMaterialChannel() {
+        String datetime = new Date().getTime() + "";
+        TreeMap<String, Object> params = new TreeMap<>();
+        params.put("app_id", duAppId);
+        params.put("datetime", datetime);
+        StringBuffer md5Str = new StringBuffer();
+        md5Str.append("app_id=").append(duAppId)
+                .append("&datetime=").append(datetime).append(duToken);
+        String sign = DigestUtils.md5Hex(md5Str.toString());
+        params.put("sign", sign);
+        String resultStr = HttpUtils.httpGetRequest(duUrl + KuaishouDuXiaoManAPIConstant.MATERIAL_CHANNEL, null, params);
+        JSONObject resultJson = JSONObject.parseObject(resultStr);
+        log.info("----------查询渠道:{}", resultJson);
+        if (!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 0) {
+            JSONArray result = resultJson.getJSONArray("result");
+        }
+    }
+
+    @Override
+    public void getmaterialType() {
+        String datetime = new Date().getTime() + "";
+        TreeMap<String, Object> params = new TreeMap<>();
+        params.put("app_id", duAppId);
+        params.put("datetime", datetime);
+        StringBuffer md5Str = new StringBuffer();
+        md5Str.append("app_id=").append(duAppId)
+                .append("&datetime=").append(datetime).append(duToken);
+        String sign = DigestUtils.md5Hex(md5Str.toString());
+        params.put("sign", sign);
+        String resultStr = HttpUtils.httpGetRequest(duUrl + KuaishouDuXiaoManAPIConstant.MATERIAL_TYPE, null, params);
+        JSONObject resultJson = JSONObject.parseObject(resultStr);
+        log.info("----------查询通用素材分类:{}", resultJson);
+        if (!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 0) {
+            JSONArray result = resultJson.getJSONArray("result");
+        }
+    }
+
+    @Override
+    public Result<Object> upload(DuxiaomanMaterialInfo materialInfo) {
+        try {
+            String fileConfigId = "5";
+            if ("VIDEO".equals(materialInfo.getType())) {
+                fileConfigId = "3";
+            }
+            String requestUrl = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
+            String localUrl = LoadFileUtil.downLoadFromUrl(materialInfo.getUrl(), downloadUrl);
+            String md5 = LoadFileUtil.getMD5(localUrl);
+            String datetime = new Date().getTime() + "";
+            JSONObject params = new JSONObject();
+            params.put("app_id", duAppId);
+            params.put("datetime", datetime);
+            params.put("signature", md5);
+            params.put("file_config_id", fileConfigId);
+            StringBuffer md5Str = new StringBuffer();
+            md5Str.append("app_id=").append(duAppId)
+                    .append("&datetime=").append(datetime)
+                    .append("&file_config_id=").append(fileConfigId)
+                    .append("&signature=").append(md5).append(duToken);
+            String sign = DigestUtils.md5Hex(md5Str.toString());
+            params.put("sign", sign);
+            JSONObject resultJson = HttpUtils.fileUpload(duUrl + KuaishouDuXiaoManAPIConstant.MATERIAL_UPLOAD, localUrl, params);
+            log.info("----------素材上传:{}", resultJson);
+            if (!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 0) {
+                JSONObject result = resultJson.getJSONObject("result");
+                materialInfo.setFileId(result.getString("file_id"));
+                materialReport(materialInfo);
+                //7:上传成功
+                materialInfo.setStatus(7);
+            } else {
+                //8:上传失败
+                materialInfo.setStatus(8);
+            }
+            baseMapper.updateById(materialInfo);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.ok();
+    }
+
+
+    @Override
+    public void materialDetail2(DuxiaomanMaterialInfo materialInfo) {
+
+    }
+
+    /**
+     * 素材报备
+     */
+    @Override
+    public void materialReport(DuxiaomanMaterialInfo materialInfo) {
+        try {
+            //素材分类: 1110004-视频,1110006-脚本
+            String type = "1110006";
+            if ("VIDEO".equals(materialInfo.getType())) {
+                type = "1110004";
+            }
+
+            String datetime = new Date().getTime() + "";
+            TreeMap<String, Object> params = new TreeMap<>();
+            params.put("app_id", duAppId);
+            params.put("datetime", datetime);
+            //渠道id 快手-3715834215185534246 ,今日头条-3715778792927469631, 微信支付-3715834386984222891
+            params.put("channel_id", "3715834215185534246");
+            //素材分类: 1110004-视频,1110006-脚本
+            params.put("type", type);
+            //素材文件id
+            params.put("file_ids", materialInfo.getFileId());
+            //素材中使用的版权内容已获得有效书面授权书 默认值 1
+            params.put("authorize", "1");
+            StringBuffer md5Str = new StringBuffer();
+            md5Str.append("app_id=").append(duAppId)
+                    .append("&authorize=1")
+                    .append("&channel_id=").append("3715834215185534246")
+                    .append("&datetime=").append(datetime)
+                    .append("&file_ids=").append(materialInfo.getFileId())
+                    .append("&type=").append(type).append(duToken);
+            String sign = DigestUtils.md5Hex(md5Str.toString());
+            params.put("sign", sign);
+            String resultStr = HttpUtils.httpPostRequest(duUrl + KuaishouDuXiaoManAPIConstant.MATERIAL_REPORT, params, null);
+            JSONObject resultJson = JSONObject.parseObject(resultStr);
+            log.info("----------素材报备:{}", resultJson);
+            if (!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 0) {
+                //2:审批中
+                materialInfo.setStatus(2);
+                materialInfo.setAuditTaskId(resultJson.getString("result"));
+                baseMapper.updateById(materialInfo);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    /**
+     * 查询报备状态
+     */
+    @Override
+    public void materialDetail(DuxiaomanMaterialInfo materialInfo) {
+        try {
+            String datetime = new Date().getTime() + "";
+            TreeMap<String, Object> params = new TreeMap<>();
+            params.put("app_id", duAppId);
+            params.put("datetime", datetime);
+            //审核任务 id
+            params.put("id", materialInfo.getAuditTaskId());
+            StringBuffer md5Str = new StringBuffer();
+            md5Str.append("app_id=").append(duAppId)
+                    .append("&datetime=").append(datetime)
+                    .append("&id=").append(materialInfo.getAuditTaskId()).append(duToken);
+            String sign = DigestUtils.md5Hex(md5Str.toString());
+            params.put("sign", sign);
+            String resultStr = HttpUtils.httpPostRequest(duUrl + KuaishouDuXiaoManAPIConstant.MATERIAL_DETAIL, params, null);
+            JSONObject resultJson = JSONObject.parseObject(resultStr);
+            log.info("----------查询报备状态:{}", resultJson);
+            if (!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 0) {
+                JSONObject result = resultJson.getJSONObject("result");
+                Integer auditStatus = result.getInteger("audit_status");
+                materialInfo.setStatus(auditStatus);
+                materialInfo.setConfirmTime(result.getString("audit_time"));
+                //3 审核通过 同步到素材表
+                if (auditStatus == 3) {
+                    syncMaterial(materialInfo);
+                }
+                if ("SCRIPT".equals(materialInfo.getType())) {
+                    Project project = projectService.getById(materialInfo.getProjectId());
+                    String text = messageTemplate.getDuXiaoManMaterialTemplate(materialInfo.getProductName(), project.getProjectName(), materialInfo.getMaterialName(), materialInfo.getRefuseReason(), true);
+                    sendMessageService.sendMessage(materialInfo.getUserId(), text);
+                }
+            } else {
+                JSONObject result = resultJson.getJSONObject("result");
+                materialInfo.setStatus(result.getInteger("audit_status"));
+                materialInfo.setConfirmTime(result.getString("audit_time"));
+                materialInfo.setRefuseReason(result.getString("audit_reason"));
+                if ("SCRIPT".equals(materialInfo.getType()) && materialInfo.getStatus() == 4) {
+                    Project project = projectService.getById(materialInfo.getProjectId());
+                    String text = messageTemplate.getDuXiaoManMaterialTemplate(materialInfo.getProductName(), project.getProjectName(), materialInfo.getMaterialName(), materialInfo.getRefuseReason(), false);
+                    sendMessageService.sendMessage(materialInfo.getUserId(), text);
+                }
+            }
+            baseMapper.updateById(materialInfo);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    /**
+     * 将审核通过的素材同步到 ctop_material_info 表中
+     */
+    private void syncMaterial(DuxiaomanMaterialInfo materialInfo) {
+        MaterialInfo info = new MaterialInfo();
+        BeanUtil.copyProperties(materialInfo, info);
+        info.setStatus(1);
+        info.setCode(materialInfo.getSignature());
+        info.setType("VIDEO");
+        info.setId(UUID.randomUUID().toString());
+        materialInfoService.save(info);
+        getFile(info);
+
+    }
+
+    @Override
+    public void uploadMaterial(DuxiaomanMaterialInfo materialInfo) {
+        uploadService.submit(new Runnable() {
+            @Override
+            public void run() {
+                upload(materialInfo);
+            }
+        });
+    }
+
+
+    @Override
+    public Result<Object> add(JSONObject json) {
+        try {
+            String userId = json.getString("userId");
+            String signature = json.getString("signature");
+            String url = json.getString("url");
+            if (!json.getString("url").contains("https")) {
+                url = "https:" + json.getString("url");
+            }
+            DuxiaomanMaterialInfo info = new DuxiaomanMaterialInfo();
+            Long projectId = json.getLong("projectId");
+            Project project = projectService.getById(projectId);
+            if (!Check.isNull(project)) {
+                info.setProductId(project.getProductId());
+                info.setProjectName(project.getProjectName());
+                Product product = productService.getById(info.getProductId());
+                if (!Check.isNull(product)) {
+                    info.setProductName(product.getProductName());
+                }
+            }
+
+            info.setId(UUID.randomUUID().toString().replace("-", ""));
+            info.setStatDate(DateUtils.formatDate(new Date()));
+            info.setSignature(signature);
+            info.setUrl(url);
+            info.setUserId(userId);
+            info.setProjectId(projectId);
+            info.setStatus(0);
+            info.setMaterialName(json.getString("materialName"));
+            info.setMaterialDescribe(json.getString("materialDescribe"));
+            info.setType(json.getString("type"));
+            String videoUrl = URLDecoder.decode(info.getUrl()).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
+            String loadImage = "cutFrame/" + signature + "/zero.jpg";
+            try {
+                String coverUrl = CloudVideoProcessUtil.videoCutPictureHandle(videoUrl, loadImage);
+                info.setCoverUrl(coverUrl);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            this.save(info);
+
+            Map<String, Object> deleteMap = new HashMap<>();
+            deleteMap.put("material_id", info.getSignature());
+            JSONObject ascription = json.getJSONObject("ascription");
+            if (!Check.isNull(ascription)) {
+                MaterialAscription materialAscription = new MaterialAscription();
+                materialAscription.setMaterialId(info.getSignature());
+                String clipId = ascription.getString("clipId");
+                if (null != clipId && !"".equals(clipId.trim())) {
+                    materialAscription.setClipId(clipId);
+                }
+                materialAscription.setShotId(ascription.getString("shotId"));
+                materialAscription.setPlanId(ascription.getString("planId"));
+                materialAscription.setPlaneId(ascription.getString("planeId"));
+                materialAscription.setCode(info.getSignature());
+                materialAscriptionMapper.deleteByMap(deleteMap);
+                //TODO 需要添加获取设计负责人代码
+                SysUser clip = userService.getById(clipId);
+                String roleCode = userService.getRoleCodeByUserId(clipId);
+                String leaderName = "";
+                String leaderId = "";
+                if ("designTeamLeader".equals(roleCode)) {
+                    leaderId = clipId;
+
+                    leaderName = clip.getRealname();
+                } else {
+                    leaderId = clip.getLeaderId();
+                    leaderName = clip.getLeaderName();
+                }
+                materialAscription.setLeaderName(leaderName);
+                materialAscription.setLeaderId(leaderId);
+                int result = materialAscriptionMapper.insert(materialAscription);
+            }
+            materialTagInfoService.deleteByCode(signature);
+            JSONArray modalityTagList = json.getJSONArray("modalityTagList");
+            insertTagList(signature, userId, modalityTagList);
+            JSONArray contentTagList = json.getJSONArray("contentTagList");
+            insertTagList(signature, userId, contentTagList);
+            JSONArray senceTagList = json.getJSONArray("senceTagList");
+            insertTagList(signature, userId, senceTagList);
+            JSONArray modTagList = json.getJSONArray("modTagList");
+            insertTagList(signature, userId, modTagList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("fail," + e.getMessage());
+        }
+        return Result.ok("success");
+    }
+
+
+    /**
+     * 添加标签
+     */
+    private void insertTagList(String code, String userId, JSONArray tagList) {
+        if (null != tagList && !tagList.isEmpty()) {
+            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);
+                setTag.setCategoryId(tagInfo.getTagCategoryId());
+                materialTagInfoService.save(setTag);
+            }
+        }
+    }
+
+
+    /**
+     * 录入素材信息
+     */
+    public void getFile(MaterialInfo materialInfo) {
+        uploadExecutorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                log.info("获取素材基本信息,code:{}", materialInfo.getCode());
+                String url = materialInfo.getUrl();
+                log.info("replaceUrl:{}", url);
+                String localUrl = null;
+                MultimediaInfo m = null;
+                FileInputStream fis = null;
+                try {
+                    localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
+                    File file = new File(localUrl);
+                    it.sauronsoftware.jave.Encoder encoder = new Encoder();
+                    m = encoder.getInfo(file);
+                    long duration = m.getDuration();
+                    long secondDuration = duration / 1000;
+                    MaterialParameter materialParameter = new MaterialParameter();
+                    materialParameter.setMaterialId(materialInfo.getCode());
+                    // 视频秒数
+                    materialParameter.setSecond(secondDuration);
+                    // 视频格式
+                    materialParameter.setFormat(m.getFormat());
+                    // 视频宽
+                    String width = String.valueOf(m.getVideo().getSize().getWidth());
+                    materialParameter.setWidth(width);
+                    // 视频高
+                    String height = String.valueOf(m.getVideo().getSize().getHeight());
+                    materialParameter.setHeight(height);
+                    fis = new FileInputStream(file);
+                    FileChannel fc = fis.getChannel();
+                    BigDecimal fileSize = new BigDecimal(fc.size());
+                    String size = fileSize.divide(new BigDecimal(1048576), 2, RoundingMode.HALF_UP) + "MB";
+                    materialParameter.setSize(size);
+                    materialParameter.setUpdateTime(new Date());
+
+                    Map<String, Object> deleteMap = new HashMap<>();
+                    deleteMap.put("material_id", materialInfo.getId());
+                    materialParameterMapper.deleteByMap(deleteMap);
+                    int insert = materialParameterMapper.insert(materialParameter);
+                    // 默认抽帧 素造供应商
+                 /*   Long templateId = MaterialSupplierEnum.getTemplateIdBySize(Integer.valueOf(width), Integer.valueOf(height));
+                    if (!Check.isNull(templateId)) {
+                        Thread thread = new Thread() {
+                            @Override
+                            public void run() {
+                                watermarkVideoBySupplierCode(materialInfo.getCode(), materialInfo.getUrl(), templateId);
+                            }
+                        };
+                        thread.start();
+                    }*/
+                } catch (Exception e) {
+                    e.printStackTrace();
+                } finally {
+                    try {
+                        if (fis != null) {
+                            fis.close();
+                        }
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                    LoadFileUtil.delFile(localUrl);
+                }
+            }
+        });
+    }
+
+    @Override
+    public Result<Object> getPersonnelInfo(DuxiaomanMaterialInfo info) {
+        JSONObject obj = new JSONObject();
+        if (!Check.isNull(info.getAuditorId())) {
+            String auditorName = materialInfoMapper.selectUserNameById(info.getAuditorId());
+            obj.put("auditorName", auditorName);
+        } else {
+            obj.put("auditorName", "");
+        }
+        obj.put("info", info);
+        List<String> tagList = materialTagInfoService.getByCode(info.getSignature());
+        if (!Check.isNull(tagList)) {
+            obj.put("tag", tagList);
+        }
+        QueryWrapper<MaterialParameter> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("material_id", info.getSignature());
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        MaterialParameter materialParameter = materialParameterMapper.selectOne(queryWrapper);
+        if (!Check.isNull(materialParameter)) {
+            obj.put("parameter", materialParameter);
+        }
+        JSONObject ascriptionJson = materialAscriptionMapper.selectByMaterialId(info.getSignature());
+        if (!Check.isNull(ascriptionJson)) {
+            obj.put("ascription", ascriptionJson);
+        }
+        return Result.ok(obj);
+    }
+}

+ 14 - 9
jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-dev.yml

@@ -1,5 +1,5 @@
 server:
-  port: 7001
+  port: 7701
   servlet:
     context-path: /jeecg-boot
     compression:
@@ -76,10 +76,10 @@ spring:
   autoconfigure:
     exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
   datasource:
-#---------------------线上库
-#    url: jdbc:mysql://139.186.27.96:3390/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
-#    username: readonly
-#    password: hcst@2021
+    #---------------------线上库
+    #    url: jdbc:mysql://139.186.27.96:3390/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
+    #    username: readonly
+    #    password: hcst@2021
     #---------------------测试库
     url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
     username: hcst
@@ -121,11 +121,11 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-#---------------------线上库
+          #---------------------线上库
 #          url: jdbc:mysql://139.186.27.96:3390/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
-#          username: readonly
+#          username: data
 #          password: hcst@2021
-#---------------------测试库
+          #---------------------测试库
           url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
           username: hcst
           password: hcst@2020
@@ -277,4 +277,9 @@ ai:
 xxl-job:
   requestUrl: http://jiaoyangapi.shyouteng.com.cn
 rule:
-  bytedanceUrl: http://139.186.165.84:8808/
+  bytedanceUrl: http://139.186.165.84:8808/
+
+duxiaoman:
+  url: https://dev-liang.duxiaoman.com
+  appId: 1660011893128
+  token: 99e6dfa5ff790437200521fd13d6128c

+ 6 - 1
jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-prod.yml

@@ -266,4 +266,9 @@ ai:
 xxl-job:
   requestUrl: http://jiaoyangapi.shyouteng.com.cn
 rule:
-  bytedanceUrl: http://118.24.244.213:8808/
+  bytedanceUrl: http://118.24.244.213:8808/
+
+duxiaoman:
+  url: http://liang.duxiaoman.com
+  appId: 1660012052762
+  token: 1f8a5a1cbd4d626a2aa197b86f6cab8a

+ 6 - 1
jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-test.yml

@@ -275,4 +275,9 @@ elasticsearch:
   max-connect-per-route: 100
 
 rule:
-  bytedanceUrl: http://139.186.165.84:8808/
+  bytedanceUrl: http://139.186.165.84:8808/
+
+duxiaoman:
+  url: https://dev-liang.duxiaoman.com
+  appId: 1660011893128
+  token: 99e6dfa5ff790437200521fd13d6128c