|
@@ -426,6 +426,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取素材概括信息
|
|
* 获取素材概括信息
|
|
|
|
+ *
|
|
* @param code
|
|
* @param code
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@@ -433,4 +434,109 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
public JSONObject getGeneralizationInfo(String code) {
|
|
public JSONObject getGeneralizationInfo(String code) {
|
|
return materialInfoMapper.getGeneralizationInfo(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;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|