lyhzzz 1 year ago
parent
commit
0730b93cab
1 changed files with 14 additions and 6 deletions
  1. 14 6
      src/main/java/com/cdf/service/impl/ExcelService.java

+ 14 - 6
src/main/java/com/cdf/service/impl/ExcelService.java

@@ -71,7 +71,7 @@ public class ExcelService {
     INumRegionService numRegionService;
 
 
-    // 0 外框设置 ,1 瀑布流, 2,精选推荐设置 ,3 品牌推荐设置
+    // 0 外框设置 ,1 瀑布流, 2,精选推荐设置 ,3 品牌推荐设置,4陈列品
     public void  downTemplate(Integer type,String sceneNum,HttpServletRequest req,HttpServletResponse response)  {
         if(type == null ){
             throw new BusinessException(ResultCode.PARAM_MISS);
@@ -95,13 +95,21 @@ public class ExcelService {
 
                     this.commonExport(req,response,fileName,OutlineUploadTemplateList, OutlineUploadTemplate.class);
                     break;
-                case 1 :
+                case 1 : case 4:
                     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<String> sids = new ArrayList<>();
+                    if(type == 1){
+                        fileName ="导入商品瀑布流模版";
+                        sids = hotRelations.stream().filter(e -> e.getHotType() == 3).map(HotRelation::getHotId).collect(Collectors.toList());
+                    }
+                    if(type == 4){
+                        fileName ="导入商品陈列品模版";
+                        sids = hotRelations.stream().filter(e -> e.getHotType() == 5).map(HotRelation::getHotId).collect(Collectors.toList());
+                    }
                     List<ProductUploadTemplate> resultList = new ArrayList<>();
                     for (String sid : sids) {
                         HotUploadTemplate hotUploadTemplate = sidMap.get(sid);
@@ -114,7 +122,6 @@ public class ExcelService {
                         template.setHotTitle(hotUploadTemplate.getHotTitle());
                         resultList.add(template);
                     }
-                    fileName ="导入商品瀑布流模版";
                     this.commonExport(req,response,fileName,resultList, ProductUploadTemplate.class);
                     break;
                 case 2 :
@@ -125,6 +132,7 @@ public class ExcelService {
                     fileName ="导入品牌推荐模版";
                     this.commonExport(req,response,fileName,list, HotUploadTemplate.class);
                     break;
+
                 default: throw new BusinessException(ResultCode.PARAM_MISS);
             }
 
@@ -172,7 +180,7 @@ public class ExcelService {
             case 0:
                 checkUploadOutline(file,errorList);
                 break;
-            case 1:
+            case 1: case 4:
                 checkUploadProduct(file,errorList);
                 break;
             case 2 :case 3 :
@@ -342,7 +350,7 @@ public class ExcelService {
             case 0:
                 uploadOutline(file);
                 break;
-            case 1:
+            case 1: case 4:
                 uploadProduct(file);
                 break;
             case 2 :case 3 :