Commit 505078a0 by xuwenhao

修改测试bug

parent 2197d2cd
......@@ -211,4 +211,11 @@ public interface SysUserMapper {
int updateUserNameByUserId(@Param("userName") String userName,
@Param("userId") Long userId);
/**
* 更新用户表
* @param updateUserList
*/
void updateUserList(@Param("list") List<SysUser> updateUserList);
// 新增用户表
void addUserList(@Param("list") List<SysUser> addUserList);
}
......@@ -342,4 +342,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
<update id="updateUserList" parameterType="com.ruoyi.common.core.domain.entity.SysUser">
<foreach collection="list" item="data" separator=";">
update sys_user
<trim prefix="SET" suffixOverrides=",">
<if test="data.userName != null and data.userName != ''">
user_name = #{data.userName},
</if>
</trim>
where user_id = #{data.userId}
</foreach>
</update>
<insert id="addUserList" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
<foreach collection="list" item="data" separator=";">
insert into sys_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="data.userLoginType != null and data.userLoginType != ''">
user_login_type,
</if>
<if test="data.userName != null and data.userName != ''">
user_name,
</if>
<if test="data.phonenumber != null and data.phonenumber != ''">
phonenumber,
</if>
<if test="data.studentId != null">
student_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="data.userLoginType != null and data.userLoginType != ''">
#{data.userLoginType},
</if>
<if test="data.userName != null and data.userName != ''">
#{data.userName},
</if>
<if test="data.phonenumber != null and data.phonenumber != ''">
#{data.phonenumber},
</if>
<if test="data.studentId != null">
#{data.studentId},
</if>
</trim>
</foreach>
</insert>
</mapper>
......@@ -23,6 +23,7 @@ import yangtz.cs.liu.campus.service.impl.student.SchoolStudentServiceImpl;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Scanner;
......@@ -52,7 +53,8 @@ public class SchoolStudentIntegralController extends BaseController
//获取所在学期
int term = isNewTerm();
schoolStudentIntegral.setStudentId(studentId);
schoolStudentIntegral.setTerm(term);
schoolStudentIntegral.setSchoolYear(null);
// schoolStudentIntegral.setTerm(term);
startPage();
List<SchoolStudentIntegral> list = schoolStudentIntegralService.selectSchoolStudentIntegralList(schoolStudentIntegral);
return getDataTable(list);
......@@ -71,6 +73,20 @@ public class SchoolStudentIntegralController extends BaseController
return term;
}
private Integer isNewTermY(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
//获取当前年月
int month = cal.get(Calendar.MONTH) + 1;
//设置当前学期为上学期
int term = 0;
//2-7为下学期,8-1为上学期
if (month >= 2 && month < 8) {
term = 1;
}
return term;
}
/**
* 查询改名学生总积分????
* @param schoolStudentIntegral
......@@ -98,7 +114,7 @@ public class SchoolStudentIntegralController extends BaseController
public void export(HttpServletResponse response, @PathVariable Long studentId,SchoolStudentIntegral schoolStudentIntegral)
{
schoolStudentIntegral.setStudentId(studentId);
schoolStudentIntegral.setTerm(isNewTerm());
// schoolStudentIntegral.setTerm(isNewTerm());
List<SchoolStudentIntegral> list = schoolStudentIntegralService.selectSchoolStudentIntegralList(schoolStudentIntegral);
ExcelUtil<SchoolStudentIntegral> util = new ExcelUtil<SchoolStudentIntegral>(SchoolStudentIntegral.class);
util.exportExcel(response, list, "学生积分数据");
......@@ -127,7 +143,8 @@ public class SchoolStudentIntegralController extends BaseController
}
//根据日期判断所添加的这个积分应属于哪学年哪学期
int schoolYear = DateUtils.getSchoolYear(schoolStudentIntegral.getDay());
int term = isNewTerm();
int term = isNewTermY(schoolStudentIntegral.getDay());
schoolStudentIntegral.setSchoolYear(schoolYear);
schoolStudentIntegral.setTerm(term);
//schoolStudentIntegral.setCreateTime(DateTime.now());
......
......@@ -86,17 +86,17 @@ public class StatisticsController extends BaseController {
/**
* 教务-统计-年龄统计
*/
@GetMapping("/age")
public TableDataInfo age()
@GetMapping("/age/{schoolYear}")
public TableDataInfo age(@PathVariable("schoolYear") int schoolYear)
{
return getDataTable(statisticsService.getAgeNum());
return getDataTable(statisticsService.getAgeNum(schoolYear));
}
/**年龄导出*/
@PostMapping("/exportAge")
public void exportAge(HttpServletResponse response)
@PostMapping("/exportAge/{schoolYear}")
public void exportAge(@PathVariable("schoolYear") int schoolYear,HttpServletResponse response)
{
List<StatisticsAgeVo> list = statisticsService.getAgeNum();
List<StatisticsAgeVo> list = statisticsService.getAgeNum(schoolYear);
try {
TemplateExportParams params = new TemplateExportParams(TemplateExcelUtils.convertTemplatePath("template/countAge.xlsx"));
Map<String, Object> finalMap = new HashMap<String, Object>();
......
......@@ -140,7 +140,9 @@ public class SchoolMessageParentsPushsController extends BaseController
boolean flag = parentsPushsService.save(parentsPushs);
if(flag){
//获取当前学年
int schoolYear = HolidayDateUtil.getSchoolYear();
// int schoolYear = HolidayDateUtil.getSchoolYear();
// TODO 修改最新学年
int schoolYear = gradeService.isNewSchoolYear();
//获取当前级部(存在当前登录人在多个级部工作)
//List<SchoolGrade> gradeIds = gradeMentorService.selectGrades(getUserId(),schoolYear);
List<SchoolGrade> gradeIds = gradeMentorService.selectGradeList(getUserId());
......
......@@ -63,7 +63,7 @@ public class MinisterialController extends BaseController {
@GetMapping("/getClassTreeForGrade")
public AjaxResult getClassTreeList(SchoolClass schoolClass) {
//获取当前学年
int schoolYear = HolidayDateUtil.getSchoolYear();
// int schoolYear = HolidayDateUtil.getSchoolYear();
//List<SchoolGrade> gradeIds = gradeMentorService.selectGrades(getUserId(),schoolYear);
List<SchoolGrade> gradeIds = gradeMentorService.selectGradeList(getUserId());
if(StringUtils.isNull(gradeIds) || gradeIds.size() == 0){
......@@ -100,7 +100,7 @@ public class MinisterialController extends BaseController {
@GetMapping("/getClassForGrade")
public TableDataInfo getClassForGrade(SchoolClass schoolClass) {
//获取当前学年
int schoolYear = HolidayDateUtil.getSchoolYear();
// int schoolYear = HolidayDateUtil.getSchoolYear();
//List<SchoolGrade> gradeIds = gradeMentorService.selectGrades(getUserId(),schoolYear);
List<SchoolGrade> gradeIds = gradeMentorService.selectGradeList(getUserId());
if(StringUtils.isNull(gradeIds) || gradeIds.size() == 0){
......@@ -134,7 +134,7 @@ public class MinisterialController extends BaseController {
@GetMapping("/list")
public TableDataInfo studentList(SchoolStudentVO schoolStudent) {
//获取当前学年
int schoolYear = HolidayDateUtil.getSchoolYear();
// int schoolYear = HolidayDateUtil.getSchoolYear();
//List<SchoolGrade> gradeIds = gradeMentorService.selectGrades(getUserId(),schoolYear);
List<SchoolGrade> gradeIds = gradeMentorService.selectGradeList(getUserId());
if(StringUtils.isNull(gradeIds) || gradeIds.size() == 0){
......@@ -207,7 +207,9 @@ public class MinisterialController extends BaseController {
@GetMapping("/parentList")
public TableDataInfo allParentList(SchoolStudentParentVO schoolStudentParentVO) {
//获取当前学年
int schoolYear = HolidayDateUtil.getSchoolYear();
// int schoolYear = HolidayDateUtil.getSchoolYear();
// TODO 修改最新学年
int schoolYear = gradeService.isNewSchoolYear();
//List<SchoolGrade> gradeIds = gradeMentorService.selectGrades(getUserId(),schoolYear);
List<SchoolGrade> gradeIds = gradeMentorService.selectGradeList(getUserId());
if(StringUtils.isNull(gradeIds) || gradeIds.size() == 0){
......
......@@ -309,7 +309,23 @@ public class SchoolPurchaseController extends BaseController {
*/
@GetMapping("/selectRegisterById/{id}")
public AjaxResult selectRegisterById(@PathVariable("id") Long id) {
return AjaxResult.success(schoolPurchaseService.getById(id));
// return AjaxResult.success(schoolPurchaseService.getById(id));
// TODO 修改采购信息详情
SchoolPurchase schoolPurchase = schoolPurchaseService.getById(id);
PurchaseVo purchaseVo = new PurchaseVo();
BeanUtils.copyProperties(schoolPurchase,purchaseVo);
LambdaQueryWrapper<SchoolPurchaseDetails> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolPurchaseDetails::getPurchaseId,id);
List<SchoolPurchaseDetails> list = schoolPurchaseDetailService.list(wrapper);
List<SchoolPurchaseDetailsVo> voList = new ArrayList<>();
list.forEach(schoolPurchaseDetails -> {
SchoolPurchaseDetailsVo schoolPurchaseDetailsVo = new SchoolPurchaseDetailsVo();
BeanUtils.copyProperties(schoolPurchaseDetails,schoolPurchaseDetailsVo);
voList.add(schoolPurchaseDetailsVo);
});
purchaseVo.setList(voList);
return AjaxResult.success(purchaseVo);
}
/**
......
......@@ -7,7 +7,6 @@ import com.core.utils.HolidayDateUtil;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SchoolTeacher;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.base.BaseException;
......@@ -22,25 +21,20 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import yangtz.cs.liu.campus.controller.patrol.SchoolPatrolController;
import yangtz.cs.liu.campus.domain.SchoolStudentIntegral.SchoolStudentIntegral;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClass;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClassHeadmaster;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClassMentor;
import yangtz.cs.liu.campus.domain.schoolgrade.SchoolGrade;
import yangtz.cs.liu.campus.domain.schoolgrade.SchoolGradeMentor;
import yangtz.cs.liu.campus.domain.student.SchoolStudent;
import yangtz.cs.liu.campus.service.ISchoolStudentIntegra.ISchoolStudentIntegralService;
import yangtz.cs.liu.campus.service.schoolClass.ISchoolClassHeadmasterService;
import yangtz.cs.liu.campus.service.schoolClass.ISchoolClassMentorService;
import yangtz.cs.liu.campus.service.schoolClass.ISchoolClassService;
import yangtz.cs.liu.campus.service.schoolgrade.ISchoolGradeMentorService;
import yangtz.cs.liu.campus.service.schoolgrade.ISchoolGradeService;
import yangtz.cs.liu.campus.service.student.ISchoolStudentService;
import yangtz.cs.liu.campus.service.teacher.ISchoolTeacherService;
import yangtz.cs.liu.campus.vo.schoolClass.ClassBatchVo;
import yangtz.cs.liu.campus.vo.schoolClass.ClassTreeSelect;
import yangtz.cs.liu.campus.vo.schoolgrade.GradeTreeSelect;
import yangtz.cs.liu.campus.vo.schoolClass.SchoolClassDrVo;
import yangtz.cs.liu.campus.vo.student.SchoolStudentVO;
import javax.servlet.http.HttpServletResponse;
......@@ -282,26 +276,26 @@ public class SchoolClassController extends BaseController {
/**
* 下载模板
*
* TODO 修改班级管理导入
* @return
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
ExcelUtil<SchoolClass> util = new ExcelUtil<>(SchoolClass.class);
ExcelUtil<SchoolClassDrVo> util = new ExcelUtil<>(SchoolClassDrVo.class);
util.importTemplateExcel(response, "班级表");
}
/**
* 导入
*
* TODO 修改班级管理导入
* @param file
* @return
* @throws Exception
*/
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file) throws Exception {
ExcelUtil<SchoolClass> util = new ExcelUtil<SchoolClass>(SchoolClass.class);
List<SchoolClass> list = util.importExcel(file.getInputStream());
ExcelUtil<SchoolClassDrVo> util = new ExcelUtil<SchoolClassDrVo>(SchoolClassDrVo.class);
List<SchoolClassDrVo> list = util.importExcel(file.getInputStream());
//校验
schoolClassService.checkImport(list);
//导入
......@@ -309,6 +303,35 @@ public class SchoolClassController extends BaseController {
return AjaxResult.success(message);
}
// /**
// * 下载模板
// *
// * @return
// */
// @PostMapping("/importTemplate")
// public void importTemplate(HttpServletResponse response) {
// ExcelUtil<SchoolClass> util = new ExcelUtil<>(SchoolClass.class);
// util.importTemplateExcel(response, "班级表");
// }
//
// /**
// * 导入
// *
// * @param file
// * @return
// * @throws Exception
// */
// @PostMapping("/importData")
// public AjaxResult importData(MultipartFile file) throws Exception {
// ExcelUtil<SchoolClass> util = new ExcelUtil<SchoolClass>(SchoolClass.class);
// List<SchoolClass> list = util.importExcel(file.getInputStream());
// //校验
// schoolClassService.checkImport(list);
// //导入
// String message = schoolClassService.importExamDetail(list);
// return AjaxResult.success(message);
// }
/**
......
......@@ -98,7 +98,7 @@ public class SchoolDcwjController extends BaseController {
public TableDataInfo list(SchoolDcwj schoolDcwj) {
//获取当前登录人当前学年所在级部
//获取当前学年
int schoolYear = HolidayDateUtil.getSchoolYear();
// int schoolYear = HolidayDateUtil.getSchoolYear();
//获取当前用户所在级部
/* List<SchoolGrade> gradeIds = gradeMentorService.selectGrades(getUserId(), schoolYear);
if (StringUtils.isNull(gradeIds) || gradeIds.size() == 0) {
......@@ -132,7 +132,9 @@ public class SchoolDcwjController extends BaseController {
public TableDataInfo headerList(SchoolDcwj schoolDcwj) {
//获取当前登录人当前学年所任班主任的班级ids
//获取当前学年
int schoolYear = HolidayDateUtil.getSchoolYear();
// int schoolYear = HolidayDateUtil.getSchoolYear();
// TODO 修改最新学年
int schoolYear = gradeService.isNewSchoolYear();
LambdaQueryWrapper<SchoolClass> lqw = new LambdaQueryWrapper<>();
lqw
.eq(SchoolClass::getSchoolYear, schoolYear)
......@@ -422,7 +424,9 @@ public class SchoolDcwjController extends BaseController {
public List<Long> getStudentIds() {
//获取班主任所在班级的学生
//获取当前学年
int schoolYear = HolidayDateUtil.getSchoolYear();
// int schoolYear = HolidayDateUtil.getSchoolYear();
// TODO 修改最新学年
int schoolYear = gradeService.isNewSchoolYear();
LambdaQueryWrapper<SchoolClass> lqw = new LambdaQueryWrapper<>();
lqw
.eq(SchoolClass::getSchoolYear, schoolYear)
......
......@@ -541,8 +541,10 @@ public class SchoolDcwjNrController extends BaseController
.set(SchoolDcwjNr::getNrN,null)
.set(SchoolDcwjNr::getNrO,null);
//判断是否有页面逻辑,如果没有,则要将表里的值(如果之前有)去掉
if(StringUtils.isNull(schoolDcwjNr.getNrId()) || "".equals(schoolDcwjNr.getNrId())) {
if(StringUtils.isNull(schoolDcwjNr.getNrId())) {
luw.set(SchoolDcwjNr::getNrId,null).set(SchoolDcwjNr::getNrSelect,null);
}else {
luw.set(SchoolDcwjNr::getNrId,schoolDcwjNr.getNrId()).set(SchoolDcwjNr::getNrSelect,schoolDcwjNr.getNrSelect());
}
return toAjax(schoolDcwjNrService.update(luw));
}
......@@ -550,7 +552,7 @@ public class SchoolDcwjNrController extends BaseController
}
public void judgePx(SchoolDcwjNr schoolDcwjNr){
if(StringUtils.isNull(schoolDcwjNr.getDcwjId()) || "".equals(schoolDcwjNr.getDcwjId())){
if(StringUtils.isNull(schoolDcwjNr.getDcwjId())){
throw new ServiceException("主表id为空,请检查");
}
LambdaQueryWrapper<SchoolDcwjNr> lqw = new LambdaQueryWrapper<>();
......
......@@ -26,8 +26,10 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
import yangtz.cs.liu.campus.domain.purchase.SchoolPurchase;
import yangtz.cs.liu.campus.domain.schoolbudget.SchoolBudget;
import yangtz.cs.liu.campus.domain.schoolbudget.SchoolBudgetDetails;
import yangtz.cs.liu.campus.service.purchase.ISchoolPurchaseService;
import yangtz.cs.liu.campus.service.schoolbudget.ISchoolBudgetDetailsService;
import yangtz.cs.liu.campus.service.schoolbudget.ISchoolBudgetService;
import yangtz.cs.liu.campus.vo.schoolbudget.SchoolBudgetVo;
......@@ -48,6 +50,9 @@ public class SchoolBudgetController extends BaseController
@Autowired
private ISchoolBudgetDetailsService schoolBudgetDetailsService;
@Autowired
private ISchoolPurchaseService purchaseService;
/**
* 按科室过滤查询预算项目列表
*/
......@@ -165,6 +170,14 @@ public class SchoolBudgetController extends BaseController
@DeleteMapping("/delete/{ids}")
public AjaxResult remove(@PathVariable List<Integer> ids)
{
// TODO 修改
//判断该预算项目是否已经采购过
LambdaQueryWrapper<SchoolPurchase> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SchoolPurchase::getBudgetId,ids);
List<SchoolPurchase> list = purchaseService.list(wrapper);
if (StringUtils.isNotNull(list) && list.size() > 0){
throw new ServiceException("该预算项目已采购,不可删除");
}
//删除子表
LambdaQueryWrapper<SchoolBudgetDetails> lqw = new LambdaQueryWrapper<>();
lqw.in(SchoolBudgetDetails::getBudgetId,ids);
......
......@@ -82,7 +82,7 @@ public class SchoolStudentController extends BaseController {
*/
@PostMapping("/add")
public AjaxResult add(@RequestBody @Validated SchoolStudent schoolStudent) {
checkStudentUnique(schoolStudent);
checkStudentUniqueXz(schoolStudent);
boolean flag = schoolStudentService.save(schoolStudent);
//添加关系到学生班级表
if(StringUtils.isNotNull(schoolStudent.getClassId())){
......@@ -114,50 +114,157 @@ public class SchoolStudentController extends BaseController {
relationService.remove(lqw);
addRelation(schoolStudent);
}
}
return toAjax(flag);
}
private void checkStudentUniqueXz(SchoolStudent schoolStudent) {
// TODO 修改
LambdaQueryWrapper<SchoolStudent> lqw = new LambdaQueryWrapper<>();
lqw
.eq(SchoolStudent::getIdCard, schoolStudent.getIdCard());
SchoolStudent student = schoolStudentService.getOne(lqw);
if (StringUtils.isNotNull(student)){
if (schoolStudent.getIdCard().equals(student.getIdCard())){
throw new ServiceException("身份证号已存在");
}
}
LambdaQueryWrapper<SchoolStudent> lqw1 = new LambdaQueryWrapper<>();
lqw1
.eq(SchoolStudent::getSchoolNo, schoolStudent.getSchoolNo());
SchoolStudent student1 = schoolStudentService.getOne(lqw1);
if (StringUtils.isNotNull(student1)){
if (schoolStudent.getSchoolNo().equals(student1.getSchoolNo())){
throw new ServiceException("注册序号已存在");
}
}
LambdaQueryWrapper<SchoolStudent> lqw2 = new LambdaQueryWrapper<>();
lqw2
.eq(SchoolStudent::getProvincialNumber, schoolStudent.getProvincialNumber());
SchoolStudent student2 = schoolStudentService.getOne(lqw2);
if (StringUtils.isNotNull(student2)){
if (schoolStudent.getProvincialNumber().equals(student2.getProvincialNumber())){
throw new ServiceException("省学籍辅号已存在");
}
}
LambdaQueryWrapper<SchoolStudent> lqw3 = new LambdaQueryWrapper<>();
lqw3
.eq(SchoolStudent::getNationalNumber, schoolStudent.getNationalNumber());
SchoolStudent student3 = schoolStudentService.getOne(lqw3);
if (StringUtils.isNotNull(student3)){
if (schoolStudent.getNationalNumber().equals(student3.getNationalNumber())){
throw new ServiceException("全国学籍号已存在");
}
}
LambdaQueryWrapper<SchoolStudent> lqw4 = new LambdaQueryWrapper<>();
lqw4
.eq(SchoolStudent::getOneCard, schoolStudent.getOneCard());
SchoolStudent student4 = schoolStudentService.getOne(lqw4);
if (StringUtils.isNotNull(student4)){
if (schoolStudent.getOneCard().equals(student4.getOneCard())){
throw new ServiceException("校园一卡通已存在");
}
}
}
private void checkStudentUnique(SchoolStudent schoolStudent) {
// TODO 原代码
// LambdaQueryWrapper<SchoolStudent> lqw = new LambdaQueryWrapper<>();
// lqw
// .eq(SchoolStudent::getIdCard, schoolStudent.getIdCard())
// .or()
// .eq(SchoolStudent::getSchoolNo, schoolStudent.getSchoolNo())
// .or()
// .eq(isNotBlank(schoolStudent.getProvincialNumber()),SchoolStudent::getProvincialNumber,schoolStudent.getProvincialNumber())
// .or()
// .eq(isNotBlank(schoolStudent.getNationalNumber()),SchoolStudent::getNationalNumber,schoolStudent.getNationalNumber())
// .or()
// .eq(isNotBlank(schoolStudent.getOneCard()), SchoolStudent::getOneCard, schoolStudent.getOneCard());
// SchoolStudent student = schoolStudentService.getOne(lqw);
// if (StringUtils.isNotNull(student)) {
// if (StringUtils.isNotNull(schoolStudent.getId()) && schoolStudent.getId().equals(student.getId())) {
// return;
// }
// if (schoolStudent.getIdCard().equals(student.getIdCard())) {
// throw new ServiceException("身份证号已存在");
// }
// if (schoolStudent.getSchoolNo().equals(student.getSchoolNo())) {
// throw new ServiceException("注册序号已存在");
// }
// if(StringUtils.isNotBlank(schoolStudent.getProvincialNumber())){
// if (schoolStudent.getProvincialNumber().equals(student.getProvincialNumber())) {
// throw new ServiceException("省学籍辅号已存在");
// }
// }
// if(StringUtils.isNotBlank(schoolStudent.getNationalNumber())){
// if (schoolStudent.getNationalNumber().equals(student.getNationalNumber())) {
// throw new ServiceException("全国学籍号已存在");
// }
// }
// if (StringUtils.isNotBlank(schoolStudent.getOneCard())) {
// if (schoolStudent.getOneCard().equals(student.getOneCard())) {
// throw new ServiceException("校园一卡通已存在");
// }
// }
// }
// TODO 修改
LambdaQueryWrapper<SchoolStudent> lqw = new LambdaQueryWrapper<>();
lqw
.eq(SchoolStudent::getIdCard, schoolStudent.getIdCard())
.or()
.eq(SchoolStudent::getSchoolNo, schoolStudent.getSchoolNo())
.or()
.eq(isNotBlank(schoolStudent.getProvincialNumber()),SchoolStudent::getProvincialNumber,schoolStudent.getProvincialNumber())
.or()
.eq(isNotBlank(schoolStudent.getNationalNumber()),SchoolStudent::getNationalNumber,schoolStudent.getNationalNumber())
.or()
.eq(isNotBlank(schoolStudent.getOneCard()), SchoolStudent::getOneCard, schoolStudent.getOneCard());
.notIn(SchoolStudent::getId,schoolStudent.getId());
SchoolStudent student = schoolStudentService.getOne(lqw);
if (StringUtils.isNotNull(student)) {
if (StringUtils.isNotNull(schoolStudent.getId()) && schoolStudent.getId().equals(student.getId())) {
return;
}
if (schoolStudent.getIdCard().equals(student.getIdCard())) {
if (StringUtils.isNotNull(student)){
if (schoolStudent.getIdCard().equals(student.getIdCard())){
throw new ServiceException("身份证号已存在");
}
if (schoolStudent.getSchoolNo().equals(student.getSchoolNo())) {
}
LambdaQueryWrapper<SchoolStudent> lqw1 = new LambdaQueryWrapper<>();
lqw1
.eq(SchoolStudent::getSchoolNo, schoolStudent.getSchoolNo())
.notIn(SchoolStudent::getId,schoolStudent.getId());
SchoolStudent student1 = schoolStudentService.getOne(lqw1);
if (StringUtils.isNotNull(student1)){
if (schoolStudent.getSchoolNo().equals(student1.getSchoolNo())){
throw new ServiceException("注册序号已存在");
}
if(StringUtils.isNotBlank(schoolStudent.getProvincialNumber())){
if (schoolStudent.getProvincialNumber().equals(student.getProvincialNumber())) {
throw new ServiceException("省学籍辅号已存在");
}
}
LambdaQueryWrapper<SchoolStudent> lqw2 = new LambdaQueryWrapper<>();
lqw2
.eq(SchoolStudent::getProvincialNumber, schoolStudent.getProvincialNumber())
.notIn(SchoolStudent::getId,schoolStudent.getId());
SchoolStudent student2 = schoolStudentService.getOne(lqw2);
if (StringUtils.isNotNull(student2)){
if (schoolStudent.getProvincialNumber().equals(student2.getProvincialNumber())){
throw new ServiceException("省学籍辅号已存在");
}
if(StringUtils.isNotBlank(schoolStudent.getNationalNumber())){
if (schoolStudent.getNationalNumber().equals(student.getNationalNumber())) {
throw new ServiceException("全国学籍号已存在");
}
}
LambdaQueryWrapper<SchoolStudent> lqw3 = new LambdaQueryWrapper<>();
lqw3
.eq(SchoolStudent::getNationalNumber, schoolStudent.getNationalNumber())
.notIn(SchoolStudent::getId,schoolStudent.getId());
SchoolStudent student3 = schoolStudentService.getOne(lqw3);
if (StringUtils.isNotNull(student3)){
if (schoolStudent.getNationalNumber().equals(student3.getNationalNumber())){
throw new ServiceException("全国学籍号已存在");
}
if (StringUtils.isNotBlank(schoolStudent.getOneCard())) {
if (schoolStudent.getOneCard().equals(student.getOneCard())) {
throw new ServiceException("校园一卡通已存在");
}
}
LambdaQueryWrapper<SchoolStudent> lqw4 = new LambdaQueryWrapper<>();
lqw4
.eq(SchoolStudent::getOneCard, schoolStudent.getOneCard())
.notIn(SchoolStudent::getId,schoolStudent.getId());
SchoolStudent student4 = schoolStudentService.getOne(lqw4);
if (StringUtils.isNotNull(student4)){
if (schoolStudent.getOneCard().equals(student4.getOneCard())){
throw new ServiceException("校园一卡通已存在");
}
}
}
......
......@@ -18,6 +18,7 @@ import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
......@@ -153,7 +154,31 @@ public class SchoolStudentLeaveController extends BaseController {
*/
@GetMapping("/queryOne/{id}")
public AjaxResult queryOne(@PathVariable("id") Long id) {
return AjaxResult.success(schoolStudentLeaveService.getById(id));
SchoolStudentLeave studentLeave = schoolStudentLeaveService.getById(id);
StudentLeaveVO leaveVo = new StudentLeaveVO();
BeanUtils.copyProperties(studentLeave,leaveVo);
if (StringUtils.isNotBlank(studentLeave.getInstanceId())) {
List<Task> taskList = taskService.createTaskQuery()
.processInstanceId(studentLeave.getInstanceId())
.list(); // 例如请假会签,会同时拥有多个任务
if (!CollectionUtils.isEmpty(taskList)) {
TaskEntityImpl task = (TaskEntityImpl) taskList.get(0);
leaveVo.setTaskId(task.getId());
if (task.getSuspensionState() == 2) {
leaveVo.setTaskName("已挂起");
leaveVo.setSuspendState("2");
} else {
leaveVo.setTaskName(task.getName());
leaveVo.setSuspendState("1");
}
} else {
// 已办结或者已撤销
leaveVo.setTaskName("已结束");
}
} else {
leaveVo.setTaskName("未启动");
}
return AjaxResult.success(leaveVo);
}
/**
......
......@@ -36,4 +36,10 @@ public interface StudentScoreMapper extends BaseMapper<SchoolStudentScore> {
* @return
*/
int deleteStudentScore(Long[] ids);
//批量修改学生考试成绩
void updateScoreList(@Param("list") List<SchoolStudentScore> updateScoreList);
//批量新增学生考试成绩
void insertScoreList(@Param("list") List<SchoolStudentScore> addScoreList);
}
......@@ -2,6 +2,7 @@ package yangtz.cs.liu.campus.mapper.student;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import yangtz.cs.liu.campus.domain.student.SchoolStudentClassRelation;
import yangtz.cs.liu.campus.vo.schoolClass.StudentClassRelationVo;
......@@ -11,4 +12,16 @@ import java.util.List;
public interface SchoolStudentClassRelationMapper extends BaseMapper<SchoolStudentClassRelation> {
//查询学生班级关系列表
List<StudentClassRelationVo> queryListByStudentId(Long studentId);
/**
* 修改学生与班级关系
* @param updateRelationList
*/
void updateRelationList(@Param("list") List<SchoolStudentClassRelation> updateRelationList);
/**
* 新增学生与班级关系
* @param addRelationList
*/
void addRelationList(@Param("list") List<SchoolStudentClassRelation> addRelationList);
}
......@@ -79,4 +79,17 @@ public interface SchoolStudentMapper extends BaseMapper<SchoolStudent> {
* @return
*/
SchoolStudentVO getInfoByidCard(String idCard);
/**
* 批量插入学生
* @param addList
* @return
*/
int inserStudentList(@Param("list") List<SchoolStudent> addList);
/**
* 批量更新学生信息
* @param updateList
*/
int updateStudentList(@Param("list") List<SchoolStudent> updateList);
}
......@@ -72,4 +72,12 @@ public interface SchoolStudentParentMapper extends BaseMapper<SchoolStudentParen
* 根据id 查询 openId
*/
String getOpenIdById(Long id);
/**
* 更新学生家长信息
* @param updateParentList
*/
void updateParentList(@Param("list") List<SchoolStudentParent> updateParentList);
// 新增学生家长信息
void addParentList(@Param("list") List<SchoolStudentParent> addParentList);
}
......@@ -15,5 +15,5 @@ public interface IEducationStatisticsService {
List<StatisticsVariationVo> getVariationNum(String data,String data1);
//年龄统计
List<StatisticsAgeVo> getAgeNum();
List<StatisticsAgeVo> getAgeNum(int schoolYear);
}
......@@ -80,51 +80,49 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, Sch
// 准备记录日志数据
int successNum = 0;
StringBuilder successMsg = new StringBuilder();
//查询全部学生考试成绩
LambdaQueryWrapper<SchoolStudentScore> lqw = new LambdaQueryWrapper<>();
List<SchoolStudentScore> schoolStudentScores = studentScoreMapper.selectList(lqw);
List<SchoolStudentScore> updateScoreList = new ArrayList<>();
List<SchoolStudentScore> addScoreList = new ArrayList<>();
for (SchoolStudentScoreVo schoolStudentScoreVo : list) {
LambdaQueryWrapper<SchoolStudent> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolStudent::getIdCard,schoolStudentScoreVo.getIdCard());
SchoolStudent schoolStudent = schoolStudentMapper.selectOne(wrapper);
if (StringUtils.isNotNull(schoolStudent)){
//赋值
SchoolStudentScore schoolStudentScore = new SchoolStudentScore();
schoolStudentScore.setStudentId(schoolStudent.getId());
schoolStudentScore.setCurriculaId(curriculaId);
schoolStudentScore.setClassId(schoolStudent.getClassId());
schoolStudentScore.setExamType(schoolStudentScoreVo.getExamType());
schoolStudentScore.setLanguage(schoolStudentScoreVo.getLanguage());
schoolStudentScore.setMath(schoolStudentScoreVo.getMath());
schoolStudentScore.setEnglish(schoolStudentScoreVo.getEnglish());
schoolStudentScore.setPolitics(schoolStudentScoreVo.getPolitics());
schoolStudentScore.setGeography(schoolStudentScoreVo.getGeography());
schoolStudentScore.setHistory(schoolStudentScoreVo.getHistory());
schoolStudentScore.setPhysics(schoolStudentScoreVo.getPhysics());
schoolStudentScore.setChemistry(schoolStudentScoreVo.getChemistry());
schoolStudentScore.setBiology(schoolStudentScoreVo.getBiology());
schoolStudentScore.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
schoolStudentScore.setCreateTime(DateUtils.getNowDate());
LambdaQueryWrapper<SchoolStudentScore> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(SchoolStudentScore::getExamType,schoolStudentScore.getExamType())
.eq(SchoolStudentScore::getStudentId,schoolStudentScore.getStudentId())
.eq(SchoolStudentScore::getDelFlag,"0");
List<SchoolStudentScore> schoolStudentScores = studentScoreMapper.selectList(wrapper1);
String examType = schoolStudentScoreVo.getExamType();
switch (examType){
case "1":
examType = "一次";
break;
case "2":
examType = "二次";
break;
case "3":
examType = "三次";
break;
}
if (schoolStudentScores.size() > 0){
throw new ServiceException("已存在" + schoolStudentScoreVo.getStudentName() + "学生" + examType + "考试成绩");
SchoolStudentScore score = new SchoolStudentScore();
for (SchoolStudentScore schoolStudentScore : schoolStudentScores) {
if (schoolStudentScoreVo.getExamType().equals(schoolStudentScore.getExamType()) &&
schoolStudentScoreVo.getStudentId().equals(schoolStudentScore.getStudentId()) &&
schoolStudentScore.getCurriculaId().equals(curriculaId)){
BeanUtils.copyProperties(schoolStudentScore,score);
}
studentScoreMapper.insert(schoolStudentScore);
successNum ++;
}
//判断学生是否存在此次考试成绩
if (StringUtils.isNotNull(score.getStudentId())){
//存在,更新学生此次考试成绩
score.setLanguage(schoolStudentScoreVo.getLanguage());
score.setMath(schoolStudentScoreVo.getMath());
score.setEnglish(schoolStudentScoreVo.getEnglish());
score.setPolitics(schoolStudentScoreVo.getPolitics());
score.setGeography(schoolStudentScoreVo.getGeography());
score.setHistory(schoolStudentScoreVo.getHistory());
score.setPhysics(schoolStudentScoreVo.getPhysics());
score.setChemistry(schoolStudentScoreVo.getChemistry());
score.setBiology(schoolStudentScoreVo.getBiology());
updateScoreList.add(score);
}else {
//不存在,新增学生此次考试成绩
SchoolStudentScore schoolStudentScore = new SchoolStudentScore();
BeanUtils.copyProperties(schoolStudentScoreVo,schoolStudentScore);
addScoreList.add(schoolStudentScore);
}
successNum ++;
}
if (updateScoreList.size() > 0){
studentScoreMapper.updateScoreList(updateScoreList);
}
if (addScoreList.size() > 0){
studentScoreMapper.insertScoreList(addScoreList);
}
successMsg.insert(0, "恭喜您,数据已导入成功!共有 " + successNum + " 条,数据如下:");
return successMsg.toString();
......@@ -153,10 +151,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, Sch
} else if (StringUtils.isEmpty(schoolStudentScoreVo.getStudentNumber())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、学号为空,请您重新输入!");
} /*else if (StringUtils.isEmpty(schoolStudentScoreVo.getClassName())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、班级为空,请您重新输入!");
}*/ else if (StringUtils.isNull(schoolStudentScoreVo.getExamType())) {
} else if (StringUtils.isNull(schoolStudentScoreVo.getExamType())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、考试类型为空,请您重新输入!");
} else {
......@@ -167,17 +162,10 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, Sch
if (StringUtils.isNull(schoolStudents) || schoolStudents.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、" + schoolStudentScoreVo.getStudentName() + "同学不存在,请您重新输入! ");
}/*else {
}else {
SchoolStudent schoolStudent = schoolStudents.get(0);
LambdaQueryWrapper<SchoolClass> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SchoolClass::getId,schoolStudent.getClassId())
.eq(SchoolClass::getClassName,schoolStudentScoreVo.getClassName());
List<SchoolClass> schoolClasses = schoolClassMapper.selectList(queryWrapper);
if (StringUtils.isNull(schoolClasses) || schoolClasses.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、" + schoolStudentScoreVo.getClassName() + "班级" + schoolStudentScoreVo.getStudentName() + "同学不存在,请您重新输入! ");
}
}*/
schoolStudentScoreVo.setStudentId(schoolStudent.getId());
}
}
}
if (failureNum > 0) {
......@@ -217,6 +205,34 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, Sch
if (schoolStudentScores.size() > 0){
throw new ServiceException("已存在该学生此次考试成绩");
}
if (schoolStudentScore.getLanguage() > 150 || schoolStudentScore.getLanguage() < 0){
throw new ServiceException("请输入正确分数");
}
if (schoolStudentScore.getMath() > 150 || schoolStudentScore.getMath() < 0){
throw new ServiceException("请输入正确分数");
}
if (schoolStudentScore.getEnglish() > 150 || schoolStudentScore.getEnglish() < 0){
throw new ServiceException("请输入正确分数");
}
if (schoolStudentScore.getPolitics() > 150 || schoolStudentScore.getPolitics() < 0){
throw new ServiceException("请输入正确分数");
}
if (schoolStudentScore.getGeography() > 150 || schoolStudentScore.getGeography() < 0){
throw new ServiceException("请输入正确分数");
}
if (schoolStudentScore.getHistory() > 150 || schoolStudentScore.getHistory() < 0){
throw new ServiceException("请输入正确分数");
}
if (schoolStudentScore.getPhysics() > 150 || schoolStudentScore.getPhysics() < 0){
throw new ServiceException("请输入正确分数");
}
if (schoolStudentScore.getChemistry() > 150 || schoolStudentScore.getChemistry() < 0){
throw new ServiceException("请输入正确分数");
}
if (schoolStudentScore.getBiology() > 150 || schoolStudentScore.getBiology() < 0){
throw new ServiceException("请输入正确分数");
}
schoolStudentScore.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
schoolStudentScore.setCreateTime(DateUtils.getNowDate());
return studentScoreMapper.insert(schoolStudentScore);
......
......@@ -201,10 +201,10 @@ public class EducationStatisticsServiceImpl implements IEducationStatisticsServi
//年龄统计
@Override
public List<StatisticsAgeVo> getAgeNum() {
public List<StatisticsAgeVo> getAgeNum(int schoolYear) {
List<StatisticsAgeVo> list = new ArrayList<>();
//获取当前学年
int schoolYear = HolidayDateUtil.getSchoolYear();
// int schoolYear = HolidayDateUtil.getSchoolYear();
//int schoolYear = 2021;
//统计每个级部的班级里的学生的年龄个数
for (int i = 1; i < 4; i++) {
......
......@@ -17,15 +17,19 @@ import yangtz.cs.liu.campus.constant.ClassConstant;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClass;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClassHeadmaster;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClassMentor;
import yangtz.cs.liu.campus.domain.schoolCurriculum.SchoolCurriculum;
import yangtz.cs.liu.campus.domain.schoolgrade.SchoolGrade;
import yangtz.cs.liu.campus.mapper.schoolClass.SchoolClassHeadmasterMapper;
import yangtz.cs.liu.campus.mapper.schoolClass.SchoolClassMapper;
import yangtz.cs.liu.campus.mapper.schoolClass.SchoolClassMentorMapper;
import yangtz.cs.liu.campus.mapper.schoolCurriculum.SchoolCurriculumMapper;
import yangtz.cs.liu.campus.mapper.schoolgrade.SchoolGradeMapper;
import yangtz.cs.liu.campus.mapper.teacher.SchoolTeacherMapper;
import yangtz.cs.liu.campus.service.schoolClass.ISchoolClassService;
import yangtz.cs.liu.campus.service.student.ISchoolStudentParentService;
import yangtz.cs.liu.campus.vo.schoolClass.ClassBatchVo;
import yangtz.cs.liu.campus.vo.schoolClass.ClassTreeSelect;
import yangtz.cs.liu.campus.vo.schoolClass.SchoolClassDrVo;
import yangtz.cs.liu.campus.vo.schoolClass.SchoolClassMentorVo;
import yangtz.cs.liu.wechat.vo.schoolClass.SchoolClassVo;
......@@ -56,6 +60,12 @@ public class SchoolClassImpl extends ServiceImpl<SchoolClassMapper, SchoolClass>
@Autowired
private SchoolClassHeadmasterMapper headmasterMapper;
@Autowired
private SchoolClassMentorMapper mentorMapper;
@Autowired
private SchoolCurriculumMapper curriculumMapper;
@Override
public List<SchoolClass> selectSchoolClassList(SchoolClass schoolClass) {
LambdaQueryWrapper<SchoolClass> lqw = new LambdaQueryWrapper<>();
......@@ -135,12 +145,14 @@ public class SchoolClassImpl extends ServiceImpl<SchoolClassMapper, SchoolClass>
@Override
public List<SchoolClassVo> getTeacherClass(Long teacherId) {
int schoolYear = HolidayDateUtil.getSchoolYear();
// int schoolYear = HolidayDateUtil.getSchoolYear();
// TODO 修改最新学年
int schoolYear = gradeMapper.isNewSchoolYear();
return schoolClassMapper.getTeacherClass(teacherId,schoolYear);
}
@Override
public void checkImport(List<SchoolClass> list) {
public void checkImport(List<SchoolClassDrVo> list) {
//是否为空
if (StringUtils.isNull(list) || list.size() == 0) {
throw new ServiceException("导入数据不能为空");
......@@ -148,7 +160,7 @@ public class SchoolClassImpl extends ServiceImpl<SchoolClassMapper, SchoolClass>
//记录日志数据
int failureNum = 0;
StringBuilder failureMsg = new StringBuilder();
for (SchoolClass schoolClass : list) {
for (SchoolClassDrVo schoolClass : list) {
if (StringUtils.isNull(schoolClass.getGradeValue())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、年级为空,请你重新输入!");
......@@ -581,6 +593,217 @@ public class SchoolClassImpl extends ServiceImpl<SchoolClassMapper, SchoolClass>
schoolClass.setSfzxxn(grade.getSfzxxn());
}
// TODO 校验任课老师是否存在
if (StringUtils.isNotEmpty(schoolClass.getTeacherName1()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel1())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName1()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel1()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName1() + "手机号为" + schoolClass.getTeacherTel1() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId1(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName2()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel2())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName2()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel2()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName2() + "手机号为" + schoolClass.getTeacherTel2() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId2(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName3()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel3())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName3()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel3()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName3() + "手机号为" + schoolClass.getTeacherTel3() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId3(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName4()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel4())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName4()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel4()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName4() + "手机号为" + schoolClass.getTeacherTel4() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId4(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName5()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel5())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName5()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel5()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName5() + "手机号为" + schoolClass.getTeacherTel5() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId5(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName6()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel6())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName6()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel6()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName6() + "手机号为" + schoolClass.getTeacherTel6() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId6(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName7()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel7())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName7()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel7()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName7() + "手机号为" + schoolClass.getTeacherTel7() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId7(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName8()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel8())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName8()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel8()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName8() + "手机号为" + schoolClass.getTeacherTel8() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId8(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName9()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel9())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName9()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel9()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName9() + "手机号为" + schoolClass.getTeacherTel9() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId9(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName10()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel10())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName10()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel10()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName10() + "手机号为" + schoolClass.getTeacherTel10() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId10(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName11()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel11())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName11()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel11()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName11() + "手机号为" + schoolClass.getTeacherTel11() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId11(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName12()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel12())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName12()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel12()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName12() + "手机号为" + schoolClass.getTeacherTel12() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId12(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName13()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel13())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName13()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel13()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName13() + "手机号为" + schoolClass.getTeacherTel13() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId13(teacher1.getId());
}
}
if (StringUtils.isNotEmpty(schoolClass.getTeacherName14()) && StringUtils.isNotEmpty(schoolClass.getTeacherTel14())){
LambdaQueryWrapper<SchoolTeacher> sTea1 = new LambdaQueryWrapper<>();
sTea1
.eq(SchoolTeacher::getTeacherName, StringUtil.clearSpace(schoolClass.getTeacherName14()))
.eq(SchoolTeacher::getTeacherTel, StringUtil.clearSpace(schoolClass.getTeacherTel14()));
List<SchoolTeacher> teacherList1 = teacherMapper.selectList(sTea1);
if (StringUtils.isNull(teacherList1) || teacherList1.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、教师名为" + schoolClass.getTeacherName14() + "手机号为" + schoolClass.getTeacherTel14() + "的教师不存在,请您重新输入! ");
}else {
//存在该教师
SchoolTeacher teacher1 = teacherList1.get(0);
schoolClass.setTeacherId14(teacher1.getId());
}
}
}
//}
}
......@@ -593,11 +816,11 @@ public class SchoolClassImpl extends ServiceImpl<SchoolClassMapper, SchoolClass>
@Override
@Transactional(rollbackFor = Exception.class)
public String importExamDetail(List<SchoolClass> list) {
public String importExamDetail(List<SchoolClassDrVo> list) {
// 准备记录日志数据
int successNum = 0;
StringBuilder successMsg = new StringBuilder();
for (SchoolClass schoolClass : list) {
for (SchoolClassDrVo schoolClass : list) {
LambdaQueryWrapper<SchoolClass> lqw = new LambdaQueryWrapper<>();
lqw
.eq(SchoolClass::getSchoolYear, schoolClass.getSchoolYear())
......@@ -626,15 +849,103 @@ public class SchoolClassImpl extends ServiceImpl<SchoolClassMapper, SchoolClass>
headmaster.setStartTime(DateUtils.getNowDate());
headmaster.insert();
headmasterMapper.insert(headmaster);
// TODO 新增任课教师
//删除本班级与任课教师关系表
if (StringUtils.isNotNull(schoolClass.getTeacherId1()) && StringUtils.isNotEmpty(schoolClass.getCourseName1())){
insertMentor(aClass.getId(),schoolClass.getTeacherId1(),schoolClass.getCourseName1());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId2()) && StringUtils.isNotEmpty(schoolClass.getCourseName2())){
insertMentor(aClass.getId(),schoolClass.getTeacherId2(),schoolClass.getCourseName2());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId3()) && StringUtils.isNotEmpty(schoolClass.getCourseName3())){
insertMentor(aClass.getId(),schoolClass.getTeacherId3(),schoolClass.getCourseName3());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId4()) && StringUtils.isNotEmpty(schoolClass.getCourseName4())){
insertMentor(aClass.getId(),schoolClass.getTeacherId4(),schoolClass.getCourseName4());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId5()) && StringUtils.isNotEmpty(schoolClass.getCourseName5())){
insertMentor(aClass.getId(),schoolClass.getTeacherId5(),schoolClass.getCourseName5());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId6()) && StringUtils.isNotEmpty(schoolClass.getCourseName6())){
insertMentor(aClass.getId(),schoolClass.getTeacherId6(),schoolClass.getCourseName6());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId7()) && StringUtils.isNotEmpty(schoolClass.getCourseName7())){
insertMentor(aClass.getId(),schoolClass.getTeacherId7(),schoolClass.getCourseName7());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId8()) && StringUtils.isNotEmpty(schoolClass.getCourseName8())){
insertMentor(aClass.getId(),schoolClass.getTeacherId8(),schoolClass.getCourseName8());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId9()) && StringUtils.isNotEmpty(schoolClass.getCourseName9())){
insertMentor(aClass.getId(),schoolClass.getTeacherId9(),schoolClass.getCourseName9());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId10()) && StringUtils.isNotEmpty(schoolClass.getCourseName10())){
insertMentor(aClass.getId(),schoolClass.getTeacherId10(),schoolClass.getCourseName10());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId11()) && StringUtils.isNotEmpty(schoolClass.getCourseName11())){
insertMentor(aClass.getId(),schoolClass.getTeacherId11(),schoolClass.getCourseName11());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId12()) && StringUtils.isNotEmpty(schoolClass.getCourseName12())){
insertMentor(aClass.getId(),schoolClass.getTeacherId12(),schoolClass.getCourseName12());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId13()) && StringUtils.isNotEmpty(schoolClass.getCourseName13())){
insertMentor(aClass.getId(),schoolClass.getTeacherId13(),schoolClass.getCourseName13());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId14()) && StringUtils.isNotEmpty(schoolClass.getCourseName14())){
insertMentor(aClass.getId(),schoolClass.getTeacherId14(),schoolClass.getCourseName14());
}
successNum++;
} else {
schoolClassMapper.insert(schoolClass);
SchoolClass schoolClass1 = new SchoolClass();
BeanUtils.copyProperties(schoolClass,schoolClass1);
schoolClassMapper.insert(schoolClass1);
SchoolClassHeadmaster headmaster = new SchoolClassHeadmaster();
headmaster.setTeacherId(schoolClass.getTeacherId());
headmaster.setClassId(schoolClass.getId());
headmaster.setTeacherId(schoolClass1.getTeacherId());
headmaster.setClassId(schoolClass1.getId());
headmaster.setStartTime(DateUtils.getNowDate());
headmaster.insert();
headmasterMapper.insert(headmaster);
if (StringUtils.isNotNull(schoolClass.getTeacherId1()) && StringUtils.isNotEmpty(schoolClass.getCourseName1())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId1(),schoolClass.getCourseName1());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId2()) && StringUtils.isNotEmpty(schoolClass.getCourseName2())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId2(),schoolClass.getCourseName2());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId3()) && StringUtils.isNotEmpty(schoolClass.getCourseName3())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId3(),schoolClass.getCourseName3());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId4()) && StringUtils.isNotEmpty(schoolClass.getCourseName4())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId4(),schoolClass.getCourseName4());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId5()) && StringUtils.isNotEmpty(schoolClass.getCourseName5())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId5(),schoolClass.getCourseName5());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId6()) && StringUtils.isNotEmpty(schoolClass.getCourseName6())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId6(),schoolClass.getCourseName6());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId7()) && StringUtils.isNotEmpty(schoolClass.getCourseName7())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId7(),schoolClass.getCourseName7());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId8()) && StringUtils.isNotEmpty(schoolClass.getCourseName8())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId8(),schoolClass.getCourseName8());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId9()) && StringUtils.isNotEmpty(schoolClass.getCourseName9())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId9(),schoolClass.getCourseName9());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId10()) && StringUtils.isNotEmpty(schoolClass.getCourseName10())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId10(),schoolClass.getCourseName10());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId11()) && StringUtils.isNotEmpty(schoolClass.getCourseName11())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId11(),schoolClass.getCourseName11());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId12()) && StringUtils.isNotEmpty(schoolClass.getCourseName12())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId12(),schoolClass.getCourseName12());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId13()) && StringUtils.isNotEmpty(schoolClass.getCourseName13())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId13(),schoolClass.getCourseName13());
}
if (StringUtils.isNotNull(schoolClass.getTeacherId14()) && StringUtils.isNotEmpty(schoolClass.getCourseName14())){
insetClassMentor(schoolClass1.getId(),schoolClass.getTeacherId14(),schoolClass.getCourseName14());
}
successNum++;
}
}
......@@ -642,6 +953,39 @@ public class SchoolClassImpl extends ServiceImpl<SchoolClassMapper, SchoolClass>
return successMsg.toString();
}
// TODO 新增任课教师与班级关系
private int insetClassMentor(Long classId,Long teacherId,String courseName){
LambdaQueryWrapper<SchoolCurriculum> c1 = new LambdaQueryWrapper<>();
c1.eq(SchoolCurriculum::getCourseName,courseName);
SchoolCurriculum schoolCurriculum = curriculumMapper.selectOne(c1);
SchoolClassMentor schoolClassMentor = new SchoolClassMentor();
schoolClassMentor.setClassId(classId);
schoolClassMentor.setTeacherId(teacherId);
schoolClassMentor.setCourseId(schoolCurriculum.getId());
schoolClassMentor.setCourseName(courseName);
schoolClassMentor.insert();
return mentorMapper.insert(schoolClassMentor);
}
// TODO 删除原任课教师与班级关系并新增
private int insertMentor(Long classId,Long teacherId,String courseName){
LambdaQueryWrapper<SchoolClassMentor> t1 = new LambdaQueryWrapper<>();
t1.eq(SchoolClassMentor::getClassId,classId)
.eq(SchoolClassMentor::getTeacherId,teacherId);
mentorMapper.delete(t1);
LambdaQueryWrapper<SchoolCurriculum> c1 = new LambdaQueryWrapper<>();
c1.eq(SchoolCurriculum::getCourseName,courseName);
SchoolCurriculum schoolCurriculum = curriculumMapper.selectOne(c1);
SchoolClassMentor mentor1 = new SchoolClassMentor();
mentor1.setTeacherId(teacherId);
mentor1.setClassId(classId);
mentor1.setCourseId(schoolCurriculum.getId());
mentor1.setCourseName(courseName);
mentor1.setStartTime(DateUtils.getNowDate());
mentor1.insert();
return mentorMapper.insert(mentor1);
}
/**
* @param schoolClassList
* @return List<ClassTreeSelect>
......@@ -765,7 +1109,9 @@ public class SchoolClassImpl extends ServiceImpl<SchoolClassMapper, SchoolClass>
*/
@Override
public List<Long> getTeacherClasses(Long userId) {
int schoolYear = HolidayDateUtil.getSchoolYear();
// int schoolYear = HolidayDateUtil.getSchoolYear();
// TODO 修改最新学年
int schoolYear = gradeMapper.isNewSchoolYear();
return schoolClassMapper.getClassesIdList(userId,schoolYear);
}
......
......@@ -53,10 +53,8 @@ import javax.validation.Validator;
import java.io.*;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
......@@ -560,10 +558,10 @@ public class SchoolStudentServiceImpl extends ServiceImpl<SchoolStudentMapper, S
if (StringUtils.isEmpty(schoolStudentVO.getStudentName())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、学生姓名为空,请您重新输入! ");
} else if (StringUtils.isEmpty(schoolStudentVO.getSex())) {
} /*else if (StringUtils.isEmpty(schoolStudentVO.getSex())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、学生性别为空,请您重新输入! ");
} else if (StringUtils.isNull(schoolStudentVO.getSchoolYear())) {
}*/ else if (StringUtils.isNull(schoolStudentVO.getSchoolYear())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、学年为空,请您重新输入! ");
} else if (StringUtils.isNull(schoolStudentVO.getGradeValue())) {
......@@ -578,7 +576,7 @@ public class SchoolStudentServiceImpl extends ServiceImpl<SchoolStudentMapper, S
} else if (StringUtils.isEmpty(schoolStudentVO.getNation())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、民族为空,请您重新输入! ");
} else if (StringUtils.isEmpty(schoolStudentVO.getSchoolNo())) {
}else if (StringUtils.isEmpty(schoolStudentVO.getSchoolNo())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、注册序号为空,请您重新输入! ");
} /*else if (StringUtils.isEmpty(schoolStudentVO.getEnrollmentYear())) {
......@@ -587,10 +585,10 @@ public class SchoolStudentServiceImpl extends ServiceImpl<SchoolStudentMapper, S
}*/ else if (StringUtils.isEmpty(schoolStudentVO.getNativePlace())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、籍贯为空,请您重新输入! ");
} else if (StringUtils.isNull(schoolStudentVO.getBirthday())) {
} /*else if (StringUtils.isNull(schoolStudentVO.getBirthday())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、出生日期为空,请您重新输入! ");
} else if (StringUtils.isEmpty(schoolStudentVO.getStudentStatus())) {
}*/ else if (StringUtils.isEmpty(schoolStudentVO.getStudentStatus())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、学生状态为空,请您重新输入! ");
} else if (StringUtils.isEmpty(schoolStudentVO.getStudentType())) {
......@@ -600,6 +598,75 @@ public class SchoolStudentServiceImpl extends ServiceImpl<SchoolStudentMapper, S
failureNum++;
failureMsg.append("<br/>" + failureNum + "、省学籍辅号为空,请您重新输入! ");
} else {
if (StringUtils.isNotEmpty(schoolStudentVO.getNation())){
switch (schoolStudentVO.getNation()){
case "汉族":break;
case "壮族":break;
case "回族":break;
case "满族":break;
case "维吾尔族":break;
case "苗族":break;
case "彝族":break;
case "土家族":break;
case "藏族":break;
case "蒙古族":break;
case "侗族":break;
case "布依族":break;
case "瑶族":break;
case "白族":break;
case "朝鲜族":break;
case "哈尼族":break;
case "黎族":break;
case "哈萨克族":break;
case "傣族":break;
case "畲族":break;
case "傈僳族":break;
case "东乡族":break;
case "仡佬族":break;
case "拉祜族":break;
case "佤族":break;
case "水族":break;
case "纳西族":break;
case "羌族":break;
case "土族":break;
case "仫佬族":break;
case "锡伯族":break;
case "柯尔克孜族":break;
case "景颇族":break;
case "达斡尔族":break;
case "撒拉族":break;
case "布朗族":break;
case "毛南族":break;
case "塔吉克族":break;
case "普米族":break;
case "阿昌族":break;
case "怒族":break;
case "鄂温克族":break;
case "京族":break;
case "基诺族":break;
case "德昂族":break;
case "保安族":break;
case "俄罗斯族":break;
case "裕固族":break;
case "乌孜别克族":break;
case "门巴族":break;
case "鄂伦春族":break;
case "独龙族":break;
case "高山族":break;
case "珞巴族":break;
case "塔塔尔族":break;
default:
failureNum++;
failureMsg.append("<br/>" + failureNum + "、民族格式不正确,请您重新输入! ");
break;
}
}
if (StringUtils.isNotEmpty(schoolStudentVO.getIdCard())){
if (schoolStudentVO.getIdCard().length() != 18 && schoolStudentVO.getIdCard().length() != 15){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、身份证号格式不正确,请您重新输入! ");
}
}
schoolStudentVO.setStudentName(StringUtil.clearSpace(schoolStudentVO.getStudentName()));
schoolStudentVO.setIdCard(StringUtil.clearSpace(schoolStudentVO.getIdCard()));
schoolStudentVO.setProvincialNumber(StringUtil.clearSpace(schoolStudentVO.getProvincialNumber()));
......@@ -749,210 +816,497 @@ public class SchoolStudentServiceImpl extends ServiceImpl<SchoolStudentMapper, S
}
// @Override
// @Transactional(rollbackFor = Exception.class)
// public String importData(List<SchoolStudentDrVo> list) {
// // 准备记录日志数据
// int successNum = 0;
// StringBuilder successMsg = new StringBuilder();
// // 遍历并逐个导入
// for (SchoolStudentDrVo schoolStudentVO : list) {
// /*try {*/
// //按身份证查询,看是否已存在,该查询主要用于判断班级classId是否改变
// LambdaQueryWrapper<SchoolStudent> lqw = new LambdaQueryWrapper<>();
// lqw
// .eq(SchoolStudent::getIdCard, schoolStudentVO.getIdCard())
// ;
// SchoolStudent schoolStudent = schoolStudentMapper.selectOne(lqw);
//
// //学生已存在
// if (isNotNull(schoolStudent)) {
// //再次检验导入的数据中是否有重复省学籍辅号、国家学籍号、注册学号、一卡通
// LambdaQueryWrapper<SchoolStudent> lq = new LambdaQueryWrapper<>();
// lq
// .eq(SchoolStudent::getSchoolNo, schoolStudentVO.getSchoolNo())
// .or()
// .eq(isNotBlank(schoolStudentVO.getProvincialNumber()), SchoolStudent::getProvincialNumber, schoolStudentVO.getProvincialNumber())
// .or()
// .eq(isNotBlank(schoolStudentVO.getNationalNumber()), SchoolStudent::getNationalNumber, schoolStudentVO.getNationalNumber())
// .or()
// .eq(isNotBlank(schoolStudentVO.getOneCard()), SchoolStudent::getOneCard, schoolStudentVO.getOneCard())
// ;
// List<SchoolStudent> ss = schoolStudentMapper.selectList(lq);
// if (StringUtils.isNotNull(ss) && ss.size() > 1) {
// for (SchoolStudent student1 : ss) {
// if (!student1.getId().equals(schoolStudent.getId())) {
// //throw new ServiceException(schoolStudent.getStudentName() + "与" + student1.getStudentName() + "存在重复数据,请您检查后重新输入!");
// if (schoolStudentVO.getSchoolNo().equals(student1.getSchoolNo())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的注册学号与导入文件中" + student1.getStudentName() + "的注册学号重复,请您重新输入!");
// }
//
// if (StringUtils.isNotBlank(schoolStudentVO.getProvincialNumber())) {
// if (schoolStudentVO.getProvincialNumber().equals(student1.getProvincialNumber())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的省学籍辅号与导入文件中" + student1.getStudentName() + "的省学籍辅号重复,请您重新输入!");
// }
// }
//
// if (StringUtils.isNotBlank(schoolStudentVO.getNationalNumber())) {
// if (schoolStudentVO.getNationalNumber().equals(student1.getNationalNumber())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的全国学籍号与导入文件中" + student1.getStudentName() + "的全国学籍号重复,请您重新输入!");
// }
// }
//
// if (StringUtils.isNotBlank(schoolStudentVO.getOneCard())) {
// if (schoolStudentVO.getOneCard().equals(student1.getOneCard())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的一卡通号与导入文件中" + student1.getStudentName() + "的一卡通号重复,请您重新输入!");
// }
// }
// }
// }
// } else {
// if (StringUtils.isNotNull(ss) && ss.size() > 0) {
// SchoolStudent s = ss.get(0);
// //两者查出来的用户不一致时
// if (!schoolStudent.getId().equals(s.getId())) {
// if (schoolStudentVO.getSchoolNo().equals(s.getSchoolNo())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的注册学号与导入文件中" + s.getStudentName() + "的注册学号重复,请您重新输入!");
// }
//
// if (StringUtils.isNotBlank(schoolStudentVO.getProvincialNumber())) {
// if (schoolStudentVO.getProvincialNumber().equals(s.getProvincialNumber())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的省学籍辅号与导入文件中" + s.getStudentName() + "的省学籍辅号重复,请您重新输入!");
// }
// }
//
// if (StringUtils.isNotBlank(schoolStudentVO.getNationalNumber())) {
// if (schoolStudentVO.getNationalNumber().equals(s.getNationalNumber())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的全国学籍号与导入文件中" + s.getStudentName() + "的全国学籍号重复,请您重新输入!");
// }
// }
//
// if (StringUtils.isNotBlank(schoolStudentVO.getOneCard())) {
// if (schoolStudentVO.getOneCard().equals(s.getOneCard())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的一卡通号与导入文件中" + s.getStudentName() + "的一卡通号重复,请您重新输入!");
// }
// }
// }
//
// }
// }
//
//
// //班级都存在
// if (isNotNull(schoolStudentVO.getClassId()) && isNotNull(schoolStudent.getClassId())) {
// //班级id都存在,看是否发生改变
// if (!schoolStudentVO.getClassId().equals(schoolStudent.getClassId())) {
// LambdaQueryWrapper<SchoolStudentClassRelation> l = new LambdaQueryWrapper<>();
// l.eq(SchoolStudentClassRelation::getClassId, schoolStudent.getClassId())
// .eq(SchoolStudentClassRelation::getStudentId, schoolStudent.getId());
// relationMapper.delete(l);
// addRelation(schoolStudentVO.getClassId(), schoolStudent.getId());
// }
// }
// //之前没有班级,现在已有
// if (isNotNull(schoolStudentVO.getClassId()) && isNull(schoolStudent.getClassId())) {
// addRelation(schoolStudentVO.getClassId(), schoolStudent.getId());
// }
// //此方法会整掉原有学生id
// //BeanUtils.copyProperties(schoolStudentVO, schoolStudent);
//
// if (schoolStudentMapper.updateById(copyStudent(schoolStudentVO, schoolStudent)) > 0) {
// //检查学生父母信息
// addParent(schoolStudentVO, schoolStudent.getId());
//
// }
// } else {
// /* if (MAN.equals(schoolStudentVO.getSex())) {
// schoolStudentVO.setAvatar("https://eos-wuxi-1.cmecloud.cn/dy-pro/image/2022/08/09/b076ed42bfca4a8cae062dfffd5f3618.jpg");
// } else {
// schoolStudentVO.setAvatar("https://eos-wuxi-1.cmecloud.cn/dy-pro/image/2022/08/09/8a6c1334494d418d8a53cc7bf5abd668.jpg");
// }*/
// //检验省学籍辅号、国家学籍号、注册学号是否存在
// LambdaQueryWrapper<SchoolStudent> l = new LambdaQueryWrapper<>();
// l
// .eq(SchoolStudent::getSchoolNo, schoolStudentVO.getSchoolNo())
// .or()
// .eq(isNotBlank(schoolStudentVO.getProvincialNumber()), SchoolStudent::getProvincialNumber, schoolStudentVO.getProvincialNumber())
// .or()
// .eq(isNotBlank(schoolStudentVO.getNationalNumber()), SchoolStudent::getNationalNumber, schoolStudentVO.getNationalNumber())
// .or()
// .eq(isNotBlank(schoolStudentVO.getOneCard()), SchoolStudent::getOneCard, schoolStudentVO.getOneCard())
// ;
// List<SchoolStudent> ss = schoolStudentMapper.selectList(l);
// if (StringUtils.isNotNull(ss) && ss.size() > 1) {
// for (SchoolStudent student1 : ss) {
// if (!student1.getId().equals(schoolStudent.getId())) {
// if (schoolStudentVO.getSchoolNo().equals(student1.getSchoolNo())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的注册学号与导入文件中" + student1.getStudentName() + "的注册学号重复,请您重新输入!");
// }
//
// if (StringUtils.isNotBlank(schoolStudentVO.getProvincialNumber())) {
// if (schoolStudentVO.getProvincialNumber().equals(student1.getProvincialNumber())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的省学籍辅号与导入文件中" + student1.getStudentName() + "的省学籍辅号重复,请您重新输入!");
// }
// }
//
// if (StringUtils.isNotBlank(schoolStudentVO.getNationalNumber())) {
// if (schoolStudentVO.getNationalNumber().equals(student1.getNationalNumber())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的全国学籍号与导入文件中" + student1.getStudentName() + "的全国学籍号重复,请您重新输入!");
// }
// }
//
// if (StringUtils.isNotBlank(schoolStudentVO.getOneCard())) {
// if (schoolStudentVO.getOneCard().equals(student1.getOneCard())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的一卡通号与导入文件中" + student1.getStudentName() + "的一卡通号重复,请您重新输入!");
// }
// }
// }
// }
// }else{
// if (StringUtils.isNotNull(ss) && ss.size() > 0) {
// SchoolStudent s = ss.get(0);
// //两者查出来的用户不一致时
// if (schoolStudentVO.getSchoolNo().equals(s.getSchoolNo())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的注册学号与导入文件中" + s.getStudentName() + "的注册学号重复,请您重新输入!");
// }
//
// if (StringUtils.isNotBlank(schoolStudentVO.getProvincialNumber())) {
// if (schoolStudentVO.getProvincialNumber().equals(s.getProvincialNumber())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的省学籍辅号与导入文件中" + s.getStudentName() + "的省学籍辅号重复,请您重新输入!");
// }
// }
//
// if (StringUtils.isNotBlank(schoolStudentVO.getNationalNumber())) {
// if (schoolStudentVO.getNationalNumber().equals(s.getNationalNumber())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的全国学籍号与导入文件中" + s.getStudentName() + "的全国学籍号重复,请您重新输入!");
// }
// }
//
// if (StringUtils.isNotBlank(schoolStudentVO.getOneCard())) {
// if (schoolStudentVO.getOneCard().equals(s.getOneCard())) {
// throw new ServiceException(schoolStudentVO.getStudentName() + "的一卡通号与导入文件中" + s.getStudentName() + "的一卡通号重复,请您重新输入!");
// }
// }
// }
// }
//
// // TODO 新增
// //设置该同学性别
// schoolStudentVO.setSex(String.valueOf(getSexFromIdCard(schoolStudentVO.getIdCard())));
// //设置该同学出生日期
// schoolStudentVO.setBirthday(getBirthDayFromIdCard(schoolStudentVO.getIdCard()));
//
// SchoolStudent student = new SchoolStudent();
// BeanUtils.copyProperties(schoolStudentVO, student);
// if (schoolStudentMapper.insert(student) > 0) {
// if (isNotNull(schoolStudentVO.getClassId())) {
// addRelation(schoolStudentVO.getClassId(), student.getId());
// }
// addParent(schoolStudentVO, student.getId());
//
// }
// }
// successNum++;
// successMsg.append("<br/>" + successNum + "数据" + " 导入成功");
// /*} catch (Exception e) {
// throw new ServiceException("导入失败");
// }*/
// }
// successMsg.insert(0, "恭喜您,数据已导入成功!共有 " + successNum + " 条,数据如下:");
// return successMsg.toString();
// }
@Override
@Transactional(rollbackFor = Exception.class)
public String importData(List<SchoolStudentVO> list) {
public String importData(List<SchoolStudentVO> list){
// 准备记录日志数据
int successNum = 0;
StringBuilder successMsg = new StringBuilder();
// 遍历并逐个导入
for (SchoolStudentVO schoolStudentVO : list) {
/*try {*/
//按身份证查询,看是否已存在,该查询主要用于判断班级classId是否改变
LambdaQueryWrapper<SchoolStudent> lqw = new LambdaQueryWrapper<>();
lqw
.eq(SchoolStudent::getIdCard, schoolStudentVO.getIdCard())
;
SchoolStudent schoolStudent = schoolStudentMapper.selectOne(lqw);
//查询全部学生
LambdaQueryWrapper<SchoolStudent> lqw = new LambdaQueryWrapper<>();
List<SchoolStudent> schoolStudents = schoolStudentMapper.selectList(lqw);
//查询所有班级学生对应关系
LambdaQueryWrapper<SchoolStudentClassRelation> relationWrapper = new LambdaQueryWrapper<>();
List<SchoolStudentClassRelation> classRelations = relationMapper.selectList(relationWrapper);
//查询所有学生父母
LambdaQueryWrapper<SchoolStudentParent> parentWrapper = new LambdaQueryWrapper<>();
List<SchoolStudentParent> studentParents = schoolStudentParentMapper.selectList(parentWrapper);
//学生集合
List<SchoolStudent> addList = new ArrayList<>();
List<SchoolStudent> updateList = new ArrayList<>();
//学生与班级对应关系集合
List<SchoolStudentClassRelation> updateRelationList = new ArrayList<>();
List<SchoolStudentClassRelation> addRelationList = new ArrayList<>();
List<SchoolStudentClassRelation> addRelationListX = new ArrayList<>();
//学生家长集合
List<SchoolStudentParent> updateParentList = new ArrayList<>();
List<SchoolStudentParent> addParentList = new ArrayList<>();
List<SchoolStudentParent> addParentListX = new ArrayList<>();
//用户集合
List<SysUser> addUserList = new ArrayList<>();
List<SysUser> addUserListX = new ArrayList<>();
List<SysUser> updateUserList = new ArrayList<>();
//校验学生数据
for (SchoolStudentVO schoolStudentDrVo : list) {
//按身份证查询,看是否已存在,该查询主要用于判断班级classId是否改变
SchoolStudent student = new SchoolStudent();
for (SchoolStudent schoolStudent : schoolStudents) {
if (schoolStudentDrVo.getIdCard().equals(schoolStudent.getIdCard())){
BeanUtils.copyProperties(schoolStudent,student);
}
}
//学生已存在
if (isNotNull(schoolStudent)) {
//再次检验导入的数据中是否有重复省学籍辅号、国家学籍号、注册学号、一卡通
LambdaQueryWrapper<SchoolStudent> lq = new LambdaQueryWrapper<>();
lq
.eq(SchoolStudent::getSchoolNo, schoolStudentVO.getSchoolNo())
.or()
.eq(isNotBlank(schoolStudentVO.getProvincialNumber()), SchoolStudent::getProvincialNumber, schoolStudentVO.getProvincialNumber())
.or()
.eq(isNotBlank(schoolStudentVO.getNationalNumber()), SchoolStudent::getNationalNumber, schoolStudentVO.getNationalNumber())
.or()
.eq(isNotBlank(schoolStudentVO.getOneCard()), SchoolStudent::getOneCard, schoolStudentVO.getOneCard())
;
List<SchoolStudent> ss = schoolStudentMapper.selectList(lq);
if (StringUtils.isNotNull(ss) && ss.size() > 1) {
for (SchoolStudent student1 : ss) {
if (!student1.getId().equals(schoolStudent.getId())) {
//throw new ServiceException(schoolStudent.getStudentName() + "与" + student1.getStudentName() + "存在重复数据,请您检查后重新输入!");
if (schoolStudentVO.getSchoolNo().equals(student1.getSchoolNo())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的注册学号与导入文件中" + student1.getStudentName() + "的注册学号重复,请您重新输入!");
}
if (StringUtils.isNotBlank(schoolStudentVO.getProvincialNumber())) {
if (schoolStudentVO.getProvincialNumber().equals(student1.getProvincialNumber())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的省学籍辅号与导入文件中" + student1.getStudentName() + "的省学籍辅号重复,请您重新输入!");
}
}
if (StringUtils.isNotBlank(schoolStudentVO.getNationalNumber())) {
if (schoolStudentVO.getNationalNumber().equals(student1.getNationalNumber())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的全国学籍号与导入文件中" + student1.getStudentName() + "的全国学籍号重复,请您重新输入!");
}
}
if (StringUtils.isNotBlank(schoolStudentVO.getOneCard())) {
if (schoolStudentVO.getOneCard().equals(student1.getOneCard())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的一卡通号与导入文件中" + student1.getStudentName() + "的一卡通号重复,请您重新输入!");
}
if (isNotNull(student.getId())){
//班级都存在
if (StringUtils.isNotNull(schoolStudentDrVo.getClassId()) && StringUtils.isNotNull(student.getClassId())){
//班级id都存在,看是否发生改变
if (!schoolStudentDrVo.getClassId().equals(student.getClassId())){
for (SchoolStudentClassRelation relation : classRelations) {
if (student.getId().equals(relation.getStudentId()) && student.getClassId().equals(relation.getClassId())){
relation.setClassId(schoolStudentDrVo.getClassId());
updateRelationList.add(relation);
}
}
}
} else {
if (StringUtils.isNotNull(ss) && ss.size() > 0) {
SchoolStudent s = ss.get(0);
//两者查出来的用户不一致时
if (!schoolStudent.getId().equals(s.getId())) {
if (schoolStudentVO.getSchoolNo().equals(s.getSchoolNo())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的注册学号与导入文件中" + s.getStudentName() + "的注册学号重复,请您重新输入!");
}
if (StringUtils.isNotBlank(schoolStudentVO.getProvincialNumber())) {
if (schoolStudentVO.getProvincialNumber().equals(s.getProvincialNumber())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的省学籍辅号与导入文件中" + s.getStudentName() + "的省学籍辅号重复,请您重新输入!");
}
}
if (StringUtils.isNotBlank(schoolStudentVO.getNationalNumber())) {
if (schoolStudentVO.getNationalNumber().equals(s.getNationalNumber())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的全国学籍号与导入文件中" + s.getStudentName() + "的全国学籍号重复,请您重新输入!");
}
}
if (StringUtils.isNotBlank(schoolStudentVO.getOneCard())) {
if (schoolStudentVO.getOneCard().equals(s.getOneCard())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的一卡通号与导入文件中" + s.getStudentName() + "的一卡通号重复,请您重新输入!");
}
}
}
//之前没有班级,现在已有
if (isNotNull(schoolStudentDrVo.getClassId()) && isNull(student.getClassId())) {
SchoolStudentClassRelation relation = new SchoolStudentClassRelation();
relation.setStudentId(student.getId());
relation.setClassId(schoolStudentDrVo.getClassId());
addRelationList.add(relation);
}
//检查学生父母信息
SchoolStudentParent studentParent1 = new SchoolStudentParent();
SchoolStudentParent studentParent2 = new SchoolStudentParent();
for (SchoolStudentParent studentParent : studentParents) {
if(!(schoolStudentDrVo.getParentName1().equals("")) && !(schoolStudentDrVo.getTelephone1().equals(""))){
if (student.getId().equals(studentParent.getStudentId()) && schoolStudentDrVo.getTelephone1().equals(studentParent.getTelephone())){
BeanUtils.copyProperties(studentParent,studentParent1);
}
}
}
//班级都存在
if (isNotNull(schoolStudentVO.getClassId()) && isNotNull(schoolStudent.getClassId())) {
//班级id都存在,看是否发生改变
if (!schoolStudentVO.getClassId().equals(schoolStudent.getClassId())) {
LambdaQueryWrapper<SchoolStudentClassRelation> l = new LambdaQueryWrapper<>();
l.eq(SchoolStudentClassRelation::getClassId, schoolStudent.getClassId())
.eq(SchoolStudentClassRelation::getStudentId, schoolStudent.getId());
relationMapper.delete(l);
addRelation(schoolStudentVO.getClassId(), schoolStudent.getId());
if(!(schoolStudentDrVo.getParentName2().equals("")) && !(schoolStudentDrVo.getTelephone2().equals(""))){
if (student.getId().equals(studentParent.getStudentId()) && schoolStudentDrVo.getTelephone2().equals(studentParent.getTelephone())){
BeanUtils.copyProperties(studentParent,studentParent2);
}
}
}
//之前没有班级,现在已有
if (isNotNull(schoolStudentVO.getClassId()) && isNull(schoolStudent.getClassId())) {
addRelation(schoolStudentVO.getClassId(), schoolStudent.getId());
if(!(schoolStudentDrVo.getParentName1().equals("")) && !(schoolStudentDrVo.getTelephone1().equals(""))){
if (StringUtils.isNotEmpty(studentParent1.getParentName())){
//存在更新家长信息
studentParent1.setParentName(StringUtil.clearSpace(schoolStudentDrVo.getParentName1()));
studentParent1.setRelationship(schoolStudentDrVo.getRelationship1());
studentParent1.setWorkAddress(schoolStudentDrVo.getWorkAddress1());
studentParent1.setContactAddress(schoolStudentDrVo.getContactAddress1());
studentParent1.setPostalCode(schoolStudentDrVo.getPostalCode1());
updateParentList.add(studentParent1);
SysUser user = new SysUser();
user.setUserId(studentParent1.getUserId());
user.setUserName(StringUtil.clearSpace(schoolStudentDrVo.getParentName1()));
updateUserList.add(user);
}else {
//不存在,新增用户表
//新增进用户表
SysUser user = new SysUser();
user.setUserLoginType(PARENT);
user.setUserName(StringUtil.clearSpace(schoolStudentDrVo.getParentName1()));
user.setPhonenumber(StringUtil.clearSpace(schoolStudentDrVo.getTelephone1()));
user.setStudentId(student.getId());
addUserList.add(user);
//新增进家长表
SchoolStudentParent parent = new SchoolStudentParent();
parent.setParentName(StringUtil.clearSpace(schoolStudentDrVo.getParentName1()));
parent.setRelationship(schoolStudentDrVo.getRelationship1());
parent.setWorkAddress(schoolStudentDrVo.getWorkAddress1());
parent.setContactAddress(schoolStudentDrVo.getContactAddress1());
parent.setTelephone(StringUtil.clearSpace(schoolStudentDrVo.getTelephone1()));
parent.setPostalCode(schoolStudentDrVo.getPostalCode1());
// parent.setUserId(user.getUserId());
parent.setStudentId(student.getId());
addParentList.add(parent);
}
}
//此方法会整掉原有学生id
//BeanUtils.copyProperties(schoolStudentVO, schoolStudent);
if (schoolStudentMapper.updateById(copyStudent(schoolStudentVO, schoolStudent)) > 0) {
//检查学生父母信息
addParent(schoolStudentVO, schoolStudent.getId());
if(!(schoolStudentDrVo.getParentName2().equals("")) && !(schoolStudentDrVo.getTelephone2().equals(""))){
//存在更新家长信息
if (StringUtils.isNotEmpty(studentParent2.getParentName())){
studentParent2.setParentName(StringUtil.clearSpace(schoolStudentDrVo.getParentName2()));
studentParent2.setRelationship(schoolStudentDrVo.getRelationship2());
studentParent2.setWorkAddress(schoolStudentDrVo.getWorkAddress2());
studentParent2.setContactAddress(schoolStudentDrVo.getContactAddress2());
studentParent2.setPostalCode(schoolStudentDrVo.getPostalCode2());
updateParentList.add(studentParent2);
SysUser user = new SysUser();
user.setUserId(studentParent2.getUserId());
user.setUserName(StringUtil.clearSpace(schoolStudentDrVo.getParentName2()));
updateUserList.add(user);
}else {
//不存在,新增用户表
//新增进用户表
SysUser user = new SysUser();
user.setUserLoginType(PARENT);
user.setUserName(StringUtil.clearSpace(schoolStudentDrVo.getParentName2()));
user.setPhonenumber(StringUtil.clearSpace(schoolStudentDrVo.getTelephone2()));
user.setStudentId(student.getId());
addUserList.add(user);
//新增进家长表
SchoolStudentParent parent = new SchoolStudentParent();
parent.setParentName(StringUtil.clearSpace(schoolStudentDrVo.getParentName2()));
parent.setRelationship(schoolStudentDrVo.getRelationship2());
parent.setWorkAddress(schoolStudentDrVo.getWorkAddress2());
parent.setContactAddress(schoolStudentDrVo.getContactAddress2());
parent.setTelephone(StringUtil.clearSpace(schoolStudentDrVo.getTelephone2()));
parent.setPostalCode(schoolStudentDrVo.getPostalCode2());
// parent.setUserId(user.getUserId());
parent.setStudentId(student.getId());
addParentList.add(parent);
}
}
} else {
/* if (MAN.equals(schoolStudentVO.getSex())) {
schoolStudentVO.setAvatar("https://eos-wuxi-1.cmecloud.cn/dy-pro/image/2022/08/09/b076ed42bfca4a8cae062dfffd5f3618.jpg");
} else {
schoolStudentVO.setAvatar("https://eos-wuxi-1.cmecloud.cn/dy-pro/image/2022/08/09/8a6c1334494d418d8a53cc7bf5abd668.jpg");
}*/
//检验省学籍辅号、国家学籍号、注册学号是否存在
LambdaQueryWrapper<SchoolStudent> l = new LambdaQueryWrapper<>();
l
.eq(SchoolStudent::getSchoolNo, schoolStudentVO.getSchoolNo())
.or()
.eq(isNotBlank(schoolStudentVO.getProvincialNumber()), SchoolStudent::getProvincialNumber, schoolStudentVO.getProvincialNumber())
.or()
.eq(isNotBlank(schoolStudentVO.getNationalNumber()), SchoolStudent::getNationalNumber, schoolStudentVO.getNationalNumber())
.or()
.eq(isNotBlank(schoolStudentVO.getOneCard()), SchoolStudent::getOneCard, schoolStudentVO.getOneCard())
;
List<SchoolStudent> ss = schoolStudentMapper.selectList(l);
if (StringUtils.isNotNull(ss) && ss.size() > 1) {
for (SchoolStudent student1 : ss) {
if (!student1.getId().equals(schoolStudent.getId())) {
if (schoolStudentVO.getSchoolNo().equals(student1.getSchoolNo())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的注册学号与导入文件中" + student1.getStudentName() + "的注册学号重复,请您重新输入!");
}
if (StringUtils.isNotBlank(schoolStudentVO.getProvincialNumber())) {
if (schoolStudentVO.getProvincialNumber().equals(student1.getProvincialNumber())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的省学籍辅号与导入文件中" + student1.getStudentName() + "的省学籍辅号重复,请您重新输入!");
}
}
if (StringUtils.isNotBlank(schoolStudentVO.getNationalNumber())) {
if (schoolStudentVO.getNationalNumber().equals(student1.getNationalNumber())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的全国学籍号与导入文件中" + student1.getStudentName() + "的全国学籍号重复,请您重新输入!");
}
}
updateList.add(copyStudent(schoolStudentDrVo,student));
}else {
//设置该同学性别
schoolStudentDrVo.setSex(String.valueOf(getSexFromIdCard(schoolStudentDrVo.getIdCard())));
//设置该同学出生日期
schoolStudentDrVo.setBirthday(getBirthDayFromIdCard(schoolStudentDrVo.getIdCard()));
if (StringUtils.isNotBlank(schoolStudentVO.getOneCard())) {
if (schoolStudentVO.getOneCard().equals(student1.getOneCard())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的一卡通号与导入文件中" + student1.getStudentName() + "的一卡通号重复,请您重新输入!");
}
}
}
//新增学生
SchoolStudent schoolStudent = new SchoolStudent();
BeanUtils.copyProperties(schoolStudentDrVo, schoolStudent);
addList.add(schoolStudent);
}
}
if (addList.size()>0){
//新增学生
schoolStudentMapper.inserStudentList(addList);
//为新增学生添加班级关系
for (SchoolStudent schoolStudent : addList) {
SchoolStudentClassRelation relation = new SchoolStudentClassRelation();
relation.setStudentId(schoolStudent.getId());
relation.setClassId(schoolStudent.getClassId());
addRelationListX.add(relation);
}
relationMapper.addRelationList(addRelationListX);
}
if (updateList.size()>0){
//更新学生信息
schoolStudentMapper.updateStudentList(updateList);
}
if (updateRelationList.size()>0){
//更新学生与班级关系
relationMapper.updateRelationList(updateRelationList);
}
if (addRelationList.size()>0){
//新增学生与班级关系
relationMapper.addRelationList(addRelationList);
}
if (updateParentList.size()>0){
//更新学生家长信息
schoolStudentParentMapper.updateParentList(updateParentList);
}
if (updateUserList.size()>0){
//更新用户表
userMapper.updateUserList(updateUserList);
}
if (addUserList.size()>0){
//学生存在
//新增用户表
userMapper.addUserList(addUserList);
for (SysUser sysUser : addUserList) {
for (SchoolStudentParent parent : addParentList) {
if (parent.getParentName().equals(sysUser.getUserName()) && parent.getStudentId().equals(sysUser.getStudentId()) && parent.getTelephone().equals(sysUser.getPhonenumber())){
parent.setUserId(sysUser.getUserId());
}
}else{
if (StringUtils.isNotNull(ss) && ss.size() > 0) {
SchoolStudent s = ss.get(0);
//两者查出来的用户不一致时
if (schoolStudentVO.getSchoolNo().equals(s.getSchoolNo())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的注册学号与导入文件中" + s.getStudentName() + "的注册学号重复,请您重新输入!");
}
if (StringUtils.isNotBlank(schoolStudentVO.getProvincialNumber())) {
if (schoolStudentVO.getProvincialNumber().equals(s.getProvincialNumber())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的省学籍辅号与导入文件中" + s.getStudentName() + "的省学籍辅号重复,请您重新输入!");
}
}
if (StringUtils.isNotBlank(schoolStudentVO.getNationalNumber())) {
if (schoolStudentVO.getNationalNumber().equals(s.getNationalNumber())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的全国学籍号与导入文件中" + s.getStudentName() + "的全国学籍号重复,请您重新输入!");
}
}
}
//新增学生家长信息
schoolStudentParentMapper.addParentList(addParentList);
}
if (addList.size()>0){
//学生不存在
for (SchoolStudentVO schoolStudentDrVo : list) {
for (SchoolStudent schoolStudent : addList) {
if (schoolStudent.getIdCard().equals(schoolStudentDrVo.getIdCard())){
if(!(schoolStudentDrVo.getParentName1().equals("")) && !(schoolStudentDrVo.getTelephone1().equals(""))){
SysUser user = new SysUser();
user.setUserLoginType(PARENT);
user.setUserName(StringUtil.clearSpace(schoolStudentDrVo.getParentName1()));
user.setPhonenumber(StringUtil.clearSpace(schoolStudentDrVo.getTelephone1()));
user.setStudentId(schoolStudent.getId());
addUserListX.add(user);
//新增进家长表
SchoolStudentParent parent = new SchoolStudentParent();
parent.setParentName(StringUtil.clearSpace(schoolStudentDrVo.getParentName1()));
parent.setRelationship(schoolStudentDrVo.getRelationship1());
parent.setWorkAddress(schoolStudentDrVo.getWorkAddress1());
parent.setContactAddress(schoolStudentDrVo.getContactAddress1());
parent.setTelephone(StringUtil.clearSpace(schoolStudentDrVo.getTelephone1()));
parent.setPostalCode(schoolStudentDrVo.getPostalCode1());
// parent.setUserId(user.getUserId());
// parent.setStudentId(student.getId());
addParentListX.add(parent);
}
if (StringUtils.isNotBlank(schoolStudentVO.getOneCard())) {
if (schoolStudentVO.getOneCard().equals(s.getOneCard())) {
throw new ServiceException(schoolStudentVO.getStudentName() + "的一卡通号与导入文件中" + s.getStudentName() + "的一卡通号重复,请您重新输入!");
}
if(!(schoolStudentDrVo.getParentName2().equals("")) && !(schoolStudentDrVo.getTelephone2().equals(""))){
SysUser user = new SysUser();
user.setUserLoginType(PARENT);
user.setUserName(StringUtil.clearSpace(schoolStudentDrVo.getParentName2()));
user.setPhonenumber(StringUtil.clearSpace(schoolStudentDrVo.getTelephone2()));
user.setStudentId(schoolStudent.getId());
addUserListX.add(user);
//新增进家长表
SchoolStudentParent parent = new SchoolStudentParent();
parent.setParentName(StringUtil.clearSpace(schoolStudentDrVo.getParentName2()));
parent.setRelationship(schoolStudentDrVo.getRelationship2());
parent.setWorkAddress(schoolStudentDrVo.getWorkAddress2());
parent.setContactAddress(schoolStudentDrVo.getContactAddress2());
parent.setTelephone(StringUtil.clearSpace(schoolStudentDrVo.getTelephone2()));
parent.setPostalCode(schoolStudentDrVo.getPostalCode2());
// parent.setUserId(user.getUserId());
// parent.setStudentId(student.getId());
addParentListX.add(parent);
}
}
}
SchoolStudent student = new SchoolStudent();
BeanUtils.copyProperties(schoolStudentVO, student);
if (schoolStudentMapper.insert(student) > 0) {
if (isNotNull(schoolStudentVO.getClassId())) {
addRelation(schoolStudentVO.getClassId(), student.getId());
}
if (addUserListX.size()>0){
//新增用户表
userMapper.addUserList(addUserListX);
for (SysUser sysUser : addUserListX) {
for (SchoolStudentParent parent : addParentListX) {
if (parent.getParentName().equals(sysUser.getUserName()) && parent.getStudentId().equals(sysUser.getStudentId()) && parent.getTelephone().equals(sysUser.getPhonenumber())){
parent.setUserId(sysUser.getUserId());
}
}
addParent(schoolStudentVO, student.getId());
}
//新增学生家长信息
schoolStudentParentMapper.addParentList(addParentListX);
}
successNum++;
successMsg.append("<br/>" + successNum + "数据" + " 导入成功");
/*} catch (Exception e) {
throw new ServiceException("导入失败");
}*/
}
successMsg.insert(0, "恭喜您,数据已导入成功!共有 " + successNum + " 条,数据如下:");
successMsg.insert(0, "恭喜您,数据已导入成功!");
return successMsg.toString();
}
//添加学生与班级关系表
private boolean addRelation(Long classId, Long studentId) {
SchoolStudentClassRelation relation = new SchoolStudentClassRelation();
......@@ -1130,10 +1484,10 @@ public class SchoolStudentServiceImpl extends ServiceImpl<SchoolStudentMapper, S
//学生赋值
public SchoolStudent copyStudent(SchoolStudentVO vo, SchoolStudent student) {
//student.setStudentName(StringUtil.clearSpace(vo.getStudentName()));
student.setSex(vo.getSex());
student.setSex(String.valueOf(getSexFromIdCard(StringUtil.clearSpace(vo.getIdCard()))));
student.setClassId(vo.getClassId());
//student.setIdCard(StringUtil.clearSpace(vo.getIdCard()));
student.setBirthday(vo.getBirthday());
student.setBirthday(getBirthDayFromIdCard(StringUtil.clearSpace(vo.getIdCard())));
//student.setNation(vo.getNation());
student.setStuTelephone(vo.getStuTelephone());
student.setPostalCode(vo.getPostalCode());
......@@ -1167,6 +1521,55 @@ public class SchoolStudentServiceImpl extends ServiceImpl<SchoolStudentMapper, S
return student;
}
/**
* 获取出生日期
*
* @return 返回日期格式
*/
// TODO 新加
public static Date getBirthDayFromIdCard(String idCard) {
Date birth = null;
if (idCard.length() == 18) {
String year = idCard.substring(6).substring(0, 4);// 得到年份
String month = idCard.substring(10).substring(0, 2);// 得到月份
String day = idCard.substring(12).substring(0, 2);// 得到日
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
DateUtils.parseDate(year + "-" + month + "-" + day);
} else if (idCard.length() == 15) {
String year = "19" + idCard.substring(6, 8);// 年份
String month = idCard.substring(8, 10);// 月份
String day = idCard.substring(10, 12);// 得到日
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
DateUtils.parseDate(year + "-" + month + "-" + day);
}
return birth;
}
/**
* 获取性别
* 0=未知的性别,9=未说明的性别,2=女性,1=男性
* @return int
*/
// TODO 新加
public static int getSexFromIdCard(String idCard) {
int sex = 0;
if (idCard.length() == 18) {
if (Integer.parseInt(idCard.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
sex = 1; // 女
} else {
sex = 0; // 男
}
} else if (idCard.length() == 15) {
String usex = idCard.substring(14, 15);// 用户的性别
if (Integer.parseInt(usex) % 2 == 0) {
sex = 1; // 女
} else {
sex = 0; // 男
}
}
return sex;
}
@Override
public List<SchoolStudentVO> getList(SchoolStudentVO schoolStudent) {
return schoolStudentMapper.queryList(schoolStudent);
......
......@@ -30,6 +30,7 @@ import yangtz.cs.liu.campus.domain.time.*;
import yangtz.cs.liu.campus.mapper.course.SchoolCourseMapper;
import yangtz.cs.liu.campus.mapper.schoolClass.SchoolClassMapper;
import yangtz.cs.liu.campus.mapper.schoolClass.SchoolClassMentorMapper;
import yangtz.cs.liu.campus.mapper.schoolgrade.SchoolGradeMapper;
import yangtz.cs.liu.campus.mapper.student.SchoolStudentMapper;
import yangtz.cs.liu.campus.mapper.student.SchoolStudentParentMapper;
import yangtz.cs.liu.campus.mapper.time.SchoolTimeDetailMapper;
......@@ -86,6 +87,9 @@ public class SchoolTimeTableServiceImpl extends ServiceImpl<SchoolTimeTableMappe
private SchoolClassMentorMapper classMentorMapper;
@Autowired
private SchoolGradeMapper gradeMapper;
@Autowired
private ISchoolCurriculumService schoolCurriculumService;
public static final String USE = "1";
......@@ -278,7 +282,9 @@ public class SchoolTimeTableServiceImpl extends ServiceImpl<SchoolTimeTableMappe
@Override
public List<TableVO> getTeacherTable(Long teacherId){
//获取当前教师所授课班级(当前学年)
int schoolYear = HolidayDateUtil.getSchoolYear();
// int schoolYear = HolidayDateUtil.getSchoolYear();
// TODO 修改最新学年
int schoolYear = gradeMapper.isNewSchoolYear();
List<SchoolClassMentor> mentorList = classMentorMapper.getMentorByTeacherId(teacherId,schoolYear);
if(isNull(mentorList)){
return new ArrayList<>();
......@@ -331,6 +337,13 @@ public class SchoolTimeTableServiceImpl extends ServiceImpl<SchoolTimeTableMappe
//设置本节次星期一到星期日的课程
public TableVO setCourse(Long teacherId,TableVO vo,List<SchoolTimeTable> tableList){
List<SchoolCourseVO> listMonday = new ArrayList<>();
List<SchoolCourseVO> listTuesday = new ArrayList<>();
List<SchoolCourseVO> listWednesday = new ArrayList<>();
List<SchoolCourseVO> listThursday = new ArrayList<>();
List<SchoolCourseVO> listFriday = new ArrayList<>();
List<SchoolCourseVO> listSaturday = new ArrayList<>();
List<SchoolCourseVO> listSunday = new ArrayList<>();
for(SchoolTimeTable table : tableList){
SchoolCourseVO courseVO = new SchoolCourseVO();
courseVO.setId(table.getCourseId());
......@@ -345,20 +358,118 @@ public class SchoolTimeTableServiceImpl extends ServiceImpl<SchoolTimeTableMappe
switch (table.getWeekValue()){
case 1:
vo.setMonday(courseVO);break;
// vo.setMonday(courseVO);break;
listMonday.add(courseVO);break;
case 2:
vo.setTuesday(courseVO);break;
// vo.setTuesday(courseVO);break;
listTuesday.add(courseVO);break;
case 3:
vo.setWednesday(courseVO);break;
// vo.setWednesday(courseVO);break;
listWednesday.add(courseVO);break;
case 4:
vo.setThursday(courseVO);break;
// vo.setThursday(courseVO);break;
listThursday.add(courseVO);break;
case 5:
vo.setFriday(courseVO);break;
// vo.setFriday(courseVO);break;
listFriday.add(courseVO);break;
case 6:
vo.setSaturday(courseVO);break;
// vo.setSaturday(courseVO);break;
listSaturday.add(courseVO);break;
case 7:
vo.setSunday(courseVO);break;
// vo.setSunday(courseVO);break;
listSunday.add(courseVO);break;
}
}
if (listMonday.size() > 0){
SchoolCourseVO courseVO = new SchoolCourseVO();
String courseName = "";
for (int i = 0; i < listMonday.size(); i++) {
if (i == listMonday.size() - 1){
courseName += listMonday.get(i).getCourseName();
}else {
courseName += listMonday.get(i).getCourseName() + "、";
}
}
courseVO.setCourseName(courseName);
vo.setMonday(courseVO);
}
if (listTuesday.size() > 0){
SchoolCourseVO courseVO = new SchoolCourseVO();
String courseName = "";
for (int i = 0; i < listTuesday.size(); i++) {
if (i == listTuesday.size() - 1){
courseName += listTuesday.get(i).getCourseName();
}else {
courseName += listTuesday.get(i).getCourseName() + "、";
}
}
courseVO.setCourseName(courseName);
vo.setTuesday(courseVO);
}
if (listWednesday.size() > 0){
SchoolCourseVO courseVO = new SchoolCourseVO();
String courseName = "";
for (int i = 0; i < listWednesday.size(); i++) {
if (i == listWednesday.size() - 1){
courseName += listWednesday.get(i).getCourseName();
}else {
courseName += listWednesday.get(i).getCourseName() + "、";
}
}
courseVO.setCourseName(courseName);
vo.setWednesday(courseVO);
}
if (listThursday.size() > 0){
SchoolCourseVO courseVO = new SchoolCourseVO();
String courseName = "";
for (int i = 0; i < listThursday.size(); i++) {
if (i == listThursday.size() - 1){
courseName += listThursday.get(i).getCourseName();
}else {
courseName += listThursday.get(i).getCourseName() + "、";
}
}
courseVO.setCourseName(courseName);
vo.setThursday(courseVO);
}
if (listFriday.size() > 0){
SchoolCourseVO courseVO = new SchoolCourseVO();
String courseName = "";
for (int i = 0; i < listFriday.size(); i++) {
if (i == listFriday.size() - 1){
courseName += listFriday.get(i).getCourseName();
}else {
courseName += listFriday.get(i).getCourseName() + "、";
}
}
courseVO.setCourseName(courseName);
vo.setFriday(courseVO);
}
if (listSaturday.size() > 0){
SchoolCourseVO courseVO = new SchoolCourseVO();
String courseName = "";
for (int i = 0; i < listSaturday.size(); i++) {
if (i == listSaturday.size() - 1){
courseName += listSaturday.get(i).getCourseName();
}else {
courseName += listSaturday.get(i).getCourseName() + "、";
}
}
courseVO.setCourseName(courseName);
vo.setSaturday(courseVO);
}
if (listSunday.size() > 0){
SchoolCourseVO courseVO = new SchoolCourseVO();
String courseName = "";
for (int i = 0; i < listSunday.size(); i++) {
if (i == listSunday.size() - 1){
courseName += listSunday.get(i).getCourseName();
}else {
courseName += listSunday.get(i).getCourseName() + "、";
}
}
courseVO.setCourseName(courseName);
vo.setSunday(courseVO);
}
return vo;
}
......
......@@ -3,15 +3,11 @@ package yangtz.cs.liu.campus.service.schoolClass;
import com.baomidou.mybatisplus.extension.service.IService;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClass;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClassMentor;
import yangtz.cs.liu.campus.domain.schoolgrade.SchoolGrade;
import yangtz.cs.liu.campus.domain.schoolgrade.SchoolGradeMentor;
import yangtz.cs.liu.campus.vo.schoolClass.ClassBatchVo;
import yangtz.cs.liu.campus.vo.schoolClass.ClassTreeSelect;
import yangtz.cs.liu.campus.vo.schoolClass.SchoolClassDrVo;
import yangtz.cs.liu.campus.vo.schoolClass.SchoolClassMentorVo;
import yangtz.cs.liu.campus.vo.schoolgrade.GradeTreeSelect;
import yangtz.cs.liu.campus.vo.schoolgrade.SchoolGradeMentorVo;
import yangtz.cs.liu.wechat.vo.schoolClass.SchoolClassVo;
import yangtz.cs.liu.wechat.vo.schoolGrade.SchoolGradeVo;
import java.util.List;
......@@ -43,13 +39,21 @@ public interface ISchoolClassService extends IService<SchoolClass> {
List<SchoolClassVo> getTeacherClass(Long teacherId);
// /**
// * 校验
// * @param list
// */
// void checkImport(List<SchoolClass> list);
//
// String importExamDetail(List<SchoolClass> list);
/**
* 校验
* @param list
*/
void checkImport(List<SchoolClass> list);
void checkImport(List<SchoolClassDrVo> list);
String importExamDetail(List<SchoolClass> list);
String importExamDetail(List<SchoolClassDrVo> list);
/**
*
......
......@@ -51,19 +51,19 @@ public class SchoolAuditoriumVo extends ProcessBaseEntity {
private String duration;
/** 是否彩排(1-是,0-否) */
@Excel(name = "是否彩排", readConverterExp = "1=-是,0-否")
@Excel(name = "是否彩排", combo = {"是","否"}, readConverterExp = "1=是,0=否")
private String isRehearsal;
/** 是否录像(1-是,0-否) */
@Excel(name = "是否录像", readConverterExp = "1=-是,0-否")
@Excel(name = "是否录像", combo = {"是","否"}, readConverterExp = "1=是,0=否")
private String isVideo;
/** 是否直播(1-是,0-否) */
@Excel(name = "是否直播", readConverterExp = "1=-是,0-否")
@Excel(name = "是否直播", combo = {"是","否"}, readConverterExp = "1=是,0=否")
private String isLive;
/** 是否需要大屏(1-是,0-否) */
@Excel(name = "是否需要大屏", readConverterExp = "1=-是,0-否")
@Excel(name = "是否需要大屏", combo = {"是","否"}, readConverterExp = "1=是,0=否")
private String isBigScreen;
/** 其他要求 */
......@@ -79,7 +79,7 @@ public class SchoolAuditoriumVo extends ProcessBaseEntity {
private String leadershipName;
/** 审核状态(0-未提交,1-审核中,2-审核通过,3-审核不通过) */
@Excel(name = "审核状态", readConverterExp = "0=-未提交,1-审核中,2-审核通过,3-审核不通过")
@Excel(name = "审核状态", combo = {"未提交","审核中","审核通过","审核不通过"}, readConverterExp = "0=未提交,1=审核中,2=审核通过,3=审核不通过")
private String state;
/** 审批意见 */
......
......@@ -94,6 +94,7 @@ public class PurchaseVo extends OurBaseEntity {
/**
* 申请时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date applyTime;
/**
......
package yangtz.cs.liu.campus.vo.schoolClass;
import com.core.domain.OurBaseEntity;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
public class SchoolClassDrVo extends OurBaseEntity {
private static final long serialVersionUID = 1L;
/** 当前学年 */
@Excel(name = "当前学年")
@NotNull(message = "当前学年不能为空")
private Integer schoolYear;
/** l类型1幼儿园2小学3初中4高中 */
//@Excel(name = "l类型1幼儿园2小学3初中4高中")
private String classType;
/** 年级*/
@Excel(name = "年级",combo = {"一年级","二年级","三年级"},readConverterExp = "1=一年级,2=二年级,3=三年级")
@NotNull(message = "年级数值不能为空")
private Integer gradeValue;
/** 年级名称 */
//@Excel(name = "年级名称")
private String gradeName;
/** 班级 */
@Excel(name = "班级",combo = {"一班","二班","三班","四班","五班","六班","七班","八班","九班","十班","十一班","十二班","十三班",
"十四班","十五班","十六班","十七班","十八班","十九班","二十班","二十一班","二十二班","二十三班","二十四班",
"二十五班","二十六班","二十七班","二十八班","二十九班","三十班","三十一班","三十二班"},
readConverterExp = "1=一班,2=二班,3=三班,4=四班,5=五班,6=六班,7=七班,8=八班,9=九班,10=十班,11=十一班," +
"12=十二班,13=十三班,14=十四班,15=十五班,16=十六班,17=十七班,18=十八班,19=十九班,20=二十班," +
"21=二十一班,22=二十二班,23=二十三班,24=二十四班,25=二十五班,26=二十六班,27=二十七班,28=二十八班,29=二十九班,30=三十班,31=三十一班,32=三十二班")
@NotNull(message = "班级数值不能为空")
private Integer classValue;
/** 班级名称 */
//@Excel(name = "班级名称",width = 25)
private String className;
/** 班级别名 */
@Excel(name = "班级别名",width = 25)
private String classAlias;
/** 班主任id */
private Long teacherId;
/** 班主任名称 */
@Excel(name = "班主任名称")
private String teacherName;
/** 班主任手机号 */
@Excel(name = "班主任手机号",width = 25)
private String teacherTel;
/** 所在教学楼 */
@Excel(name = "所在教学楼",width = 25)
private String houseName;
/** 是否毕业0正常1毕业 */
private String isGraduated;
/** 班徽图片 */
//@Excel(name = "班徽图片", cellType = Excel.ColumnType.IMAGE,height = 65,type = Excel.Type.EXPORT)
private String picUrl;
/** 班级口号 */
@Excel(name = "班级口号",width = 25)
private String classSlogan;
/** 班主任寄语 */
@Excel(name = "班主任寄语",width = 25)
private String teacherWord;
/** 年级id */
//@Excel(name = "年级id")
private Long gradeId;
/** 是否最新学年(0是,1否) */
//@Excel(name = "是否最新学年", readConverterExp = "0=是,1否")
private String sfzxxn;
/** 是否重点班(0是,1否) */
@Excel(name = "是否重点班",combo = {"是","否"}, readConverterExp = "0=是,1=否")
private String keyClass;
/** 选课套餐(下拉框选择) */
@Excel(name = "选课套餐",combo = {"物理+政治+化学","物理+政治+生物","物理+政治+地理","物理+政治+历史","物理+历史+化学","物理+历史+生物",
"物理+地理+化学","物理+地理+生物","物理+化学+生物","物理+历史+地理","化学+政治+地理","化学+政治+历史",
"化学+政治+生物","化学+历史+地理","化学+历史+生物","化学+地理+生物","生物+政治+地理","生物+历史+地理","生物+政治+历史","政治+历史+地理"},
readConverterExp = "1=物理+政治+化学,2=物理+政治+生物,3=物理+政治+地理,4=物理+政治+历史,5=物理+历史+化学,6=物理+历史+生物," +
"7=物理+地理+化学,8=物理+地理+生物,9=物理+化学+生物,10=物理+历史+地理,11=化学+政治+地理,12=化学+政治+历史" +
"13=化学+政治+生物,14=化学+历史+地理,15=化学+历史+生物,16=化学+地理+生物,17=生物+政治+地理,18=生物+历史+地理,19=生物+政治+历史,20=政治+历史+地理",width = 25)
private String chooseCourse;
private Long teacherId1;
@Excel(name = "老师姓名1")
private String teacherName1;
@Excel(name = "老师电话号码1")
private String teacherTel1;
/** 课程名称*/
@Excel(name = "任课名称1", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName1;
private Long teacherId2;
@Excel(name = "老师姓名2")
private String teacherName2;
@Excel(name = "老师电话号码2")
private String teacherTel2;
/** 课程名称*/
@Excel(name = "任课名称2", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName2;
private Long teacherId3;
@Excel(name = "老师姓名3")
private String teacherName3;
@Excel(name = "老师电话号码3")
private String teacherTel3;
/** 课程名称*/
@Excel(name = "任课名称3", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName3;
private Long teacherId4;
@Excel(name = "老师姓名4")
private String teacherName4;
@Excel(name = "老师电话号码4")
private String teacherTel4;
/** 课程名称*/
@Excel(name = "任课名称4", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName4;
private Long teacherId5;
@Excel(name = "老师姓名5")
private String teacherName5;
@Excel(name = "老师电话号码5")
private String teacherTel5;
/** 课程名称*/
@Excel(name = "任课名称5", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName5;
private Long teacherId6;
@Excel(name = "老师姓名6")
private String teacherName6;
@Excel(name = "老师电话号码6")
private String teacherTel6;
/** 课程名称*/
@Excel(name = "任课名称6", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName6;
private Long teacherId7;
@Excel(name = "老师姓名7")
private String teacherName7;
@Excel(name = "老师电话号码7")
private String teacherTel7;
/** 课程名称*/
@Excel(name = "任课名称7", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName7;
private Long teacherId8;
@Excel(name = "老师姓名8")
private String teacherName8;
@Excel(name = "老师电话号码8")
private String teacherTel8;
/** 课程名称*/
@Excel(name = "任课名称8", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName8;
private Long teacherId9;
@Excel(name = "老师姓名9")
private String teacherName9;
@Excel(name = "老师电话号码9")
private String teacherTel9;
/** 课程名称*/
@Excel(name = "任课名称9", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName9;
private Long teacherId10;
@Excel(name = "老师姓名10")
private String teacherName10;
@Excel(name = "老师电话号码10")
private String teacherTel10;
/** 课程名称*/
@Excel(name = "任课名称10", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName10;
private Long teacherId11;
@Excel(name = "老师姓名11")
private String teacherName11;
@Excel(name = "老师电话号码11")
private String teacherTel11;
/** 课程名称*/
@Excel(name = "任课名称11", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName11;
private Long teacherId12;
@Excel(name = "老师姓名12")
private String teacherName12;
@Excel(name = "老师电话号码12")
private String teacherTel12;
/** 课程名称*/
@Excel(name = "任课名称12", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName12;
private Long teacherId13;
@Excel(name = "老师姓名13")
private String teacherName13;
@Excel(name = "老师电话号码13")
private String teacherTel13;
/** 课程名称*/
@Excel(name = "任课名称13", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName13;
private Long teacherId14;
@Excel(name = "老师姓名14")
private String teacherName14;
@Excel(name = "老师电话号码14")
private String teacherTel14;
/** 课程名称*/
@Excel(name = "任课名称14", combo = {"语文","数学","英语","历史","地理","生物","政治","物理","化学","体育","音乐","美术","书法","计算机技术"})
private String courseName14;
}
......@@ -29,7 +29,7 @@ public class SchoolStudentVO {
private String idCard;
/**性别**/
@Excel(name = "*学生性别",combo = {"男","女"},readConverterExp = "0=男,1=女")
@Excel(name = "学生性别",combo = {"男","女"},readConverterExp = "0=男,1=女")
@NotBlank(message = "学生性别不能为空")
private String sex;
......@@ -52,7 +52,7 @@ public class SchoolStudentVO {
/**出生日期**/
@NotNull(message = "出生日期不能为空")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "*出生日期", dateFormat = "yyyy-MM-dd",width = 25)
@Excel(name = "出生日期", dateFormat = "yyyy-MM-dd",width = 25)
private Date birthday;
/**学生状态**/
......
......@@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="term != null "> and term = #{term}</if>
<if test="studentId != null "> and student_id = #{studentId}</if>
</where>
order by create_time desc
order by day desc
</select>
<select id="selectSchoolStudentIntegralById" parameterType="Long" resultMap="SchoolStudentIntegralResult">
......
......@@ -120,4 +120,140 @@
</foreach>
</update>
<update id="updateScoreList" parameterType="SchoolStudentScore">
<foreach collection="list" item="data" separator=";">
update school_student_score
<trim prefix="SET" suffixOverrides=",">
<if test="data.studentId != null">
student_id = #{data.studentId},
</if>
<if test="data.curriculaId != null">
curricula_id = #{data.curriculaId},
</if>
<if test="data.classId != null">
class_id = #{data.classId},
</if>
<if test="data.examType != null">
exam_type = #{data.examType},
</if>
<if test="data.language != null">
`language` = #{data.language},
</if>
<if test="data.math != null">
math = #{data.math},
</if>
<if test="data.english != null">
english = #{data.english},
</if>
<if test="data.politics != null">
politics = #{data.politics},
</if>
<if test="data.geography != null">
geography = #{data.geography},
</if>
<if test="data.history != null">
history = #{data.history},
</if>
<if test="data.physics != null">
physics = #{data.physics},
</if>
<if test="data.chemistry != null">
chemistry = #{data.chemistry},
</if>
<if test="data.biology != null">
biology = #{data.biology},
</if>
</trim>
where id = #{data.id}
</foreach>
</update>
<insert id="insertScoreList" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
<foreach collection="list" item="data" separator=";">
insert into school_student_score
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="data.studentId != null">
student_id,
</if>
<if test="data.curriculaId != null">
curricula_id,
</if>
<if test="data.classId != null">
class_id,
</if>
<if test="data.examType != null">
exam_type,
</if>
<if test="data.language != null">
`language`,
</if>
<if test="data.math != null">
math,
</if>
<if test="data.english != null">
english,
</if>
<if test="data.politics != null">
politics,
</if>
<if test="data.geography != null">
geography,
</if>
<if test="data.history != null">
history,
</if>
<if test="data.physics != null">
physics,
</if>
<if test="data.chemistry != null">
chemistry,
</if>
<if test="data.biology != null">
biology,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="data.studentId != null">
#{data.studentId},
</if>
<if test="data.curriculaId != null">
#{data.curriculaId},
</if>
<if test="data.classId != null">
#{data.classId},
</if>
<if test="data.examType != null">
#{data.examType},
</if>
<if test="data.language != null">
#{data.language},
</if>
<if test="data.math != null">
#{data.math},
</if>
<if test="data.english != null">
#{data.english},
</if>
<if test="data.politics != null">
#{data.politics},
</if>
<if test="data.geography != null">
#{data.geography},
</if>
<if test="data.history != null">
#{data.history},
</if>
<if test="data.physics != null">
#{data.physics},
</if>
<if test="data.chemistry != null">
#{data.chemistry},
</if>
<if test="data.biology != null">
#{data.biology},
</if>
</trim>
</foreach>
</insert>
</mapper>
\ No newline at end of file
......@@ -9,4 +9,41 @@
left join school_class sc on cr.class_id = sc.id
where cr.student_id = #{studentId}
</select>
<update id="updateRelationList" parameterType="yangtz.cs.liu.campus.domain.student.SchoolStudentClassRelation">
<foreach collection="list" item="data" separator=";">
update school_student_class_relation
<trim prefix="SET" suffixOverrides=",">
<if test="data.classId != null">
class_id = #{data.classId},
</if>
<if test="data.studentId != null">
student_id = #{data.studentId},
</if>
</trim>
where id = #{data.id}
</foreach>
</update>
<insert id="addRelationList" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
<foreach collection="list" item="data" separator=";">
insert into school_student_class_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="data.classId != null">
class_id,
</if>
<if test="data.studentId != null">
student_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="data.classId != null">
#{data.classId},
</if>
<if test="data.studentId != null">
#{data.studentId},
</if>
</trim>
</foreach>
</insert>
</mapper>
......@@ -296,4 +296,93 @@
</where>
</select>
<insert id="inserStudentList" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
<foreach collection="list" item="data" separator=";">
insert into school_student
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="data.classId != null">class_id,</if>
<if test="data.studentName != null and data.studentName != ''">student_name,</if>
<if test="data.sex != null and data.sex != ''">sex,</if>
<if test="data.birthday != null">birthday,</if>
<if test="data.nation != null and data.nation != ''">nation,</if>
<if test="data.homeAddress != null and data.homeAddress != ''">home_address,</if>
<if test="data.nativePlace != null and data.nativePlace != ''">native_place,</if>
<if test="data.enrollmentTime != null">enrollment_time,</if>
<if test="data.avatar != null and data.avatar != ''">avatar,</if>
<if test="data.idCard != null and data.idCard != ''">id_card,</if>
<if test="data.schoolNo != null and data.schoolNo != ''">school_no,</if>
<if test="data.studentStatus != null and data.studentStatus != ''">student_status,</if>
<if test="data.studentType != null and data.studentType != ''">student_type,</if>
<if test="data.oneCard != null and data.oneCard != ''">one_card,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="data.classId != null">#{data.classId},</if>
<if test="data.studentName != null and data.studentName != ''">#{data.studentName},</if>
<if test="data.sex != null and data.sex != ''">#{data.sex},</if>
<if test="data.birthday != null">#{data.birthday},</if>
<if test="data.nation != null and data.nation != ''">#{data.nation},</if>
<if test="data.homeAddress != null and data.homeAddress != ''">#{data.homeAddress},</if>
<if test="data.nativePlace != null and data.nativePlace != ''">#{data.nativePlace},</if>
<if test="data.enrollmentTime != null">#{data.enrollmentTime},</if>
<if test="data.avatar != null and data.avatar != ''">#{data.avatar},</if>
<if test="data.idCard != null and data.idCard != ''">#{data.idCard},</if>
<if test="data.schoolNo != null and data.schoolNo != ''">#{data.schoolNo},</if>
<if test="data.studentStatus != null and data.studentStatus != ''">#{data.studentStatus},</if>
<if test="data.studentType != null and data.studentType != ''">#{data.studentType},</if>
<if test="data.oneCard != null and data.oneCard != ''">#{data.oneCard},</if>
</trim>
</foreach>
</insert>
<update id="updateStudentList" parameterType="yangtz.cs.liu.campus.domain.student.SchoolStudent">
<foreach collection="list" item="data" separator=";">
update school_student
<trim prefix="SET" suffixOverrides=",">
<if test="data.classId != null">
class_id = #{data.classId},
</if>
<if test="data.studentName != null and data.studentName != ''">
student_name = #{data.studentName},
</if>
<if test="data.sex != null and data.sex != ''">
sex = #{data.sex},
</if>
<if test="data.birthday != null">
birthday = #{data.birthday},
</if>
<if test="data.nation != null and data.nation != ''">
nation = #{data.nation},
</if>
<if test="data.homeAddress != null and data.homeAddress != ''">
home_address = #{data.homeAddress},
</if>
<if test="data.nativePlace != null and data.nativePlace != ''">
native_place = #{data.nativePlace},
</if>
<if test="data.enrollmentTime != null">
enrollment_time = #{data.enrollmentTime},
</if>
<if test="data.avatar != null and data.avatar != ''">
avatar = #{data.avatar},
</if>
<if test="data.idCard != null and data.idCard != ''">
id_card = #{data.idCard},
</if>
<if test="data.schoolNo != null and data.schoolNo != ''">
school_no = #{data.schoolNo},
</if>
<if test="data.studentStatus != null and data.studentStatus != ''">
student_status = #{data.studentStatus},
</if>
<if test="data.studentType != null and data.studentType != ''">
student_type = #{data.studentType},
</if>
<if test="data.oneCard != null and data.oneCard != ''">
one_card = #{data.oneCard},
</if>
</trim>
where id = #{data.id}
</foreach>
</update>
</mapper>
......@@ -190,4 +190,85 @@
select open_id from school_student_parent where id = #{id} and del_flag = '0'
</select>
<update id="updateParentList" parameterType="yangtz.cs.liu.campus.domain.student.SchoolStudentParent">
<foreach collection="list" item="data" separator=";">
update school_student_parent
<trim prefix="SET" suffixOverrides=",">
<if test="data.parentName != null and data.parentName != ''">
parent_name = #{data.parentName},
</if>
<if test="data.relationship != null and data.relationship != ''">
relationship = #{data.relationship},
</if>
<if test="data.workAddress != null and data.workAddress != ''">
work_address = #{data.workAddress},
</if>
<if test="data.contactAddress != null and data.contactAddress != ''">
contact_address = #{data.contactAddress},
</if>
<if test="data.postalCode != null and data.postalCode != ''">
postal_code = #{data.postalCode},
</if>
</trim>
where id = #{data.id}
</foreach>
</update>
<insert id="addParentList" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
<foreach collection="list" item="data" separator=";">
insert into school_student_parent
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="data.studentId != null">
student_id,
</if>
<if test="data.userId != null">
user_id,
</if>
<if test="data.parentName != null and data.parentName != ''">
parent_name,
</if>
<if test="data.telephone != null and data.telephone != ''">
postal_code,
</if>
<if test="data.relationship != null and data.relationship != ''">
relationship,
</if>
<if test="data.workAddress != null and data.workAddress != ''">
work_address,
</if>
<if test="data.contactAddress != null and data.contactAddress != ''">
contact_address,
</if>
<if test="data.postalCode != null and data.postalCode != ''">
postal_code,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="data.studentId != null">
#{data.studentId},
</if>
<if test="data.userId != null">
#{data.userId},
</if>
<if test="data.parentName != null and data.parentName != ''">
#{data.parentName},
</if>
<if test="data.telephone != null and data.telephone != ''">
#{data.telephone},
</if>
<if test="data.relationship != null and data.relationship != ''">
#{data.relationship},
</if>
<if test="data.workAddress != null and data.workAddress != ''">
#{data.workAddress},
</if>
<if test="data.contactAddress != null and data.contactAddress != ''">
#{data.contactAddress},
</if>
<if test="data.postalCode != null and data.postalCode != ''">
#{data.postalCode},
</if>
</trim>
</foreach>
</insert>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment