|
|
@@ -15,6 +15,7 @@ import com.usoftchina.smartschool.school.enums.NoticeTemplate;
|
|
|
import com.usoftchina.smartschool.school.exception.BizExceptionCode;
|
|
|
import com.usoftchina.smartschool.school.mapper.*;
|
|
|
import com.usoftchina.smartschool.school.po.*;
|
|
|
+import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
|
|
|
import com.usoftchina.smartschool.utils.CollectionUtils;
|
|
|
import com.usoftchina.smartschool.utils.DateUtils;
|
|
|
import com.usoftchina.smartschool.wechat.api.WechatApi;
|
|
|
@@ -310,4 +311,54 @@ public class ScoreServiceImpl implements ScoreService{
|
|
|
form.setItems(detail);
|
|
|
return form;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public DocBaseDTO save(ScoreForm data) {
|
|
|
+ if (ObjectUtils.isEmpty(data)){
|
|
|
+ throw new BizException(BizExceptionCode.EMPTY_DATA);
|
|
|
+ }
|
|
|
+ ScoreImport main = data.getMain();
|
|
|
+ List<ScoreImportdetail> items = data.getItems();
|
|
|
+ Long schoolId = BaseContextHolder.getSchoolId();
|
|
|
+ //Long gradeId = sysGradeMapper.selectByName(main.getSi_grade(), schoolId).getGrade_id();
|
|
|
+ SysClazz sysClazz = sysClazzMapper.selectByClazzName(main.getSi_grade(), main.getSi_class() , schoolId);
|
|
|
+ Long classId = sysClazz.getClazz_id();
|
|
|
+ Long gradeId = sysClazz.getGrade_id();
|
|
|
+ if (null == main.getSi_id() || 0 == main.getSi_id()){
|
|
|
+ main.setSi_date(new Date());
|
|
|
+ main.setSi_creator(BaseContextHolder.getUserName());
|
|
|
+ main.setSi_creatorid(BaseContextHolder.getUserId());
|
|
|
+ main.setSchool_id(schoolId);
|
|
|
+ main.setSi_publish(0);
|
|
|
+ main.setSi_gradeid(gradeId);
|
|
|
+ main.setSi_classid(classId);
|
|
|
+ scoreMapper.insertScoreImport(main);
|
|
|
+ Long mId = main.getSi_id();
|
|
|
+ if (null != items && items.size() > 0) {
|
|
|
+ for (ScoreImportdetail item : items) {
|
|
|
+ if(!StringUtils.isEmpty(item.getSd_stuNumber()) && !StringUtils.isEmpty(item.getSd_stu())) {
|
|
|
+ Integer check = 0;
|
|
|
+ //学生检测
|
|
|
+ check = sysStudentMapper.count(item.getSd_stuNumber(), schoolId);
|
|
|
+ if (check < 1) {
|
|
|
+ throw new BizException(BizExceptionCode.NONSTU);
|
|
|
+ }
|
|
|
+ check = sysStudentMapper.countName(item.getSd_stu(), schoolId);
|
|
|
+ if (check < 1) {
|
|
|
+ throw new BizException(BizExceptionCode.NONSTU);
|
|
|
+ }
|
|
|
+ SysStudent sysStudent = sysStudentMapper.selectByStudent(item.getSd_stu() ,classId,schoolId);
|
|
|
+ Long stuId = sysStudent.getStu_id();
|
|
|
+ item.setSd_stuid(stuId);
|
|
|
+ }
|
|
|
+ item.setSchool_id(schoolId);
|
|
|
+ item.setSd_siid(mId);
|
|
|
+ //插入从表
|
|
|
+ scoreMapper.insertScoreImportDetail(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return new DocBaseDTO(main.getSi_id(), CODE, NAME);
|
|
|
+ }
|
|
|
}
|