yumeng 5 lat temu
rodzic
commit
4829e52bc3

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

@@ -77,6 +77,22 @@ public class MaterialInfoController {
     @Autowired
     private IKuaiShouCleanMaterialReportService kuaiShouCleanMaterialReportService;
 
+
+
+    @PostMapping("/correlationUpload")
+    public Map<String, Object> insertFile(@RequestBody JSONObject json) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject()
+                .getPrincipal();
+
+        json.put("userId", user.getId());
+        return materialInfoService.correlationUpload(json);
+    }
+
+
+
+
+
+
     @GetMapping(value = "/report")
     public JSONObject report(String userId) {
         return materialInfoService.report(userId);

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

@@ -35,9 +35,17 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
     void setExcellent(String id, Integer excellent);
 
-    Integer getKuaishouUpVideoCount(@Param("code")String code);
+    Integer getKuaishouUpVideoCount(@Param("code") String code);
 
-    Integer getToutiaoUpVideoCount(@Param("code")String code);
+    Integer getToutiaoUpVideoCount(@Param("code") String code);
 
     JSONObject getGeneralizationInfo(String code);
+
+    /**
+     * 素材库 关联上传素材
+     *
+     * @param json
+     * @return
+     */
+    Map<String, Object> correlationUpload(JSONObject json);
 }

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

@@ -426,6 +426,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
     /**
      * 获取素材概括信息
+     *
      * @param code
      * @return
      */
@@ -433,4 +434,109 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     public JSONObject getGeneralizationInfo(String code) {
         return materialInfoMapper.getGeneralizationInfo(code);
     }
+
+
+    /**
+     * 素材库关联上传素材
+     *
+     * @param json
+     * @return
+     */
+    @Override
+    public Map<String, Object> correlationUpload(JSONObject json) {
+
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            String type = json.getString("type");
+
+                String url = "";
+                if (!Check.isNull(json.getString("url"))) {
+                    url = "https:" + json.getString("url");
+                }
+                insertMaterialInfo(url, type, json);
+
+
+
+
+
+            MaterialInfo info = new MaterialInfo();
+            Long projectId = json.getLong("projectId");
+            String code = json.getString("code");
+            info.setId(code + projectId);
+            info.setCode(code);
+            if (!Check.isNull(json.getString("watermarkUrl"))) {
+                info.setWatermarkUrl(json.getString("watermarkUrl"));
+            }
+            info.setUrl(url);
+            info.setUserId(json.getString("userId"));
+            info.setProjectId(projectId);
+            info.setWatermarkCode(json.getString("watermarkCode"));
+            info.setStatus(0);
+            info.setMaterialName(json.getString("materialName"));
+            info.setWatermarkMaterialName(json.getString("watermarkMaterialName"));
+            info.setMaterialDescribe(json.getString("materialDescribe"));
+            info.setCreateTime(new Date());
+            info.setUpdateTime(new Date());
+            info.setType(type);
+            this.save(info);
+            Map<String, Object> deleteMap = new HashMap<>();
+            deleteMap.put("material_id", info.getId());
+            JSONObject ascription = json.getJSONObject("ascription");
+            if (!Check.isNull(ascription)) {
+                MaterialAscription materialAscription = new MaterialAscription();
+                materialAscription.setMaterialId(info.getId());
+                // 剪辑人
+                materialAscription.setClipId(ascription.getString("clipId"));
+                // 拍摄人id
+                materialAscription.setShotId(ascription.getString("shotId"));
+                // 策划id
+                materialAscription.setPlanId(ascription.getString("planId"));
+                //平面id
+                materialAscription.setPlaneId(ascription.getString("planeId"));
+                materialAscriptionMapper.deleteByMap(deleteMap);
+                int i = materialAscriptionMapper.insert(materialAscription);
+                if (i > 0) {
+                    log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
+                }
+
+            }
+
+            JSONArray tag = json.getJSONArray("tag");
+            if (!Check.isNull(tag)) {
+                materialTagMapper.deleteByMap(deleteMap);
+                for (int i = 0; i < tag.size(); i++) {
+                    String tagStr = tag.getString(i);
+                    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();
+
+        }
+
+
+        return resultMap;
+
+
+
+
+
+
+    }
 }

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

@@ -22,7 +22,7 @@ public class ExportExcelUtils {
      * @throws Exception
      * @Title: exportExcel
      * @Description: 导出Excel的方法
-     * @author: evan @ 2014-01-09
+     *
      */
     public void exportExcel(XSSFWorkbook workbook, int sheetNum,
                             String sheetTitle, String[] headers, List<List<Object>> result) throws Exception {