lyhzzz 1 år sedan
förälder
incheckning
78c1876995
1 ändrade filer med 20 tillägg och 2 borttagningar
  1. 20 2
      src/main/java/com/cdf/service/impl/ExcelService.java

+ 20 - 2
src/main/java/com/cdf/service/impl/ExcelService.java

@@ -77,7 +77,7 @@ public class ExcelService {
         }
         try {
             List<HotUploadTemplate> list = new ArrayList<>();
-            if(type != 0 && StringUtils.isNotBlank(sceneNum)){
+            if(type !=0 && StringUtils.isNotBlank(sceneNum)){
                 list = getHotsList(sceneNum);
             }
 
@@ -95,8 +95,26 @@ public class ExcelService {
                     this.commonExport(req,response,fileName,OutlineUploadTemplateList, OutlineUploadTemplate.class);
                     break;
                 case 1 :
+                    HashMap<String,HotUploadTemplate> sidMap = new HashMap<>();
+                    for (HotUploadTemplate hotUploadTemplate : list) {
+                        sidMap.put(hotUploadTemplate.getSid(),hotUploadTemplate);
+                    }
+                    List<HotRelation> hotRelations = hotRelationService.getByNum(sceneNum);
+                    List<String> sids = hotRelations.stream().filter(e -> e.getHotType() == 3).map(HotRelation::getHotId).collect(Collectors.toList());
+                    List<ProductUploadTemplate> resultList = new ArrayList<>();
+                    for (String sid : sids) {
+                        HotUploadTemplate hotUploadTemplate = sidMap.get(sid);
+                        if(hotUploadTemplate == null){
+                            continue;
+                        }
+                        ProductUploadTemplate template = new ProductUploadTemplate();
+                        template.setSceneNum(sceneNum);
+                        template.setSid(sid);
+                        template.setHotTitle(hotUploadTemplate.getHotTitle());
+                        resultList.add(template);
+                    }
                     fileName ="导入商品瀑布流模版";
-                    this.commonExport(req,response,fileName,list, ProductUploadTemplate.class);
+                    this.commonExport(req,response,fileName,resultList, ProductUploadTemplate.class);
                     break;
                 case 2 :
                     fileName ="导入精选推荐模版";