|
@@ -92,7 +92,6 @@ public class ProductMaterialServiceImpl extends ServiceImpl<ProductMaterialMappe
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Result<Object> add(JSONObject data) throws IOException {
|
|
public Result<Object> add(JSONObject data) throws IOException {
|
|
- String result = "添加完成";
|
|
|
|
JSONArray list = data.getJSONArray("list");
|
|
JSONArray list = data.getJSONArray("list");
|
|
if (Check.isNull(list) || list.size() == 0) {
|
|
if (Check.isNull(list) || list.size() == 0) {
|
|
return Result.error("缺少参数");
|
|
return Result.error("缺少参数");
|
|
@@ -107,7 +106,6 @@ public class ProductMaterialServiceImpl extends ServiceImpl<ProductMaterialMappe
|
|
String tradeName = trade.getString("tradeName");
|
|
String tradeName = trade.getString("tradeName");
|
|
String videoUrl = trade.getString("videoUrl");
|
|
String videoUrl = trade.getString("videoUrl");
|
|
String signature = trade.getString("signature");
|
|
String signature = trade.getString("signature");
|
|
- String uploaderId = trade.getString("uploaderId");
|
|
|
|
QueryWrapper<ProductMaterial> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<ProductMaterial> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.eq("product_id", entity.getProductId());
|
|
queryWrapper.eq("product_id", entity.getProductId());
|
|
queryWrapper.eq("trade_name", tradeName).last("limit 1");
|
|
queryWrapper.eq("trade_name", tradeName).last("limit 1");
|
|
@@ -115,7 +113,6 @@ public class ProductMaterialServiceImpl extends ServiceImpl<ProductMaterialMappe
|
|
if (!Check.isNull(one1)) {
|
|
if (!Check.isNull(one1)) {
|
|
entity.setStartMonth(one1.getStartMonth());
|
|
entity.setStartMonth(one1.getStartMonth());
|
|
entity.setEndMonth(one1.getEndMonth());
|
|
entity.setEndMonth(one1.getEndMonth());
|
|
- result = "";
|
|
|
|
}
|
|
}
|
|
int count = 0;
|
|
int count = 0;
|
|
if (Check.isNull(videoUrl)) {
|
|
if (Check.isNull(videoUrl)) {
|
|
@@ -126,7 +123,7 @@ public class ProductMaterialServiceImpl extends ServiceImpl<ProductMaterialMappe
|
|
lists.add(entity);
|
|
lists.add(entity);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if (Check.isNull(signature) && Check.isNull(uploaderId)) {
|
|
|
|
|
|
+ if (Check.isNull(signature)) {
|
|
List<String> urls = Arrays.asList(videoUrl.split(","));
|
|
List<String> urls = Arrays.asList(videoUrl.split(","));
|
|
for (String url : urls) {
|
|
for (String url : urls) {
|
|
ProductMaterial material = new ProductMaterial();
|
|
ProductMaterial material = new ProductMaterial();
|
|
@@ -136,13 +133,8 @@ public class ProductMaterialServiceImpl extends ServiceImpl<ProductMaterialMappe
|
|
String md5 = MD5Util.getMd5(localPath);
|
|
String md5 = MD5Util.getMd5(localPath);
|
|
if (checkVideo(entity.getProductId(), tradeName, md5)) {
|
|
if (checkVideo(entity.getProductId(), tradeName, md5)) {
|
|
BeanUtils.copyProperties(entity, material);
|
|
BeanUtils.copyProperties(entity, material);
|
|
|
|
+ material.setUploaderId(entity.getUserId());
|
|
material.setTradeName(tradeName);
|
|
material.setTradeName(tradeName);
|
|
- MaterialInfo info = materialInfoService.getMaterialInfoByCode(md5);
|
|
|
|
- if (!Check.isNull(info)) {
|
|
|
|
- material.setUploaderId(uploaderId);
|
|
|
|
- } else {
|
|
|
|
- material.setUploaderId(material.getUserId());
|
|
|
|
- }
|
|
|
|
material.setSignature(md5);
|
|
material.setSignature(md5);
|
|
String cosUrl = getCosUrl(url);
|
|
String cosUrl = getCosUrl(url);
|
|
material.setVideoUrl(cosUrl);
|
|
material.setVideoUrl(cosUrl);
|
|
@@ -163,7 +155,7 @@ public class ProductMaterialServiceImpl extends ServiceImpl<ProductMaterialMappe
|
|
material.setTradeName(tradeName);
|
|
material.setTradeName(tradeName);
|
|
material.setVideoUrl(videoUrl);
|
|
material.setVideoUrl(videoUrl);
|
|
material.setSignature(signature);
|
|
material.setSignature(signature);
|
|
- material.setUploaderId(uploaderId);
|
|
|
|
|
|
+ material.setUploaderId(entity.getUserId());
|
|
if (checkVideo(entity.getProductId(), tradeName, signature)) {
|
|
if (checkVideo(entity.getProductId(), tradeName, signature)) {
|
|
lists.add(material);
|
|
lists.add(material);
|
|
}
|
|
}
|