|
@@ -8,6 +8,7 @@ import com.google.common.collect.Maps;
|
|
|
import com.microsvc.toolkit.middleware.excel.analysis.AnalysisContext;
|
|
|
import com.microsvc.toolkit.middleware.excel.analysis.DataAnalysis;
|
|
|
import com.microsvc.toolkit.middleware.excel.util.DownloadManager;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.TenantGroup;
|
|
|
import com.yonge.cooleshow.biz.dal.execl.entity.StudentImportWrapper;
|
|
|
import com.yonge.cooleshow.biz.dal.execl.listener.StudentImportListener;
|
|
|
import com.yonge.cooleshow.biz.dal.service.EasyExcelService;
|
|
@@ -38,7 +39,7 @@ public class StudentImportAnalysis extends DataAnalysis<StudentImportAnalysis> {
|
|
|
private final Map<String, StudentImportWrapper.StudentImport> recordMap = Maps.newHashMap();
|
|
|
private final Map<String, Long> subjectMap = Maps.newHashMap();
|
|
|
private final Map<String, Long> tenantMap = Maps.newHashMap();
|
|
|
- private final Map<String, Long> tenantGroupMap = Maps.newHashMap();
|
|
|
+ private final Map<String, List<TenantGroup>> tenantGroupMap = Maps.newHashMap();
|
|
|
private final List<String> phones = Lists.newArrayList();
|
|
|
private final List<String> existPhones = Lists.newArrayList();
|
|
|
public StudentImportAnalysis(AnalysisContext context) {
|
|
@@ -154,10 +155,19 @@ public class StudentImportAnalysis extends DataAnalysis<StudentImportAnalysis> {
|
|
|
if (StringUtils.isEmpty(item.getTenantGroupName())) {
|
|
|
ret.append("小组名称不能为空;");
|
|
|
}else {
|
|
|
- if (!tenantGroupMap.containsKey(item.getTenantName())) {
|
|
|
- ret.append("小组名称无效:").append(item.getTenantName());
|
|
|
+ if (!tenantGroupMap.containsKey(item.getTenantGroupName())) {
|
|
|
+ ret.append("小组名称无效:").append(item.getTenantGroupName());
|
|
|
+ }
|
|
|
+ List<TenantGroup> tenantGroups = tenantGroupMap.get(item.getTenantGroupName());
|
|
|
+ //根据机构id和小组名称获取小组id
|
|
|
+ if (CollectionUtils.isNotEmpty(tenantGroups)) {
|
|
|
+ TenantGroup tenantGroup = tenantGroups.stream().filter(t -> t.getTenantId().equals(item.getTenantId())).findFirst().orElse(null);
|
|
|
+ if (Objects.nonNull(tenantGroup)) {
|
|
|
+ item.setTenantGroupId(tenantGroup.getId());
|
|
|
+ } else {
|
|
|
+ ret.append("小组名称无效:").append(item.getTenantGroupName());
|
|
|
+ }
|
|
|
}
|
|
|
- item.setTenantGroupId(tenantGroupMap.get(item.getTenantName()));
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(ret)) {
|
|
|
verifyDataMap.put(item.getRowIndex(), ret.toString());
|