|
@@ -67,7 +67,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
private IMaterialCutFrameService materialCutFrameService;
|
|
|
@Autowired
|
|
|
private ISupplierWatermarkService supplierWatermarkService;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private IProductService productService;
|
|
|
|
|
|
@Value("${oss.replace.download}")
|
|
|
private String downloadUrl;
|
|
@@ -154,10 +155,10 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public MaterialInfo getMaterialInfoByCodeAndProjectId(String code, Long projectId) {
|
|
|
+ public MaterialInfo getMaterialInfoByCodeAndProductId(String code, Long productId) {
|
|
|
QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("code", code);
|
|
|
- queryWrapper.eq("project_id", projectId);
|
|
|
+ queryWrapper.eq("product_id", productId);
|
|
|
queryWrapper.orderByDesc("id").last("limit 1");
|
|
|
return this.getOne(queryWrapper);
|
|
|
}
|
|
@@ -172,9 +173,9 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> checkMaterialInfo(String code, Long projectId) {
|
|
|
+ public Map<String, Object> checkMaterialInfo(String code, Long productId) {
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
- MaterialInfo info = this.getMaterialInfoByCodeAndProjectId(code, projectId);
|
|
|
+ MaterialInfo info = this.getMaterialInfoByCodeAndProductId(code, productId);
|
|
|
if (null != info) {
|
|
|
//文件已存在
|
|
|
ResultMapUtils.setResultMap(result, StatusCode.FILE_HAS_UPLOAD.getCode());
|
|
@@ -240,16 +241,18 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
|
|
|
private void insertMaterialInfo(String url, String type, JSONObject jsonObject) {
|
|
|
MaterialInfo info = new MaterialInfo();
|
|
|
- Long projectId = jsonObject.getLong("projectId");
|
|
|
+// Long projectId = jsonObject.getLong("projectId");
|
|
|
+ Long productId = jsonObject.getLong("productId");
|
|
|
String code = jsonObject.getString("code");
|
|
|
- info.setId(code + projectId);
|
|
|
+ info.setId(code + productId);
|
|
|
info.setCode(code);
|
|
|
if (!Check.isNull(jsonObject.getString("watermarkUrl"))) {
|
|
|
info.setWatermarkUrl(jsonObject.getString("watermarkUrl"));
|
|
|
}
|
|
|
info.setUrl(url);
|
|
|
info.setUserId(jsonObject.getString("userId"));
|
|
|
- info.setProjectId(projectId);
|
|
|
+// info.setProjectId(projectId);
|
|
|
+ info.setProductId(productId);
|
|
|
info.setWatermarkCode(jsonObject.getString("watermarkCode"));
|
|
|
info.setStatus(0);
|
|
|
info.setMaterialName(jsonObject.getString("materialName"));
|
|
@@ -295,7 +298,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // getFile(info,);
|
|
|
+ getFile(info);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -369,7 +372,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void getFile(MaterialInfo materialInfo, String mediaId) {
|
|
|
+ public void getFile(MaterialInfo materialInfo) {
|
|
|
uploadExecutorService.submit(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
@@ -415,21 +418,16 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
if (insert > 0) {
|
|
|
log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
|
|
|
}
|
|
|
-
|
|
|
- if ("2".equals(mediaId) || "4".equals(mediaId)) {
|
|
|
- if (!"kuaishou_001".equals(materialInfo.getSupplierCode())) {
|
|
|
- // 默认抽帧 素造供应商
|
|
|
- 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();
|
|
|
+ // 默认抽帧 素造供应商
|
|
|
+ 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 (FileNotFoundException e) {
|
|
|
e.printStackTrace();
|
|
@@ -497,6 +495,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
}
|
|
|
MaterialInfo info = new MaterialInfo();
|
|
|
Long projectId = json.getLong("projectId");
|
|
|
+ Project project = projectService.getById(projectId);
|
|
|
+ Long productId = project.getProductId();
|
|
|
String code = json.getString("code");
|
|
|
info.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
info.setCode(code);
|
|
@@ -506,6 +506,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
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")));
|
|
@@ -514,12 +515,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
info.setCreateTime(new Date());
|
|
|
info.setUpdateTime(new Date());
|
|
|
info.setType(type);
|
|
|
- Project project = projectService.getById(projectId);
|
|
|
- if (!Check.isNull(project)) {
|
|
|
- if (!Check.isNull(project.getSupplierCode())) {
|
|
|
- info.setSupplierCode(project.getSupplierCode());
|
|
|
- }
|
|
|
- }
|
|
|
+ //TODO 此处逻辑待调整
|
|
|
+// Project project = projectService.getById(projectId);
|
|
|
+// if (!Check.isNull(project)) {
|
|
|
+// 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/", "");
|
|
@@ -547,7 +549,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
JSONObject imageJson = new JSONObject();
|
|
|
imageJson.put("videoId", info.getCode());
|
|
|
imageJson.put("userId", userId);
|
|
|
- imageJson.put("projectId", projectId);
|
|
|
imageJson.put("imageArr", imageArr);
|
|
|
materialImageInfoService.insertImage(imageJson);
|
|
|
}
|
|
@@ -580,7 +581,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
insertTagList(code, userId, senceTagList);
|
|
|
JSONArray modTagList = json.getJSONArray("modTagList");
|
|
|
insertTagList(code, userId, modTagList);
|
|
|
- getFile(info, project.getMediaId());
|
|
|
+ getFile(info);
|
|
|
ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
|
|
|
} catch (Exception e) {
|
|
|
ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
|
|
@@ -600,28 +601,30 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
url = "https:" + json.getString("url");
|
|
|
|
|
|
}
|
|
|
- Long projectId = json.getLong("projectId");
|
|
|
+// Long projectId = json.getLong("projectId");
|
|
|
+ Long productId = json.getLong("productId");
|
|
|
String code = json.getString("code");
|
|
|
info.setCode(code);
|
|
|
- String id = code + "_" + projectId;
|
|
|
+ String id = code + "_" + productId;
|
|
|
info.setId(id);
|
|
|
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(json.getString("materialName"));
|
|
|
info.setWatermarkMaterialName(json.getString("watermarkMaterialName"));
|
|
|
info.setMaterialDescribe(json.getString("materialDescribe"));
|
|
|
- Project project = projectService.getById(projectId);
|
|
|
- if (!Check.isNull(project)) {
|
|
|
- if (!Check.isNull(project.getSupplierCode())) {
|
|
|
- info.setSupplierCode(project.getSupplierCode());
|
|
|
- }
|
|
|
- }
|
|
|
+ //TODO 此处逻辑待调整
|
|
|
+// Project project = projectService.getById(projectId);
|
|
|
+// if (!Check.isNull(project)) {
|
|
|
+// 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/", "");
|
|
@@ -649,7 +652,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
JSONObject imageJson = new JSONObject();
|
|
|
imageJson.put("videoId", info.getCode());
|
|
|
imageJson.put("userId", userId);
|
|
|
- imageJson.put("projectId", projectId);
|
|
|
imageJson.put("imageArr", imageArr);
|
|
|
materialImageInfoService.insertImage(imageJson);
|
|
|
}
|
|
@@ -678,7 +680,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
insertTagList(code, userId, senceTagList);
|
|
|
JSONArray modTagList = json.getJSONArray("modTagList");
|
|
|
insertTagList(code, userId, modTagList);
|
|
|
- getFile(info, project.getMediaId());
|
|
|
+ getFile(info);
|
|
|
|
|
|
return id;
|
|
|
}
|
|
@@ -756,10 +758,10 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
|
|
|
+ public Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> productId, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
PageHelper.startPage(pageNo, pageSize);
|
|
|
- List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, userId);
|
|
|
+ List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, productId, materialName, code, startDate, endDate, userId);
|
|
|
List<MaterialInfo> setList = new ArrayList<>();
|
|
|
PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
|
|
|
if (null != dailyList && !dailyList.isEmpty()) {
|
|
@@ -794,11 +796,12 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
materialInfo.setBytedanceCost(new BigDecimal(0));
|
|
|
}
|
|
|
|
|
|
- Project project = projectService.getById(info.getProjectId());
|
|
|
- if (!Check.isNull(project)) {
|
|
|
- materialInfo.setMediaId(project.getMediaId());
|
|
|
- materialInfo.setProjectName(project.getProjectName());
|
|
|
- }
|
|
|
+ //TODO 待删除
|
|
|
+// Project project = projectService.getById(info.getProjectId());
|
|
|
+// if (!Check.isNull(project)) {
|
|
|
+// materialInfo.setMediaId(project.getMediaId());
|
|
|
+// materialInfo.setProjectName(project.getProjectName());
|
|
|
+// }
|
|
|
|
|
|
QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
|
|
|
imageInfoQueryWrapper.eq("video_id", info.getCode());
|