Selaa lähdekoodia

xuanpin库 bug 修改

zhaoxian 3 vuotta sitten
vanhempi
commit
c68a1d1278

+ 2 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/xml/ProductMaterialMapper.xml

@@ -68,7 +68,7 @@
         t1.trade_name as 'tradeName',
         t1.trade_type as 'tradeType',
         t1.item_run as 'itemRun',
-        IFNULL(sum(t2.charge),0.00) as 'charge',
+        IF(t4.videoCount is null ,'-',IFNULL(t2.charge,0.00)) as 'charge',
         CONCAT_WS(' ~ ',t1.start_month,t1.end_month) AS 'time',
         IFNULL(t3.realname,'-') as 'user',
         IFNULL(t4.videoCount ,'-') as 'videoCount'
@@ -104,7 +104,7 @@
             and t1.start_month >= #{startMonth}
         </if>
         <if test="endMonth!=null">
-            and t1.end_month &lt;= #{endMonth}
+            AND (t1.end_month &lt;= #{endMonth} or t1.end_month is null)
         </if>
         <if test="itemRun!=null">
             and t1.item_run = #{itemRun}

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

@@ -29,7 +29,9 @@ import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 import java.util.UUID;
 
 /**
@@ -94,6 +96,7 @@ 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("缺少参数");
@@ -108,6 +111,7 @@ 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,19 +119,20 @@ 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)) {
-                queryWrapper.isNull("video_url");
-                ProductMaterial one = this.getOne(queryWrapper);
-                if (Check.isNull(one)) {
-                    entity.setTradeName(tradeName);
-                    lists.add(entity);
-                }
-            } else {
-                if (Check.isNull(signature)) {
-                    List<String> urls = Arrays.asList(videoUrl.split(","));
-                    for (String url : urls) {
+            queryWrapper.isNull("video_url");
+            ProductMaterial one = this.getOne(queryWrapper);
+            if (Check.isNull(one)) {
+                entity.setTradeName(tradeName);
+                lists.add(entity);
+            }
+            if (!Check.isNull(videoUrl)) {
+                if (Check.isNull(signature) && Check.isNull(uploaderId)) {
+                    List<String >urls = Arrays.asList(videoUrl.split(","));
+                    HashSet<String> set = new HashSet<>(urls);
+                    for (String url : set) {
                         ProductMaterial material = new ProductMaterial();
                         count++;
                         //获取MD5
@@ -135,8 +140,13 @@ 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);
@@ -157,7 +167,7 @@ public class ProductMaterialServiceImpl extends ServiceImpl<ProductMaterialMappe
                     material.setTradeName(tradeName);
                     material.setVideoUrl(videoUrl);
                     material.setSignature(signature);
-                    material.setUploaderId(entity.getUserId());
+                    material.setUploaderId(uploaderId);
                     if (checkVideo(entity.getProductId(), tradeName, signature)) {
                         lists.add(material);
                     }