|
|
@@ -24,6 +24,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.system.entity.SysUser;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.common.util.MD5Util;
|
|
|
import org.jeecg.common.util.encryption.AesEncryptUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
@@ -501,6 +502,126 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
+ public void correlationUploadV2(JSONObject json) {
|
|
|
+ String userId = json.getString("userId");
|
|
|
+ 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");
|
|
|
+ }
|
|
|
+ MaterialInfo info = new MaterialInfo();
|
|
|
+ Long projectId = json.getLong("projectId");
|
|
|
+ Project project = projectService.getById(projectId);
|
|
|
+ Long productId = project.getProductId();
|
|
|
+ String code = MD5Util.md5ByUrl(url);
|
|
|
+ info.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ info.setCode(code);
|
|
|
+ if (!Check.isNull(json.getString("watermarkUrl"))) {
|
|
|
+ info.setWatermarkUrl(json.getString("watermarkUrl"));
|
|
|
+ }
|
|
|
+ info.setUrl(url);
|
|
|
+ info.setUserId(userId);
|
|
|
+ info.setProjectId(projectId);
|
|
|
+ info.setProductId(productId);
|
|
|
+ info.setWatermarkCode(json.getString("watermarkCode"));
|
|
|
+ info.setStatus(0);
|
|
|
+ info.setMaterialName(StringUtils.getFileNameNoEx(json.getString("materialName")));
|
|
|
+ info.setWatermarkMaterialName(json.getString("watermarkMaterialName"));
|
|
|
+ info.setMaterialDescribe(json.getString("materialDescribe"));
|
|
|
+ info.setCreateTime(new Date());
|
|
|
+ info.setUpdateTime(new Date());
|
|
|
+ info.setType(type);
|
|
|
+
|
|
|
+ if (!Check.isNull(project.getSupplierCode())) {
|
|
|
+ info.setSupplierCode(project.getSupplierCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ MaterialCutFrame cutFrame = materialCutFrameService.getCutFrameByCode(code);
|
|
|
+ if (Check.isNull(cutFrame)) {
|
|
|
+ String videoUrl = URLDecoder.decode(info.getUrl()).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
|
|
|
+ String loadImage = "cutFrame/" + code + "/zero.jpg";
|
|
|
+ String coverUrl = CloudVideoProcessUtil.videoCutPictureHandle(videoUrl, loadImage);
|
|
|
+ info.setCoverUrl(coverUrl);
|
|
|
+ Thread thread = new Thread() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ log.info("开始抽帧,code:{}", code);
|
|
|
+ materialCutFrameService.getTencentCutFrame(videoUrl, code, coverUrl);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ thread.start();
|
|
|
+ } else {
|
|
|
+ info.setCoverUrl(cutFrame.getUrl());
|
|
|
+ }
|
|
|
+ this.save(info);
|
|
|
+ JSONArray imageArr = json.getJSONArray("imageArr");
|
|
|
+ if (!Check.isNull(imageArr)) {
|
|
|
+ JSONObject imageJson = new JSONObject();
|
|
|
+ imageJson.put("videoId", info.getCode());
|
|
|
+ imageJson.put("userId", userId);
|
|
|
+ imageJson.put("imageArr", imageArr);
|
|
|
+ materialImageInfoService.insertImage(imageJson);
|
|
|
+ }
|
|
|
+ Map<String, Object> deleteMap = new HashMap<>();
|
|
|
+ deleteMap.put("material_id", info.getCode());
|
|
|
+ JSONObject ascription = json.getJSONObject("ascription");
|
|
|
+ if (!Check.isNull(ascription)) {
|
|
|
+ MaterialAscription materialAscription = new MaterialAscription();
|
|
|
+ materialAscription.setMaterialId(info.getCode());
|
|
|
+ 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.getCode());
|
|
|
+ materialAscriptionMapper.deleteByMap(deleteMap);
|
|
|
+ //TODO 需要添加获取设计负责人代码
|
|
|
+ SysUser clip = userService.getById(clipId);
|
|
|
+ String roleCode = userService.getRoleCodeByUserId(clipId);
|
|
|
+ if("designTeamLeader".equals(roleCode)){
|
|
|
+ materialAscription.setLeaderId(clipId);
|
|
|
+ materialAscription.setLeaderName(clip.getRealname());
|
|
|
+ }else{
|
|
|
+ materialAscription.setLeaderId(clip.getLeaderId());
|
|
|
+ materialAscription.setLeaderName(clip.getLeaderName());
|
|
|
+ }
|
|
|
+ int result = materialAscriptionMapper.insert(materialAscription);
|
|
|
+ if (result > 0) {
|
|
|
+ log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ materialTagInfoService.deleteByCode(code);
|
|
|
+ JSONArray modalityTagList = json.getJSONArray("modalityTagList");
|
|
|
+ insertTagList(code, userId, modalityTagList);
|
|
|
+ JSONArray contentTagList = json.getJSONArray("contentTagList");
|
|
|
+ insertTagList(code, userId, contentTagList);
|
|
|
+ JSONArray senceTagList = json.getJSONArray("senceTagList");
|
|
|
+ insertTagList(code, userId, senceTagList);
|
|
|
+ JSONArray modTagList = json.getJSONArray("modTagList");
|
|
|
+ insertTagList(code, userId, modTagList);
|
|
|
+ getFile(info);
|
|
|
+ ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
|
|
|
+ } catch (Exception e) {
|
|
|
+ ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 素材库关联上传素材 1
|
|
|
+ *
|
|
|
+ * @param json
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
public Map<String, Object> correlationUpload(JSONObject json) {
|
|
|
String userId = json.getString("userId");
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|