|
@@ -1,9 +1,11 @@
|
|
|
package com.ssj.service.sys.imlibuser.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -110,6 +112,15 @@ public class TbClassStudentTempServiceImpl extends BaseServiceImpl<TbClassStuden
|
|
|
return queryDao.findStudentErrorByPage(searchParam, pageable);
|
|
|
}
|
|
|
|
|
|
+ private boolean checkGrade(String grade){
|
|
|
+ boolean check = true;
|
|
|
+ String[] gradeArr = new String[]{"一年级","二年级","三年级","四年级","五年级","六年级","七年级","八年级","九年级"};
|
|
|
+ List<String> list = Arrays.stream(gradeArr).collect(Collectors.toList());
|
|
|
+ if(!list.contains(grade)){
|
|
|
+ check = false;
|
|
|
+ }
|
|
|
+ return check;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public synchronized int insertTbClassStudent(TbLibJoin libJoin,TbClassStudentTemp tbLibImStudentTemp) {
|
|
@@ -120,22 +131,102 @@ public class TbClassStudentTempServiceImpl extends BaseServiceImpl<TbClassStuden
|
|
|
tbLibImStudentTemp.setCreateTime(new Date());
|
|
|
tbLibImStudentTemp.setStatus(1);
|
|
|
try {
|
|
|
-// if(StringUtils.isNotEmpty(tbLibImStudentTemp.getSchool())) {
|
|
|
-// List<PositionSchoolV1Dto> positionSchoolV1Dtos= merchantAreaService.findSchoolList(libJoin.getId());
|
|
|
-// if(positionSchoolV1Dtos!=null && positionSchoolV1Dtos.size()>0) {
|
|
|
-// List<String> libJoinSchools=new ArrayList<String>();
|
|
|
-// for (PositionSchoolV1Dto positionSchoolV1Dto : positionSchoolV1Dtos) {
|
|
|
-// libJoinSchools.add(positionSchoolV1Dto.getSchoolName());
|
|
|
-// }
|
|
|
-// if(!libJoinSchools.contains(tbLibImStudentTemp.getSchool())){
|
|
|
-// tbLibImStudentTemp.setStatus(0);
|
|
|
-// tbLibImStudentTemp.setErrorReason("导入的学校未绑定机构");
|
|
|
-// this.save(tbLibImStudentTemp);
|
|
|
-// reqNum=0;
|
|
|
-// return reqNum;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(tbLibImStudentTemp.getGrade())){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("年级不能为空");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }else{
|
|
|
+ if(!checkGrade(tbLibImStudentTemp.getGrade())){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("年级输入不正确,请输入类似一年级、二年级等");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(tbLibImStudentTemp.getLeagueName())){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("机构不能为空");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(tbLibImStudentTemp.getStudentName())){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("学生姓名不能为空");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(tbLibImStudentTemp.getParentName())){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("主家长姓名不能为空");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(tbLibImStudentTemp.getParentRole())){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("主家长角色不能为空");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(tbLibImStudentTemp.getParentPhone()) || tbLibImStudentTemp.getParentPhone().length()!=11){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("主家长电话不正确");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(tbLibImStudentTemp.getViceParentName())) {
|
|
|
+ if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentPhone())){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("副家长角色不正确");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }else if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentRole())){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("副家长角色不正确");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(tbLibImStudentTemp.getViceParentPhone())) {
|
|
|
+ if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentName())){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("副家长角色不正确");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }else if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentRole())){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("副家长角色不正确");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(tbLibImStudentTemp.getViceParentRole())) {
|
|
|
+ if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentName())){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("副家长电话不正确");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }else if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentPhone())){
|
|
|
+ tbLibImStudentTemp.setStatus(0);
|
|
|
+ tbLibImStudentTemp.setErrorReason("副家长电话不正确");
|
|
|
+ this.save(tbLibImStudentTemp);
|
|
|
+ reqNum=0;
|
|
|
+ return reqNum;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
int countVip=libVipService.countByLibId(libJoin.getId());
|
|
@@ -201,7 +292,8 @@ public class TbClassStudentTempServiceImpl extends BaseServiceImpl<TbClassStuden
|
|
|
}else if (libVips!=null && libVips.size()==1) {
|
|
|
libVip=libVips.get(0);
|
|
|
}
|
|
|
- if(libVip==null){//无学生,生成学生
|
|
|
+ //无学生,生成学生
|
|
|
+ if(libVip==null){
|
|
|
if(StringUtils.isNotEmpty(tbLibImStudentTemp.getDerver())) {
|
|
|
ConchDerver conchDerver = conchDerverService.findByDerver(tbLibImStudentTemp.getDerver().trim());
|
|
|
if(conchDerver!=null) {
|
|
@@ -360,7 +452,10 @@ public class TbClassStudentTempServiceImpl extends BaseServiceImpl<TbClassStuden
|
|
|
|
|
|
//没有班级信息的,不关联班级信息
|
|
|
if(StringUtils.isNotEmpty(tbLibImStudentTemp.getClassName())) {
|
|
|
- TbClass tbClass=tbClassService.getTbClassGradeByLibId(tbLibImStudentTemp.getLibId(),tbLibImStudentTemp.getGrade(), tbLibImStudentTemp.getClassName());
|
|
|
+ /**
|
|
|
+ * 2021-10 提出导入班级不区分年级,班级名称相同就在同一个班
|
|
|
+ */
|
|
|
+ TbClass tbClass=tbClassService.getTbClassByLibId(tbLibImStudentTemp.getLibId(), tbLibImStudentTemp.getClassName());
|
|
|
if(tbClass==null) {
|
|
|
tbClass=new TbClass();
|
|
|
tbClass.setLibId(tbLibImStudentTemp.getLibId());
|