|
@@ -5,9 +5,11 @@ import com.alibaba.excel.enums.CellExtraTypeEnum;
|
|
|
import com.alibaba.excel.metadata.Sheet;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
+import com.microsvc.toolkit.common.webportal.exception.BizException;
|
|
|
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.execl.entity.StudentImportWrapper;
|
|
|
import com.yonge.cooleshow.biz.dal.execl.entity.TeacherImportWrapper;
|
|
|
import com.yonge.cooleshow.biz.dal.execl.listener.TeacherImportListener;
|
|
|
import com.yonge.cooleshow.biz.dal.service.EasyExcelService;
|
|
@@ -41,7 +43,7 @@ public class TeacherImportAnalysis extends DataAnalysis<TeacherImportAnalysis> {
|
|
|
private final List<String> phones = Lists.newArrayList();
|
|
|
private final List<String> idCardNos = Lists.newArrayList();
|
|
|
private final List<String> existPhones = Lists.newArrayList();
|
|
|
- private final List<String> existIdCardNos = Lists.newArrayList();
|
|
|
+// private final List<String> existIdCardNos = Lists.newArrayList();
|
|
|
public TeacherImportAnalysis(AnalysisContext context) {
|
|
|
super(context);
|
|
|
}
|
|
@@ -133,14 +135,14 @@ public class TeacherImportAnalysis extends DataAnalysis<TeacherImportAnalysis> {
|
|
|
ret.append("身份证格式不正确;");
|
|
|
}else {
|
|
|
//校验是否重复
|
|
|
- if(idCardNos.contains(item.getIdCardNo())){
|
|
|
+ /*if(idCardNos.contains(item.getIdCardNo())){
|
|
|
ret.append("身份证号重复;");
|
|
|
}else {
|
|
|
if(existIdCardNos.contains(item.getIdCardNo())){
|
|
|
ret.append("身份证号已存在;");
|
|
|
}
|
|
|
- idCardNos.add(item.getIdCardNo());
|
|
|
- }
|
|
|
+ }*/
|
|
|
+ idCardNos.add(item.getIdCardNo());
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isEmpty(item.getSubjectName())) {
|
|
@@ -162,10 +164,14 @@ public class TeacherImportAnalysis extends DataAnalysis<TeacherImportAnalysis> {
|
|
|
if (StringUtils.isEmpty(item.getTenantName())) {
|
|
|
ret.append("机构名称不能为空;");
|
|
|
}else {
|
|
|
- if (!tenantMap.containsKey(item.getTenantName())) {
|
|
|
- ret.append("机构无效:").append(item.getTenantName());
|
|
|
+ if("平台".equals(item.getTenantName())){
|
|
|
+ item.setTenantId(-1L);
|
|
|
+ }else {
|
|
|
+ if (!tenantMap.containsKey(item.getTenantName())) {
|
|
|
+ ret.append("机构无效:").append(item.getTenantName());
|
|
|
+ }
|
|
|
+ item.setTenantId(tenantMap.get(item.getTenantName()));
|
|
|
}
|
|
|
- item.setTenantId(tenantMap.get(item.getTenantName()));
|
|
|
}
|
|
|
if (item.getIsTestUser() == null) {
|
|
|
ret.append("是否测试用户不能为空;");
|
|
@@ -201,8 +207,12 @@ public class TeacherImportAnalysis extends DataAnalysis<TeacherImportAnalysis> {
|
|
|
* 加载校验数据参数
|
|
|
*/
|
|
|
private void loadVerifyParamData() {
|
|
|
+ List<TeacherImportWrapper.TeacherImport> importWrappers = getTeacherImportWrappers();
|
|
|
+ if (CollectionUtils.isEmpty(importWrappers)) {
|
|
|
+ throw new BizException("导入数据为空");
|
|
|
+ }
|
|
|
//获取所有的手机号和身份证号
|
|
|
- List<String> phones = getTeacherImportWrappers().stream()
|
|
|
+ List<String> phones = importWrappers.stream()
|
|
|
.map(TeacherImportWrapper.TeacherImport::getPhone)
|
|
|
.filter(StringUtils::isNotBlank)
|
|
|
.distinct()
|
|
@@ -210,14 +220,14 @@ public class TeacherImportAnalysis extends DataAnalysis<TeacherImportAnalysis> {
|
|
|
if (CollectionUtils.isNotEmpty(phones)) {
|
|
|
existPhones.addAll(easyExcelService.getPhones(phones, "TEACHER"));
|
|
|
}
|
|
|
- List<String> idCardNos = getTeacherImportWrappers().stream()
|
|
|
- .map(TeacherImportWrapper.TeacherImport::getIdCardNo)
|
|
|
- .filter(StringUtils::isNotBlank)
|
|
|
- .distinct()
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(idCardNos)) {
|
|
|
- existIdCardNos.addAll(easyExcelService.getIdCardNos(idCardNos, "TEACHER"));
|
|
|
- }
|
|
|
+// List<String> idCardNos = getTeacherImportWrappers().stream()
|
|
|
+// .map(TeacherImportWrapper.TeacherImport::getIdCardNo)
|
|
|
+// .filter(StringUtils::isNotBlank)
|
|
|
+// .distinct()
|
|
|
+// .collect(Collectors.toList());
|
|
|
+// if (CollectionUtils.isNotEmpty(idCardNos)) {
|
|
|
+// existIdCardNos.addAll(easyExcelService.getIdCardNos(idCardNos, "TEACHER"));
|
|
|
+// }
|
|
|
subjectMap.putAll(easyExcelService.getSubjectMap());
|
|
|
tenantMap.putAll(easyExcelService.getTenantMap());
|
|
|
}
|