提交 1b1f0140 authored 作者: zhouzhigang's avatar zhouzhigang

--no commit message

上级 195b7cea
......@@ -125,6 +125,7 @@ public class FgClassManagementServiceImpl extends BaseModelServiceImpl<ClassMana
}
ClassManagement s = new ClassManagement();
s.setName(form.getName());
s.setAcademicLevel(form.getAcademicLevel());
s.setRelationId(redis.getMember().getRelationId());
s.setType(redis.getMember().getType());
Integer count = fgClassManagementMapper.selectCount(s);
......
......@@ -538,7 +538,7 @@ public class FgPublicLessonServiceImpl extends BaseModelServiceImpl<PublicLesson
for(ImportLessonExcelVo v : importExcelVos){
LessonErrVo vo = BeanUtils.copy(v, LessonErrVo.class);
if(StringUtils.isEmpty(v.getCourseDesign()) || StringUtils.isEmpty(v.getType()) ||
v.getNum() == null || v.getTheoryClassHour() == null || v.getTrainingHours() == null || v.getWeeklyHours() == null ||
v.getNum() == null || v.getWeeklyHours() == null ||
v.getSemester() == null){
vo.setMsg("所导入字段都为必填字段,请补全后继续导入");
list.add(vo);
......@@ -565,29 +565,31 @@ public class FgPublicLessonServiceImpl extends BaseModelServiceImpl<PublicLesson
}
//系统校验ISBN是否有效
if(PublicLessonTypeEnum.SYSTEM.getName().equals(vo.getType())){
CallBack<PhyResource> data = fgResouceClient.getByIsbn(vo.getISBN());
if(data == null || data.getData() == null){
vo.setMsg("请输入有效的ISBN号");
list.add(vo);
continue;
}
}
//校本库校验教材是否有效
if(PublicLessonTypeEnum.SCHOOL_BASED_LIBRARY.getName().equals(vo.getType())){
SchoolAsedLibrary libary = new SchoolAsedLibrary();
libary.setResourceName(vo.getResourceName());
SchoolAsedLibrary entity = new SchoolAsedLibrary();
try {
entity = fgSchoolAsedLibraryService.selectOne(libary);
} catch (Exception e) {
log.error("获取校本库教材信息异常");
e.printStackTrace();
if(StringUtils.isNotEmpty(v.getISBN())) {
if(PublicLessonTypeEnum.SYSTEM.getName().equals(vo.getType())){
CallBack<PhyResource> data = fgResouceClient.getByIsbn(vo.getISBN());
if(data == null || data.getData() == null){
vo.setMsg("请输入有效的ISBN号");
list.add(vo);
continue;
}
}
if(entity == null){
vo.setMsg("请输入有效的教材名称");
list.add(vo);
continue;
//校本库校验教材是否有效
if(PublicLessonTypeEnum.SCHOOL_BASED_LIBRARY.getName().equals(vo.getType())){
SchoolAsedLibrary libary = new SchoolAsedLibrary();
libary.setResourceName(vo.getResourceName());
SchoolAsedLibrary entity = new SchoolAsedLibrary();
try {
entity = fgSchoolAsedLibraryService.selectOne(libary);
} catch (Exception e) {
log.error("获取校本库教材信息异常");
e.printStackTrace();
}
if(entity == null){
vo.setMsg("请输入有效的教材名称");
list.add(vo);
continue;
}
}
}
newList.add(v);
......@@ -600,12 +602,8 @@ public class FgPublicLessonServiceImpl extends BaseModelServiceImpl<PublicLesson
List<ImportLessonExcelVo> errList = new ArrayList<ImportLessonExcelVo>();
List<ImportLessonExcelVo> vList = map.get(key);
Integer num = null;
Integer theoryClassHour = null;
Integer trainingHours = null;
for(int i = 0; i < vList.size(); i++){
num = vList.get(0).getNum();
theoryClassHour = vList.get(0).getTheoryClassHour();
trainingHours = vList.get(0).getTrainingHours();
for(int j = vList.size()-1; j > i; j--){
if(vList.get(j).getSemester().equals(vList.get(i).getSemester())){
LessonErrVo vo = BeanUtils.copy(vList.get(i), LessonErrVo.class);
......@@ -628,20 +626,23 @@ public class FgPublicLessonServiceImpl extends BaseModelServiceImpl<PublicLesson
voList.addAll(vList);
}
FgSavePublicLeesonForm form = new FgSavePublicLeesonForm();
form.setTheoryClassHour(theoryClassHour);
form.setTrainingHours(trainingHours);
//理论课时
Integer theoryHour = this.sumHour(school, voList);
// FgSavePublicLeesonForm form = new FgSavePublicLeesonForm();
// form.setTheoryClassHour(theoryClassHour);
// form.setTrainingHours(0);
//校验理论课时与实际课时之和是否和课时安排的课时相等
String msg = this.exportCheck(form, school, voList);
if(StringUtils.isNotEmpty(msg)){
voList.forEach(arg0 ->{
LessonErrVo vo = BeanUtils.copy(arg0, LessonErrVo.class);
vo.setMsg(msg);
list.add(vo);
});
continue;
}
//String msg = this.exportCheck(form, school, voList);
// if(StringUtils.isNotEmpty(msg)){
// voList.forEach(arg0 ->{
// LessonErrVo vo = BeanUtils.copy(arg0, LessonErrVo.class);
// vo.setMsg(msg);
// list.add(vo);
// });
// continue;
// }
if(list != null && list.size() > 0){
continue;
}
......@@ -655,8 +656,8 @@ public class FgPublicLessonServiceImpl extends BaseModelServiceImpl<PublicLesson
pl.setNum(num);
pl.setRelationId(redis.getMember().getRelationId());
pl.setType(redis.getMember().getType());
pl.setTheoryClassHour(theoryClassHour);
pl.setTrainingHours(trainingHours);
pl.setTheoryClassHour(theoryHour);
pl.setTrainingHours(0);
Integer maxSort = fgPublicLessonMapper.getMaxSort(redis.getMember().getRelationId(), redis.getMember().getType());
if(maxSort == null){
pl.setSort(1);
......@@ -702,6 +703,27 @@ public class FgPublicLessonServiceImpl extends BaseModelServiceImpl<PublicLesson
}
return null;
}
public Integer sumHour(School school,List<ImportLessonExcelVo> list){
//课时安排总课时
int sum = 0;
int num = 0;
if(school.getSpringWeek() == null || school.getAutumnWeek() == null){
throw new BusinessValidateException("请前往学校信息管理页面补全学校信息");
}
for(int i = 0; i < list.size(); i++){
if(list.get(i).getSemester().intValue()%2 == 0){
num = list.get(i).getWeeklyHours().intValue() * school.getSpringWeek();
}
if(list.get(i).getSemester().intValue()%2 == 1){
num = list.get(i).getWeeklyHours().intValue() * school.getAutumnWeek();
}
sum = sum + num;
}
return sum;
}
@Override
public boolean isExsitName(PublicLesson form, PublicLesson oldEntity) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论