瀏覽代碼

xuanpin库

zhaoxian 3 年之前
父節點
當前提交
f81d79fcbf

+ 3 - 11
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/ProductMaterialServiceImpl.java

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