yumeng 5 лет назад
Родитель
Сommit
53646dccc0
26 измененных файлов с 1322 добавлено и 52 удалено
  1. 7 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  2. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ProjectMember.java
  3. 5 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/controller/FileController.java
  4. 248 0
      module-common/src/main/java/cn/com/ctop/common/module/controller/MaterialAscriptionController.java
  5. 248 0
      module-common/src/main/java/cn/com/ctop/common/module/controller/MaterialParameterController.java
  6. 248 0
      module-common/src/main/java/cn/com/ctop/common/module/controller/MaterialTagController.java
  7. 76 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialAscription.java
  8. 24 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  9. 81 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialParameter.java
  10. 57 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialTag.java
  11. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialAscriptionMapper.java
  12. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialParameterMapper.java
  13. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialTagMapper.java
  14. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialAscriptionMapper.xml
  15. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialParameterMapper.xml
  16. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialTagMapper.xml
  17. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialAscriptionService.java
  18. 2 2
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  19. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialParameterService.java
  20. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialTagService.java
  21. 0 30
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  22. 19 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialAscriptionServiceImpl.java
  23. 161 16
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  24. 19 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialParameterServiceImpl.java
  25. 19 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagServiceImpl.java
  26. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.bytedance.mapper.MaterialReportMapper;
 import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -55,6 +56,8 @@ public class ProjectMemberController {
     private ProjectMemberMapper projectMemberMapper;
     @Autowired
     private IProjectService projectService;
+    @Autowired
+    private MaterialReportMapper materialReportMapper;
 
 
     /**
@@ -184,6 +187,10 @@ public class ProjectMemberController {
                         continue;
                     }
                     ProjectMember member = new ProjectMember();
+                    String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+                    if (!Check.isNull(roleCode)) {
+                        member.setRoleCode(roleCode);
+                    }
                     member.setProjectId(projectId);
                     member.setProjectName(projectName);
                     member.setUserId(userId);

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ProjectMember.java

@@ -70,6 +70,8 @@ public class ProjectMember {
     @TableField(exist = false)
     private String mediaId;
 
+    private String roleCode;
+
     /**
      * 创建时间
      */

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

@@ -29,9 +29,10 @@ public class FileController {
 
     @PostMapping("file/insert")
     public Map<String, Object> insertFile(@RequestBody JSONObject json) {
-        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        String code = json.getString("code");
-        String url = json.getString("url");
-        return materialInfoService.insert(user.getId(), code, url);
+        LoginUser user = (LoginUser) SecurityUtils.getSubject()
+                .getPrincipal();
+
+        json.put("userId", user.getId());
+        return materialInfoService.insert(json);
     }
 }

+ 248 - 0
module-common/src/main/java/cn/com/ctop/common/module/controller/MaterialAscriptionController.java

@@ -0,0 +1,248 @@
+package cn.com.ctop.common.module.controller;
+
+import cn.com.ctop.common.module.entity.MaterialAscription;
+import cn.com.ctop.common.module.service.IMaterialAscriptionService;
+import com.alibaba.fastjson.JSON;
+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.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 素材归属标
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-23
+ */
+@Slf4j
+@Api(tags = "素材归属标")
+@RestController
+@RequestMapping("/ctop/materialAscription")
+public class MaterialAscriptionController {
+    @Autowired
+    private IMaterialAscriptionService materialAscriptionService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param materialAscription
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "素材归属标-分页列表查询")
+    @ApiOperation(value = "素材归属标-分页列表查询", notes = "素材归属标-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<MaterialAscription>> queryPageList(MaterialAscription materialAscription,
+                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                           HttpServletRequest req) {
+        Result<IPage<MaterialAscription>> result = new Result<IPage<MaterialAscription>>();
+        QueryWrapper<MaterialAscription> queryWrapper = QueryGenerator.initQueryWrapper(materialAscription, req.getParameterMap());
+        Page<MaterialAscription> page = new Page<MaterialAscription>(pageNo, pageSize);
+        IPage<MaterialAscription> pageList = materialAscriptionService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param materialAscription
+     * @return
+     */
+    @AutoLog(value = "素材归属标-添加")
+    @ApiOperation(value = "素材归属标-添加", notes = "素材归属标-添加")
+    @PostMapping(value = "/add")
+    public Result<MaterialAscription> add(@RequestBody MaterialAscription materialAscription) {
+        Result<MaterialAscription> result = new Result<MaterialAscription>();
+        try {
+            materialAscriptionService.save(materialAscription);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param materialAscription
+     * @return
+     */
+    @AutoLog(value = "素材归属标-编辑")
+    @ApiOperation(value = "素材归属标-编辑", notes = "素材归属标-编辑")
+    @PutMapping(value = "/edit")
+    public Result<MaterialAscription> edit(@RequestBody MaterialAscription materialAscription) {
+        Result<MaterialAscription> result = new Result<MaterialAscription>();
+        MaterialAscription materialAscriptionEntity = materialAscriptionService.getById(materialAscription.getId());
+        if (materialAscriptionEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = materialAscriptionService.updateById(materialAscription);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "素材归属标-通过id删除")
+    @ApiOperation(value = "素材归属标-通过id删除", notes = "素材归属标-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            materialAscriptionService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "素材归属标-批量删除")
+    @ApiOperation(value = "素材归属标-批量删除", notes = "素材归属标-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<MaterialAscription> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<MaterialAscription> result = new Result<MaterialAscription>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.materialAscriptionService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "素材归属标-通过id查询")
+    @ApiOperation(value = "素材归属标-通过id查询", notes = "素材归属标-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<MaterialAscription> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<MaterialAscription> result = new Result<MaterialAscription>();
+        MaterialAscription materialAscription = materialAscriptionService.getById(id);
+        if (materialAscription == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(materialAscription);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<MaterialAscription> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                MaterialAscription materialAscription = JSON.parseObject(deString, MaterialAscription.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(materialAscription, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<MaterialAscription> pageList = materialAscriptionService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "素材归属标列表");
+        mv.addObject(NormalExcelConstants.CLASS, MaterialAscription.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("素材归属标列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<MaterialAscription> listMaterialAscriptions = ExcelImportUtil.importExcel(file.getInputStream(), MaterialAscription.class, params);
+                materialAscriptionService.saveBatch(listMaterialAscriptions);
+                return Result.ok("文件导入成功!数据行数:" + listMaterialAscriptions.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 248 - 0
module-common/src/main/java/cn/com/ctop/common/module/controller/MaterialParameterController.java

@@ -0,0 +1,248 @@
+package cn.com.ctop.common.module.controller;
+
+import cn.com.ctop.common.module.entity.MaterialParameter;
+import cn.com.ctop.common.module.service.IMaterialParameterService;
+import com.alibaba.fastjson.JSON;
+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.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 素材归属标
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-23
+ */
+@Slf4j
+@Api(tags = "素材归属标")
+@RestController
+@RequestMapping("/ctop/materialParameter")
+public class MaterialParameterController {
+    @Autowired
+    private IMaterialParameterService materialParameterService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param materialParameter
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "素材归属标-分页列表查询")
+    @ApiOperation(value = "素材归属标-分页列表查询", notes = "素材归属标-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<MaterialParameter>> queryPageList(MaterialParameter materialParameter,
+                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                          HttpServletRequest req) {
+        Result<IPage<MaterialParameter>> result = new Result<IPage<MaterialParameter>>();
+        QueryWrapper<MaterialParameter> queryWrapper = QueryGenerator.initQueryWrapper(materialParameter, req.getParameterMap());
+        Page<MaterialParameter> page = new Page<MaterialParameter>(pageNo, pageSize);
+        IPage<MaterialParameter> pageList = materialParameterService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param materialParameter
+     * @return
+     */
+    @AutoLog(value = "素材归属标-添加")
+    @ApiOperation(value = "素材归属标-添加", notes = "素材归属标-添加")
+    @PostMapping(value = "/add")
+    public Result<MaterialParameter> add(@RequestBody MaterialParameter materialParameter) {
+        Result<MaterialParameter> result = new Result<MaterialParameter>();
+        try {
+            materialParameterService.save(materialParameter);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param materialParameter
+     * @return
+     */
+    @AutoLog(value = "素材归属标-编辑")
+    @ApiOperation(value = "素材归属标-编辑", notes = "素材归属标-编辑")
+    @PutMapping(value = "/edit")
+    public Result<MaterialParameter> edit(@RequestBody MaterialParameter materialParameter) {
+        Result<MaterialParameter> result = new Result<MaterialParameter>();
+        MaterialParameter materialParameterEntity = materialParameterService.getById(materialParameter.getId());
+        if (materialParameterEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = materialParameterService.updateById(materialParameter);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "素材归属标-通过id删除")
+    @ApiOperation(value = "素材归属标-通过id删除", notes = "素材归属标-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            materialParameterService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "素材归属标-批量删除")
+    @ApiOperation(value = "素材归属标-批量删除", notes = "素材归属标-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<MaterialParameter> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<MaterialParameter> result = new Result<MaterialParameter>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.materialParameterService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "素材归属标-通过id查询")
+    @ApiOperation(value = "素材归属标-通过id查询", notes = "素材归属标-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<MaterialParameter> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<MaterialParameter> result = new Result<MaterialParameter>();
+        MaterialParameter materialParameter = materialParameterService.getById(id);
+        if (materialParameter == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(materialParameter);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<MaterialParameter> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                MaterialParameter materialParameter = JSON.parseObject(deString, MaterialParameter.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(materialParameter, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<MaterialParameter> pageList = materialParameterService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "素材归属标列表");
+        mv.addObject(NormalExcelConstants.CLASS, MaterialParameter.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("素材归属标列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<MaterialParameter> listMaterialParameters = ExcelImportUtil.importExcel(file.getInputStream(), MaterialParameter.class, params);
+                materialParameterService.saveBatch(listMaterialParameters);
+                return Result.ok("文件导入成功!数据行数:" + listMaterialParameters.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 248 - 0
module-common/src/main/java/cn/com/ctop/common/module/controller/MaterialTagController.java

@@ -0,0 +1,248 @@
+package cn.com.ctop.common.module.controller;
+
+import cn.com.ctop.common.module.entity.MaterialTag;
+import cn.com.ctop.common.module.service.IMaterialTagService;
+import com.alibaba.fastjson.JSON;
+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.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 素材归属标
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-23
+ */
+@Slf4j
+@Api(tags = "素材归属标")
+@RestController
+@RequestMapping("/ctop/materialTag")
+public class MaterialTagController {
+    @Autowired
+    private IMaterialTagService materialTagService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param materialTag
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "素材归属标-分页列表查询")
+    @ApiOperation(value = "素材归属标-分页列表查询", notes = "素材归属标-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<MaterialTag>> queryPageList(MaterialTag materialTag,
+                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                    HttpServletRequest req) {
+        Result<IPage<MaterialTag>> result = new Result<IPage<MaterialTag>>();
+        QueryWrapper<MaterialTag> queryWrapper = QueryGenerator.initQueryWrapper(materialTag, req.getParameterMap());
+        Page<MaterialTag> page = new Page<MaterialTag>(pageNo, pageSize);
+        IPage<MaterialTag> pageList = materialTagService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param materialTag
+     * @return
+     */
+    @AutoLog(value = "素材归属标-添加")
+    @ApiOperation(value = "素材归属标-添加", notes = "素材归属标-添加")
+    @PostMapping(value = "/add")
+    public Result<MaterialTag> add(@RequestBody MaterialTag materialTag) {
+        Result<MaterialTag> result = new Result<MaterialTag>();
+        try {
+            materialTagService.save(materialTag);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param materialTag
+     * @return
+     */
+    @AutoLog(value = "素材归属标-编辑")
+    @ApiOperation(value = "素材归属标-编辑", notes = "素材归属标-编辑")
+    @PutMapping(value = "/edit")
+    public Result<MaterialTag> edit(@RequestBody MaterialTag materialTag) {
+        Result<MaterialTag> result = new Result<MaterialTag>();
+        MaterialTag materialTagEntity = materialTagService.getById(materialTag.getId());
+        if (materialTagEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = materialTagService.updateById(materialTag);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "素材归属标-通过id删除")
+    @ApiOperation(value = "素材归属标-通过id删除", notes = "素材归属标-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            materialTagService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "素材归属标-批量删除")
+    @ApiOperation(value = "素材归属标-批量删除", notes = "素材归属标-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<MaterialTag> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<MaterialTag> result = new Result<MaterialTag>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.materialTagService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "素材归属标-通过id查询")
+    @ApiOperation(value = "素材归属标-通过id查询", notes = "素材归属标-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<MaterialTag> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<MaterialTag> result = new Result<MaterialTag>();
+        MaterialTag materialTag = materialTagService.getById(id);
+        if (materialTag == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(materialTag);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<MaterialTag> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                MaterialTag materialTag = JSON.parseObject(deString, MaterialTag.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(materialTag, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<MaterialTag> pageList = materialTagService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "素材归属标列表");
+        mv.addObject(NormalExcelConstants.CLASS, MaterialTag.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("素材归属标列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<MaterialTag> listMaterialTags = ExcelImportUtil.importExcel(file.getInputStream(), MaterialTag.class, params);
+                materialTagService.saveBatch(listMaterialTags);
+                return Result.ok("文件导入成功!数据行数:" + listMaterialTags.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 76 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialAscription.java

@@ -0,0 +1,76 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import 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 2019-11-23
+ */
+@Data
+@TableName("ctop_material_ascription")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_material_ascription对象", description = "素材归属标")
+public class MaterialAscription {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * 素材库id
+     */
+    @Excel(name = "素材库id", width = 15)
+    @ApiModelProperty(value = "素材库id")
+    private String materialId;
+    /**
+     * 剪辑人id
+     */
+    @Excel(name = "剪辑人id", width = 15)
+    @ApiModelProperty(value = "剪辑人id")
+    private String clipId;
+    /**
+     * 拍摄人id
+     */
+    @Excel(name = "拍摄人id", width = 15)
+    @ApiModelProperty(value = "拍摄人id")
+    private String shotId;
+    /**
+     * 策划id
+     */
+    @Excel(name = "策划id", width = 15)
+    @ApiModelProperty(value = "策划id")
+    private String planId;
+    /**
+     * 平面id
+     */
+    @Excel(name = "平面id", width = 15)
+    @ApiModelProperty(value = "平面id")
+    private String planeId;
+
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 24 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -37,6 +37,7 @@ public class MaterialInfo {
     @Excel(name = "code", width = 15)
     @ApiModelProperty(value = "code")
     private String code;
+    private String watermarkCode;
     /**
      * url
      */
@@ -44,9 +45,16 @@ public class MaterialInfo {
     @ApiModelProperty(value = "url")
     private String url;
 
+    /**
+     * 水印素材链接
+     */
+    private String watermarkUrl;
+
     private String type;
     /**
      * status
+     * <p>
+     * 0-待审核 1-审核通过 2-审核拒绝
      */
     @Excel(name = "status", width = 15)
     @ApiModelProperty(value = "status")
@@ -58,6 +66,22 @@ public class MaterialInfo {
     @ApiModelProperty(value = "status")
     private String userId;
 
+
+    private String materialDescribe;
+
+
+    private Long projectId;
+
+    /**
+     * 素材名称
+     */
+    private String materialName;
+
+    /**
+     * 水印素材名称
+     */
+    private String watermarkMaterialName;
+
     /**
      * createTime
      */

+ 81 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialParameter.java

@@ -0,0 +1,81 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import 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 2019-11-23
+ */
+@Data
+@TableName("ctop_material_parameter")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_material_parameter对象", description = "素材归属标")
+public class MaterialParameter {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * 素材库id
+     */
+    @Excel(name = "素材库id", width = 15)
+    @ApiModelProperty(value = "素材库id")
+    private String materialId;
+    /**
+     * 视频秒数
+     */
+    @Excel(name = "视频秒数", width = 15)
+    @ApiModelProperty(value = "视频秒数")
+    private Long second;
+    /**
+     * 格式
+     */
+    @Excel(name = "格式", width = 15)
+    @ApiModelProperty(value = "格式")
+    private String format;
+    /**
+     * 宽
+     */
+    @Excel(name = "宽", width = 15)
+    @ApiModelProperty(value = "宽")
+    private String width;
+    /**
+     * 高
+     */
+    @Excel(name = "高", width = 15)
+    @ApiModelProperty(value = "高")
+    private String height;
+    /**
+     * 小
+     */
+    @Excel(name = "小", width = 15)
+    @ApiModelProperty(value = "小")
+    private String size;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 57 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialTag.java

@@ -0,0 +1,57 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import 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 2019-11-23
+ */
+@Data
+@TableName("ctop_material_tag")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_material_tag对象", description = "素材归属标")
+public class MaterialTag {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * 素材库id
+     */
+    @Excel(name = "素材库id", width = 15)
+    @ApiModelProperty(value = "素材库id")
+    private String materialId;
+    /**
+     * 剪辑人id
+     */
+    @Excel(name = "剪辑人id", width = 15)
+    @ApiModelProperty(value = "剪辑人id")
+    private String tag;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialAscriptionMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.MaterialAscription;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 素材归属标
+ *
+ * @author: jeecg-boot
+ * @date: 2019-11-23
+ * @cersion: V1.0
+ */
+public interface MaterialAscriptionMapper extends BaseMapper<MaterialAscription> {
+
+}

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialParameterMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.MaterialParameter;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 素材归属标
+ *
+ * @author: jeecg-boot
+ * @date: 2019-11-23
+ * @cersion: V1.0
+ */
+public interface MaterialParameterMapper extends BaseMapper<MaterialParameter> {
+
+}

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialTagMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.MaterialTag;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 素材归属标
+ *
+ * @author: jeecg-boot
+ * @date: 2019-11-23
+ * @cersion: V1.0
+ */
+public interface MaterialTagMapper extends BaseMapper<MaterialTag> {
+
+}

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

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

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

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

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

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

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialAscriptionService.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.MaterialAscription;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 素材归属标
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-23
+ */
+public interface IMaterialAscriptionService extends IService<MaterialAscription> {
+
+}

+ 2 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -1,9 +1,9 @@
 package cn.com.ctop.common.module.service;
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
-import java.io.IOException;
 import java.util.Map;
 
 /**
@@ -18,5 +18,5 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
     Map<String, Object> checkMaterialInfo(String code);
 
-    Map<String, Object> insert(String userId, String code, String url) throws IOException;
+    Map<String, Object> insert(JSONObject jsonObject);
 }

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialParameterService.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.MaterialParameter;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 素材归属标
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-23
+ */
+public interface IMaterialParameterService extends IService<MaterialParameter> {
+
+}

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialTagService.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.MaterialTag;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 素材归属标
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-23
+ */
+public interface IMaterialTagService extends IService<MaterialTag> {
+
+}

+ 0 - 30
module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java

@@ -428,34 +428,4 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         return null;
     }
 
-    public static void main(String[] args) throws IOException {
-        long l = System.currentTimeMillis();
-
-        String localUrl = LoadFileUtil.downLoadFromUrl("https://ctop-media.oss-cn-beijing.aliyuncs.com/%E4%BC%8A%E5%AF%B9%20-%20PPT%20-%20%E4%BA%8E%E5%B0%A4%E4%BD%B3%20-%200920%20-%203-1571710256384.mp4", "D:\\tets1\\video");
-
-
-        File file = new File(localUrl);
-        Map map = new HashMap();
-        it.sauronsoftware.jave.Encoder encoder = new Encoder();
-        try {
-            it.sauronsoftware.jave.MultimediaInfo m = encoder.getInfo(file);
-            long duration = m.getDuration();
-            long secondDuration = duration / 1000;
-            map.put("secondDuration", secondDuration);//获取视频秒数
-            map.put("format", m.getFormat());//获取视频格式
-            map.put("width", m.getVideo().getSize().getWidth());//获取视频宽高
-            map.put("height", m.getVideo().getSize().getHeight());//获取视频长高
-            FileInputStream 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";
-            map.put("size", size);//获取视频大小
-            System.err.println(map);
-            System.err.println((System.currentTimeMillis() - l) / 1000);
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            file.delete();
-        }
-    }
 }

+ 19 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialAscriptionServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialAscription;
+import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
+import cn.com.ctop.common.module.service.IMaterialAscriptionService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 素材归属标
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-23
+ */
+@Service
+public class MaterialAscriptionServiceImpl extends ServiceImpl<MaterialAscriptionMapper, MaterialAscription> implements IMaterialAscriptionService {
+
+}

+ 161 - 16
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -1,18 +1,38 @@
 package cn.com.ctop.common.module.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.MaterialTag;
+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.IMaterialInfoService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import it.sauronsoftware.jave.Encoder;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.LoadFileUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.nio.channels.FileChannel;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 import java.util.regex.Pattern;
 
 /**
@@ -22,8 +42,10 @@ import java.util.regex.Pattern;
  * @version V1.0
  * @date 2019-10-11
  */
+@Slf4j
 @Service
 public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, MaterialInfo> implements IMaterialInfoService {
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @Override
     public MaterialInfo getMaterialInfoByCode(String code) {
@@ -59,25 +81,148 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         Pattern p = Pattern.compile(reg);
         System.out.println(p.matcher("https://ctop-media.oss-cn-beijing.aliyuncs.com/video/2019-10-30/ios%E6%8E%A8%E5%B9%BF%E8%A7%86%E9%A2%91-1572437289724.mp4").find());
     }
+
+    @Autowired
+    private MaterialAscriptionMapper materialAscriptionMapper;
+    @Autowired
+    private MaterialTagMapper materialTagMapper;
+
     @Override
-    public Map<String, Object> insert(String userId, String code, String url) throws IOException {
+    public Map<String, Object> insert(JSONObject jsonObject) {
         Map<String, Object> resultMap = new HashMap<>();
-        Boolean isVideo = imgLocation(url);
-        MaterialInfo info = new MaterialInfo();
-        info.setId(code);
-        info.setCode(code);
-        info.setUrl("https:" + url);
-        info.setStatus(1);
-        info.setUserId(userId);
-        info.setCreateTime(new Date());
-        info.setUpdateTime(new Date());
-        if (isVideo) {
-            info.setType("VIDEO");
-        } else {
-            info.setType("IMAGE");
+        try {
+
+
+
+            Boolean isVideo = imgLocation(jsonObject.getString("url"));
+            MaterialInfo info = new MaterialInfo();
+            info.setId(jsonObject.getString("code"));
+            info.setCode(jsonObject.getString("code"));
+            info.setWatermarkUrl("https:" + jsonObject.getString("watermarkUrl"));
+            info.setUrl("https:" + jsonObject.getString("url"));
+            info.setUserId(jsonObject.getString("userId"));
+            info.setProjectId(jsonObject.getLong("projectId"));
+            info.setWatermarkCode(jsonObject.getString("watermarkCode"));
+            info.setStatus(0);
+            info.setMaterialName(jsonObject.getString("materialName"));
+            info.setWatermarkMaterialName(jsonObject.getString("watermarkMaterialName"));
+            info.setMaterialDescribe(jsonObject.getString("describe"));
+            info.setCreateTime(new Date());
+            info.setUpdateTime(new Date());
+            if (isVideo) {
+                info.setType("VIDEO");
+            } else {
+                info.setType("IMAGE");
+            }
+            this.save(info);
+            Map<String, Object> deleteMap = new HashMap<>();
+            deleteMap.put("material_id", info.getId());
+
+            JSONObject ascription = jsonObject.getJSONObject("ascription");
+            if (!Check.isNull(ascription)) {
+                MaterialAscription materialAscription = new MaterialAscription();
+                materialAscription.setMaterialId(info.getId());
+                materialAscription.setClipId(ascription.getString("clipId")); // 剪辑人
+                materialAscription.setShotId(ascription.getString("shotId")); // 拍摄人id
+                materialAscription.setPlaneId(ascription.getString("planId")); // 策划id
+                materialAscription.setPlaneId(ascription.getString("planeId")); //平面id
+                materialAscriptionMapper.deleteByMap(deleteMap);
+                int i = materialAscriptionMapper.insert(materialAscription);
+                if (i > 0) {
+                    log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
+
+                }
+            }
+            JSONArray tag = jsonObject.getJSONArray("tag");
+            if (!Check.isNull(tag)) {
+                materialTagMapper.deleteByMap(deleteMap);
+                for (int i = 0; i < tag.size(); i++) {
+                    String tagStr = tag.getString(i);
+                    if (!Check.isNull(tagStr)) {
+                        MaterialTag materialTag = new MaterialTag();
+                        materialTag.setMaterialId(info.getId());
+                        materialTag.setTag(tagStr);
+                        materialTagMapper.insert(materialTag);
+
+                    }
+
+                }
+
+            }
+            getFile(info);
+            ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
+        } catch (Exception e) {
+            ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
+            e.printStackTrace();
+
         }
-        this.save(info);
-        ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
+
+
         return resultMap;
     }
+
+
+    @Autowired
+    private MaterialParameterMapper materialParameterMapper;
+
+    public void getFile(MaterialInfo materialInfo) {
+        executorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    this.loadFile(materialInfo);
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+
+            private void loadFile(MaterialInfo materialInfo) throws IOException {
+                if (!Check.isNull(materialInfo)) {
+                    String url = materialInfo.getUrl();
+                    long l = System.currentTimeMillis();
+                    String localUrl = LoadFileUtil.downLoadFromUrl(url, "D:\\tets1\\video");
+                    File file = new File(localUrl);
+
+                    it.sauronsoftware.jave.Encoder encoder = new Encoder();
+                    try {
+                        it.sauronsoftware.jave.MultimediaInfo m = encoder.getInfo(file);
+                        long duration = m.getDuration();
+                        long secondDuration = duration / 1000;
+                        MaterialParameter materialParameter = new MaterialParameter();
+                        materialParameter.setMaterialId(materialInfo.getId());
+                        materialParameter.setSecond(secondDuration); // 视频秒数
+                        materialParameter.setFormat(m.getFormat()); // 视频格式
+                        materialParameter.setWidth(String.valueOf(m.getVideo().getSize().getWidth()));// 视频宽
+                        materialParameter.setHeight(String.valueOf(m.getVideo().getSize().getHeight()));// 视频高
+
+                        FileInputStream 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);
+
+                        Map<String, Object> deleteMap = new HashMap<>();
+                        deleteMap.put("material_id", materialInfo.getId());
+                        materialParameterMapper.deleteByMap(deleteMap);
+
+                        int insert = materialParameterMapper.insert(materialParameter);
+                        if (insert > 0) {
+                            log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
+
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    } finally {
+                        file.delete();
+                    }
+                }
+
+
+            }
+        });
+        executorService.shutdown();
+
+    }
+
+
 }

+ 19 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialParameterServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialParameter;
+import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
+import cn.com.ctop.common.module.service.IMaterialParameterService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 素材归属标
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-23
+ */
+@Service
+public class MaterialParameterServiceImpl extends ServiceImpl<MaterialParameterMapper, MaterialParameter> implements IMaterialParameterService {
+
+}

+ 19 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialTag;
+import cn.com.ctop.common.module.mapper.MaterialTagMapper;
+import cn.com.ctop.common.module.service.IMaterialTagService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 素材归属标
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-23
+ */
+@Service
+public class MaterialTagServiceImpl extends ServiceImpl<MaterialTagMapper, MaterialTag> implements IMaterialTagService {
+
+}

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java

@@ -17,6 +17,7 @@ public enum StatusCode {
     COMMON_SUCCESS("success", 0, true),
     COMMON_PARAM_ERROR("参数异常", -1, false),
     BYTEDANCE_VIDEO_UPLOAD_FAIL("今日头条视频文件上传失败", -201, false),
+    MATERIAL_UPLOAD_FAIL("素材文件上传失败", -201, false),
     IMAGE_NUMBER_SHORTAGE("今日头条图片文件上传失败", -202, false),
     BYTEDANCE_IMAGE_UPLOAD_FAIL("今日头条图片文件上传失败", -203, false),
     TEMPLATE_NAME_HAS_EXIST("模板名称已存在", -204, false),