Kaynağa Gözat

外部爆量素材库——excel导入

zhaoxian 3 yıl önce
ebeveyn
işleme
87ff7117dc

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/controller/ExternalMaterialCollectionController.java

@@ -390,7 +390,7 @@ public class ExternalMaterialCollectionController {
                     "行业(如:综合游戏、休闲益智、动作射击、棋牌桌游、综合服务、小额贷款、第三方支付、金融综合线上平台、综合电商、电商商家、跨境、其他电商零售类、服饰、美妆日化、快消、工具、影音娱乐、婚恋/交友、生活/健康)请严格按照以上的行业填写,否则无法识别",
                     "产品",
                     "素材链接",
-                    "位",
+                    "位",
                     "素材描述"
             };
             eeu.putHeaders(workbook, 0, "Sheet1", titles);

+ 8 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/service/impl/ExternalMaterialCollectionServiceImpl.java

@@ -106,7 +106,7 @@ public class ExternalMaterialCollectionServiceImpl extends ServiceImpl<ExternalM
                     String videoName = null;
                     String industryName = materialCollection.getIndustry();
                     SysCategory category = sysCategoryService.getById(materialCollection.getIndustry());
-                    if(!Check.isNull(category)){
+                    if (!Check.isNull(category)) {
                         industryName = category.getName();
                     }
                     if (Check.isNull(materialCollection.getProduct())) {
@@ -180,7 +180,7 @@ public class ExternalMaterialCollectionServiceImpl extends ServiceImpl<ExternalM
                     String videoName = null;
                     String industryName = materialCollection.getIndustry();
                     SysCategory category = sysCategoryService.getById(materialCollection.getIndustry());
-                    if(!Check.isNull(category)){
+                    if (!Check.isNull(category)) {
                         industryName = category.getName();
                     }
                     if (Check.isNull(materialCollection.getProduct())) {
@@ -320,7 +320,12 @@ public class ExternalMaterialCollectionServiceImpl extends ServiceImpl<ExternalM
                 //描述
                 String materialDescribe = eeu.getCellValue(row.getCell(4));
                 ExternalMaterialCollection materialCollection = new ExternalMaterialCollection();
-                materialCollection.setIndustry(industryLabel);
+                QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("name", industryLabel);
+                SysCategory one = sysCategoryService.getOne(queryWrapper);
+                if (!Check.isNull(one)) {
+                    materialCollection.setIndustry(one.getId());
+                }
                 materialCollection.setProduct(product);
                 materialCollection.setExternalUrl(externalUrl);
                 materialCollection.setPlatePosition(platePosition);