|
|
|
@ -1,6 +1,9 @@
|
|
|
|
|
package com.ibeetl.jlw.service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.ReUtil;
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
@ -12,6 +15,7 @@ import com.ibeetl.admin.core.util.PlatformException;
|
|
|
|
|
import com.ibeetl.admin.core.util.TimeTool;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
|
|
|
|
import com.ibeetl.jlw.dao.SchoolClassDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.StudentDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
|
import com.ibeetl.jlw.job.CacheLogJob;
|
|
|
|
@ -54,6 +58,7 @@ import static com.ibeetl.jlw.web.IpAddressController.ipAddressMap;
|
|
|
|
|
public class StudentService extends CoreBaseService<Student>{
|
|
|
|
|
|
|
|
|
|
@Autowired private StudentDao studentDao;
|
|
|
|
|
@Autowired private SchoolClassDao schoolClassDao;
|
|
|
|
|
@Autowired private StudentQuestionLogService studentQuestionLogService;
|
|
|
|
|
@Autowired private StudentQuestionLogInfoService studentQuestionLogInfoService;
|
|
|
|
|
@Autowired private StudentQuestionLogAnswerService studentQuestionLogAnswerService;
|
|
|
|
@ -510,15 +515,32 @@ public class StudentService extends CoreBaseService<Student>{
|
|
|
|
|
// msg += "第"+ToolUtils.numberToLetter(map.get(columns[3])+1)+"列,第"+(i+1)+"行学号为空<br>";
|
|
|
|
|
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[3])+1)+"列,第"+(i+1)+"行学号为空"});
|
|
|
|
|
continue;
|
|
|
|
|
}else if(className.split("_").length != 2){
|
|
|
|
|
// msg += "第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行班级ID丢失<br>";
|
|
|
|
|
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行班级ID丢失"});
|
|
|
|
|
continue;
|
|
|
|
|
// }else if(className.split("_").length != 2){
|
|
|
|
|
//// msg += "第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行班级ID丢失<br>";
|
|
|
|
|
// errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行班级ID丢失"});
|
|
|
|
|
// continue;
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
|
|
String schoolClassId = "";
|
|
|
|
|
// 通过名字查询院校信息,如果查询不到就告诉前台需要先去添加院校
|
|
|
|
|
SchoolClass schoolClass = schoolClassDao.createLambdaQuery()
|
|
|
|
|
.andEq(SchoolClass::getClassName, className)
|
|
|
|
|
.andEq(SchoolClass::getClassStatus, 1)
|
|
|
|
|
.unique();
|
|
|
|
|
|
|
|
|
|
// 通过名字没查询到院校的时候
|
|
|
|
|
if(ObjectUtil.isEmpty(schoolClass)) {
|
|
|
|
|
// 正则取院校ID
|
|
|
|
|
schoolClassId = ReUtil.get("\\d+", className, 0);
|
|
|
|
|
Assert.notBlank(schoolClassId, "未查询到院校,请先添加院校信息!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 这个时候院校ID一定存在
|
|
|
|
|
schoolClassId = schoolClass.getClassId().toString();
|
|
|
|
|
|
|
|
|
|
Student pojo = new Student();
|
|
|
|
|
|
|
|
|
|
pojo.setClassId(Long.parseLong(className.split("_")[1]));
|
|
|
|
|
pojo.setClassId(Long.parseLong(schoolClassId));
|
|
|
|
|
pojo.setStudentName(studentName);
|
|
|
|
|
pojo.setStudentSn(studentSn);
|
|
|
|
|
pojo.setStudentMobile(studentMobile);
|
|
|
|
@ -539,7 +561,7 @@ public class StudentService extends CoreBaseService<Student>{
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Student s = new Student();
|
|
|
|
|
s.setClassId(Long.parseLong(className.split("_")[1]));
|
|
|
|
|
s.setClassId(Long.parseLong(schoolClassId));
|
|
|
|
|
s.setStudentName(studentName);
|
|
|
|
|
if(studentDao.template(s).size()>1){
|
|
|
|
|
errMsg.add(new String[]{"第"+(i+1)+"行存在同名同姓的学生,姓名 "+studentName+" 是否删除",pojo.getStudentId().toString()});
|
|
|
|
@ -554,7 +576,6 @@ public class StudentService extends CoreBaseService<Student>{
|
|
|
|
|
coreUser.setState("S1");
|
|
|
|
|
coreUser.setDelFlag(0);
|
|
|
|
|
coreUser.setCreateTime(date);
|
|
|
|
|
SchoolClass schoolClass = schoolClassService.queryById(pojo.getClassId());
|
|
|
|
|
coreUser.setOrgId(schoolClass.getOrgId());
|
|
|
|
|
coreUser.setPassword("123qwe");
|
|
|
|
|
userConsoleService.saveUser(coreUser);
|
|
|
|
|