提交 8e25b9fb authored 作者: zhouzhigang's avatar zhouzhigang

--no commit message

上级 c6971194
......@@ -29,7 +29,7 @@ public class ImportLessonExcelVo {
@ExcelResources(title="教材名称")
private String resourceName;
@ExcelResources(title="isbn")
@ExcelResources(title="ISBN")
private String ISBN;
@ExcelResources(title="教材类型")
......
package com.zrqx.school.sysuser.client;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.zrqx.core.constant.resource.ResourceRequestPath;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.member.department.DepartmentMemberVo;
import com.zrqx.core.vo.resource.fg.goods.phy.ResourceSearchVo;
import io.swagger.annotations.ApiOperation;
@FeignClient(value="fg-resource",fallback = FgResourceHystric.class)
......@@ -14,6 +15,6 @@ public interface FgResouceClient {
@ApiOperation(value = "根据ISBN查询资源以及资源绑定的教参和习题册")
@GetMapping(ResourceRequestPath.FG + ResourceRequestPath.RESOURCE + ResourceRequestPath.GET + ResourceRequestPath.RESOURCE)
public CallBack<ResourceSearchVo> get(String isbn);
public CallBack<ResourceSearchVo> getResource(@RequestParam("isbn")String isbn);
}
......@@ -14,7 +14,7 @@ public class FgResourceHystric implements FgResouceClient{
Logger Logger = LoggerFactory.getLogger(FgResourceHystric.class);
@Override
public CallBack<ResourceSearchVo> get(String isbn) {
public CallBack<ResourceSearchVo> getResource(String isbn) {
Logger.debug("远程调用失败");
return null;
}
......
......@@ -143,8 +143,9 @@ public class FgPublicBasicRelationServiceImpl extends BaseServiceImpl<PublicBasi
public Integer exportSave(ImportLessonExcelVo vo, Integer id,String type) {
PublicBasicRelation entity = new PublicBasicRelation();
//系统教材
if(PublicLessonTypeEnum.SYSTEM.getCode().equals(vo.getType())){
CallBack<ResourceSearchVo> data = fgResouceClient.get(vo.getISBN());
if(PublicLessonTypeEnum.SYSTEM.getName().equals(vo.getType())){
CallBack<ResourceSearchVo> data = fgResouceClient.getResource(vo.getISBN());
if(data != null && data.getData() != null){
ResourceSearchVo resource = data.getData();
entity.setExerciseBookId(resource.getExerciseBookId());
......@@ -153,10 +154,11 @@ public class FgPublicBasicRelationServiceImpl extends BaseServiceImpl<PublicBasi
entity.setGuidebooksType("1-3");
entity.setResourceId(resource.getId());
entity.setResourceType(resource.getType());
entity.setType(PublicLessonTypeEnum.SYSTEM.getCode());
}
}
//校本库
if(PublicLessonTypeEnum.SCHOOL_BASED_LIBRARY.getCode().equals(vo.getType())){
if(PublicLessonTypeEnum.SCHOOL_BASED_LIBRARY.getName().equals(vo.getType())){
SchoolAsedLibrary form = new SchoolAsedLibrary();
form.setRelationId(redis.getMember().getRelationId());
form.setType(redis.getMember().getType());
......@@ -164,10 +166,11 @@ public class FgPublicBasicRelationServiceImpl extends BaseServiceImpl<PublicBasi
SchoolAsedLibrary library = fgSchoolAsedLibraryService.selectOne(form);
if(library != null){
entity.setResourceId(library.getId());
entity.setType(PublicLessonTypeEnum.SCHOOL_BASED_LIBRARY.getCode());
}
}
entity.setLessonId(id);
entity.setType(type);
entity.setLessonType(type);
super.insert(entity);
return entity.getId();
}
......
......@@ -503,12 +503,16 @@ public class FgPublicLessonServiceImpl extends BaseModelServiceImpl<PublicLesson
form.setTheoryClassHour(theoryClassHour);
form.setTrainingHours(trainingHours);
List<PublicLessonClassArrangeRealtion> vvList = new ArrayList<PublicLessonClassArrangeRealtion>();
BeanUtils.copyList(voList, PublicLessonClassArrangeRealtion.class);
//校验理论课时与实际课时之和是否和课时安排的课时相等
this.check(form, school, vvList);
String msg = this.exportCheck(form, school, voList);
if(msg != null){
voList.forEach(arg0 ->{
LessonErrVo vo = BeanUtils.copy(arg0, LessonErrVo.class);
vo.setMsg(msg);
list.add(vo);
});
continue;
}
//向数据库中插入正确的数据
PublicLesson pl = new PublicLesson();
pl.setCourseDesign(key);
......@@ -539,7 +543,29 @@ public class FgPublicLessonServiceImpl extends BaseModelServiceImpl<PublicLesson
return planVo;
}
public String exportCheck(FgSavePublicLeesonForm form,School school,List<ImportLessonExcelVo> list){
//理论课时和实训课时之和
int count = form.getTheoryClassHour().intValue() + form.getTrainingHours().intValue();
//课时安排总课时
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;
}
if(sum != count){
return "理论课时与实际课时之和不等于课时安排的课时";
}
return null;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论