فهرست منبع

Merge branch 'import_250116' into test

刘俊驰 2 ماه پیش
والد
کامیت
4bb5315291

+ 20 - 14
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/execl/analysis/EntitlementsImportAnalysis.java

@@ -130,7 +130,9 @@ public class EntitlementsImportAnalysis extends DataAnalysis<EntitlementsImportA
                 if (StringUtils.isBlank(item.getTenantAlbumName())) {
                     ret += "机构专辑名称不能为空;";
                 } else if (smallStudent != null) {
-                    if (MapUtils.isNotEmpty(tenantAlbumMap)) {
+                    if (smallStudent.getTenantId() == null || smallStudent.getTenantId() ==-1) {
+                        ret += "学生未绑定机构,不能添加"+item.getEntitlementName()+";";
+                    } else if (MapUtils.isNotEmpty(tenantAlbumMap)) {
                         List<TenantAlbumWrapper.SmallTenantAlbum> tenantAlbums = tenantAlbumMap.get(smallStudent.getTenantId());
                         if (CollectionUtils.isEmpty(tenantAlbums)) {
                             ret += "机构专辑不存在;";
@@ -149,19 +151,23 @@ public class EntitlementsImportAnalysis extends DataAnalysis<EntitlementsImportA
                 }
                 item.setEntitlementType("TENANT_ALBUM");
             }else {
-                // VIP/SVIP/畅学卡/机构专辑
-                switch (item.getEntitlementName()) {
-                    case "VIP":
-                        item.setEntitlementType("VIP");
-                        break;
-                    case "SVIP":
-                        item.setEntitlementType("SVIP");
-                        break;
-                    case "畅学卡":
-                        item.setEntitlementType("DISCOUNT");
-                        break;
-                    default:
-                        ret += "权益类型错误;";
+                if (smallStudent!=null && smallStudent.getTenantId() != null && smallStudent.getTenantId() >0) {
+                    ret += "机构学生只能添加机构专辑;";
+                } else {
+                    // VIP/SVIP/畅学卡/机构专辑
+                    switch (item.getEntitlementName()) {
+                        case "VIP":
+                            item.setEntitlementType("VIP");
+                            break;
+                        case "SVIP":
+                            item.setEntitlementType("SVIP");
+                            break;
+                        case "畅学卡":
+                            item.setEntitlementType("DISCOUNT");
+                            break;
+                        default:
+                            ret += "权益类型错误;";
+                    }
                 }
             }
             if (item.getPeriod() == null) {

+ 5 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ExcelAnalyseCoreServiceImpl.java

@@ -119,6 +119,8 @@ public class ExcelAnalyseCoreServiceImpl implements ExcelAnalyseCoreService {
 
         }catch (NotOfficeXmlFileException e) {
             throw new BizException("文件名格式错误");
+        }catch (BizException e){
+            throw e;
         } catch (Exception e) {
             log.error("asyncAnalyseReadExcelData wrapper={}", wrapper.jsonString(), e);
         }
@@ -159,7 +161,9 @@ public class ExcelAnalyseCoreServiceImpl implements ExcelAnalyseCoreService {
         AnalysisContext context = analysis.getContext();
         // 生成导入数据记录
         createFileImportRecord(wrapper, context);
-
+        if(context.getTotal() == 0){
+            throw new BizException("导入数据为空");
+        }
         // 入库业务数据
         List<EntitlementsImport> collect = analysis.getEntitlementsImports().stream()
                 .collect(Collectors.toList());