beetlsql3-dev
xuliangtong 2 years ago
parent d1f7c817c9
commit 6e33f0e22d

@ -10,11 +10,14 @@ import com.ibeetl.admin.core.util.PlatformException;
import com.ibeetl.admin.core.util.TimeTool; import com.ibeetl.admin.core.util.TimeTool;
import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.admin.core.web.JsonReturnCode; import com.ibeetl.admin.core.web.JsonReturnCode;
import com.ibeetl.jlw.dao.TeacherOpenCourseMergeStudentDao;
import com.ibeetl.jlw.dao.TeacherOpenCourseScoreDashboardDao; import com.ibeetl.jlw.dao.TeacherOpenCourseScoreDashboardDao;
import com.ibeetl.jlw.dao.TeacherOpenCourseScoreWeightDao; import com.ibeetl.jlw.dao.TeacherOpenCourseScoreWeightDao;
import com.ibeetl.jlw.entity.FileEntity; import com.ibeetl.jlw.entity.FileEntity;
import com.ibeetl.jlw.entity.TeacherOpenCourseMergeStudent;
import com.ibeetl.jlw.entity.TeacherOpenCourseScoreDashboard; import com.ibeetl.jlw.entity.TeacherOpenCourseScoreDashboard;
import com.ibeetl.jlw.entity.TeacherOpenCourseScoreWeight; import com.ibeetl.jlw.entity.TeacherOpenCourseScoreWeight;
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeStudentQuery;
import com.ibeetl.jlw.web.query.TeacherOpenCourseScoreDashboardQuery; import com.ibeetl.jlw.web.query.TeacherOpenCourseScoreDashboardQuery;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -46,37 +49,41 @@ import java.util.*;
@Service @Service
@Transactional @Transactional
@Slf4j @Slf4j
public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<TeacherOpenCourseScoreDashboard> implements DeleteResourcesBy{ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<TeacherOpenCourseScoreDashboard> implements DeleteResourcesBy {
@Autowired private TeacherOpenCourseScoreDashboardDao teacherOpenCourseScoreDashboardDao; @Autowired
private TeacherOpenCourseScoreDashboardDao teacherOpenCourseScoreDashboardDao;
@Autowired @Autowired
private TeacherOpenCourseScoreWeightDao weightDao; private TeacherOpenCourseScoreWeightDao weightDao;
public PageQuery<TeacherOpenCourseScoreDashboard>queryByCondition(PageQuery query){ @Autowired
PageQuery ret = teacherOpenCourseScoreDashboardDao.queryByCondition(query); private TeacherOpenCourseMergeStudentDao mergeStudentDao;
public PageQuery<TeacherOpenCourseScoreDashboard> queryByCondition(PageQuery query) {
PageQuery ret = teacherOpenCourseScoreDashboardDao.queryByCondition(query);
queryListAfter(ret.getList()); queryListAfter(ret.getList());
return ret; return ret;
} }
public PageQuery<TeacherOpenCourseScoreDashboard>queryByConditionQuery(PageQuery query){ public PageQuery<TeacherOpenCourseScoreDashboard> queryByConditionQuery(PageQuery query) {
PageQuery ret = teacherOpenCourseScoreDashboardDao.queryByConditionQuery(query); PageQuery ret = teacherOpenCourseScoreDashboardDao.queryByConditionQuery(query);
queryListAfter(ret.getList()); queryListAfter(ret.getList());
return ret; return ret;
} }
public void deleteByList(List list){ public void deleteByList(List list) {
String ids = ""; String ids = "";
ToolUtils.deleteNullList(list); ToolUtils.deleteNullList(list);
for(int i=0;null != list && i<list.size();i++){ for (int i = 0; null != list && i < list.size(); i++) {
ids += list.get(i).toString()+(i==list.size()-1?"":","); ids += list.get(i).toString() + (i == list.size() - 1 ? "" : ",");
} }
if(StringUtils.isNotBlank(ids)){ if (StringUtils.isNotBlank(ids)) {
teacherOpenCourseScoreDashboardDao.deleteTeacherOpenCourseScoreDashboardByIds(ids); teacherOpenCourseScoreDashboardDao.deleteTeacherOpenCourseScoreDashboardByIds(ids);
} }
} }
public void deleteTeacherOpenCourseScoreDashboard(String ids){ public void deleteTeacherOpenCourseScoreDashboard(String ids) {
try { try {
teacherOpenCourseScoreDashboardDao.deleteTeacherOpenCourseScoreDashboardByIds(ids); teacherOpenCourseScoreDashboardDao.deleteTeacherOpenCourseScoreDashboardByIds(ids);
} catch (Exception e) { } catch (Exception e) {
@ -84,7 +91,7 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
} }
} }
public String addAll(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery){ public String addAll(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery) {
String msg = ""; String msg = "";
List<TeacherOpenCourseScoreDashboard> teacherOpenCourseScoreDashboardList = new ArrayList<>(); List<TeacherOpenCourseScoreDashboard> teacherOpenCourseScoreDashboardList = new ArrayList<>();
try { try {
@ -92,11 +99,12 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
} catch (Exception e) { } catch (Exception e) {
try { try {
teacherOpenCourseScoreDashboardList.add(JSONObject.parseObject(teacherOpenCourseScoreDashboardQuery.getTeacherOpenCourseScoreDashboardJsonStr(), TeacherOpenCourseScoreDashboard.class)); teacherOpenCourseScoreDashboardList.add(JSONObject.parseObject(teacherOpenCourseScoreDashboardQuery.getTeacherOpenCourseScoreDashboardJsonStr(), TeacherOpenCourseScoreDashboard.class));
} catch (Exception e1) {} } catch (Exception e1) {
}
} }
ToolUtils.deleteNullList(teacherOpenCourseScoreDashboardList); ToolUtils.deleteNullList(teacherOpenCourseScoreDashboardList);
if(null != teacherOpenCourseScoreDashboardList && teacherOpenCourseScoreDashboardList.size()>0){ if (null != teacherOpenCourseScoreDashboardList && teacherOpenCourseScoreDashboardList.size() > 0) {
for(int i=0;i<teacherOpenCourseScoreDashboardList.size();i++){ for (int i = 0; i < teacherOpenCourseScoreDashboardList.size(); i++) {
TeacherOpenCourseScoreDashboard teacherOpenCourseScoreDashboard = teacherOpenCourseScoreDashboardList.get(i); TeacherOpenCourseScoreDashboard teacherOpenCourseScoreDashboard = teacherOpenCourseScoreDashboardList.get(i);
teacherOpenCourseScoreDashboard.setUserId(teacherOpenCourseScoreDashboardQuery.getUserId()); teacherOpenCourseScoreDashboard.setUserId(teacherOpenCourseScoreDashboardQuery.getUserId());
teacherOpenCourseScoreDashboard.setOrgId(teacherOpenCourseScoreDashboardQuery.getOrgId()); teacherOpenCourseScoreDashboard.setOrgId(teacherOpenCourseScoreDashboardQuery.getOrgId());
@ -106,7 +114,7 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
return msg; return msg;
} }
public JsonResult add(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery){ public JsonResult add(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery) {
String msg = ""; String msg = "";
TeacherOpenCourseScoreDashboard teacherOpenCourseScoreDashboard = teacherOpenCourseScoreDashboardQuery.pojo(); TeacherOpenCourseScoreDashboard teacherOpenCourseScoreDashboard = teacherOpenCourseScoreDashboardQuery.pojo();
teacherOpenCourseScoreDashboardDao.insert(teacherOpenCourseScoreDashboard); teacherOpenCourseScoreDashboardDao.insert(teacherOpenCourseScoreDashboard);
@ -118,7 +126,7 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
return jsonResult; return jsonResult;
} }
public String edit(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery){ public String edit(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery) {
String msg = ""; String msg = "";
TeacherOpenCourseScoreDashboard teacherOpenCourseScoreDashboard = teacherOpenCourseScoreDashboardQuery.pojo(); TeacherOpenCourseScoreDashboard teacherOpenCourseScoreDashboard = teacherOpenCourseScoreDashboardQuery.pojo();
BigDecimal signinScore = teacherOpenCourseScoreDashboard.getSigninScore(); BigDecimal signinScore = teacherOpenCourseScoreDashboard.getSigninScore();
@ -133,71 +141,71 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
BigDecimal lastScore = totalScore.add(manualScore); BigDecimal lastScore = totalScore.add(manualScore);
teacherOpenCourseScoreDashboard.setLastScore(lastScore); teacherOpenCourseScoreDashboard.setLastScore(lastScore);
TeacherOpenCourseScoreWeight weight = weightDao.single(teacherOpenCourseScoreDashboard.getTeacherOpenCourseId()); TeacherOpenCourseScoreWeight weight = weightDao.single(teacherOpenCourseScoreDashboard.getTeacherOpenCourseId());
lastStatus(weight,totalScore,teacherOpenCourseScoreDashboard); lastStatus(weight, totalScore, teacherOpenCourseScoreDashboard);
String lastStatus = teacherOpenCourseScoreDashboard.getLastStatus(); String lastStatus = teacherOpenCourseScoreDashboard.getLastStatus();
teacherOpenCourseScoreDashboardDao.updateTemplateById(teacherOpenCourseScoreDashboard); teacherOpenCourseScoreDashboardDao.updateTemplateById(teacherOpenCourseScoreDashboard);
return msg; return msg;
} }
public String updateGivenByIds(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery){ public String updateGivenByIds(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery) {
String msg = ""; String msg = "";
if(StringUtils.isNotBlank(teacherOpenCourseScoreDashboardQuery.get_given())){ if (StringUtils.isNotBlank(teacherOpenCourseScoreDashboardQuery.get_given())) {
boolean flag = teacherOpenCourseScoreDashboardDao.updateGivenByIds(teacherOpenCourseScoreDashboardQuery) > 0; boolean flag = teacherOpenCourseScoreDashboardDao.updateGivenByIds(teacherOpenCourseScoreDashboardQuery) > 0;
if(!flag){ if (!flag) {
msg = "更新指定参数失败"; msg = "更新指定参数失败";
} }
}else{ } else {
msg = "指定参数为空"; msg = "指定参数为空";
} }
return msg; return msg;
} }
public List<TeacherOpenCourseScoreDashboard> getValues (Object paras){ public List<TeacherOpenCourseScoreDashboard> getValues(Object paras) {
return sqlManager.select(SqlId.of("jlw.teacherOpenCourseScoreDashboard.getTeacherOpenCourseScoreDashboardValues"), TeacherOpenCourseScoreDashboard.class, paras); return sqlManager.select(SqlId.of("jlw.teacherOpenCourseScoreDashboard.getTeacherOpenCourseScoreDashboardValues"), TeacherOpenCourseScoreDashboard.class, paras);
} }
public List<TeacherOpenCourseScoreDashboard> getValuesByQuery (TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery){ public List<TeacherOpenCourseScoreDashboard> getValuesByQuery(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery) {
return teacherOpenCourseScoreDashboardDao.getValuesByQuery(teacherOpenCourseScoreDashboardQuery); return teacherOpenCourseScoreDashboardDao.getValuesByQuery(teacherOpenCourseScoreDashboardQuery);
} }
public TeacherOpenCourseScoreDashboard getInfo (Long teacherOpenCourseScoreDashboardId){ public TeacherOpenCourseScoreDashboard getInfo(Long teacherOpenCourseScoreDashboardId) {
TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery = new TeacherOpenCourseScoreDashboardQuery(); TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery = new TeacherOpenCourseScoreDashboardQuery();
teacherOpenCourseScoreDashboardQuery.setTeacherOpenCourseScoreDashboardId(teacherOpenCourseScoreDashboardId); teacherOpenCourseScoreDashboardQuery.setTeacherOpenCourseScoreDashboardId(teacherOpenCourseScoreDashboardId);
List<TeacherOpenCourseScoreDashboard> list = teacherOpenCourseScoreDashboardDao.getValuesByQuery(teacherOpenCourseScoreDashboardQuery); List<TeacherOpenCourseScoreDashboard> list = teacherOpenCourseScoreDashboardDao.getValuesByQuery(teacherOpenCourseScoreDashboardQuery);
if(null != list && list.size()>0){ if (null != list && list.size() > 0) {
return list.get(0); return list.get(0);
}else{ } else {
return null; return null;
} }
} }
public TeacherOpenCourseScoreDashboard getInfo (TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery){ public TeacherOpenCourseScoreDashboard getInfo(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery) {
List<TeacherOpenCourseScoreDashboard> list = teacherOpenCourseScoreDashboardDao.getValuesByQuery(teacherOpenCourseScoreDashboardQuery); List<TeacherOpenCourseScoreDashboard> list = teacherOpenCourseScoreDashboardDao.getValuesByQuery(teacherOpenCourseScoreDashboardQuery);
if(null != list && list.size()>0){ if (null != list && list.size() > 0) {
return list.get(0); return list.get(0);
}else{ } else {
return null; return null;
} }
} }
public JsonResult importTemplate(List<FileEntity> fileEntityList,List<Long>list,CoreUser coreUser){ public JsonResult importTemplate(List<FileEntity> fileEntityList, List<Long> list, CoreUser coreUser) {
List<String[]>errMsg = new ArrayList<>(); List<String[]> errMsg = new ArrayList<>();
String msg =""; String msg = "";
int count = 0; int count = 0;
Date date = new Date(); Date date = new Date();
for(int item=0;null != fileEntityList && item<fileEntityList.size();item++){ for (int item = 0; null != fileEntityList && item < fileEntityList.size(); item++) {
FileEntity fileEntity = fileEntityList.get(item); FileEntity fileEntity = fileEntityList.get(item);
if(null != fileEntity){ if (null != fileEntity) {
File file = new File(fileEntity.getAbsoluteUrl()); File file = new File(fileEntity.getAbsoluteUrl());
if(file.exists() && file.isFile() && file.canRead() && ToolUtils.findInSet("xls,xlsx",fileEntity.getFormat())){ if (file.exists() && file.isFile() && file.canRead() && ToolUtils.findInSet("xls,xlsx", fileEntity.getFormat())) {
Workbook wb = null; Workbook wb = null;
InputStream is = null; InputStream is = null;
try { try {
is = new FileInputStream(fileEntity.getAbsoluteUrl()); is = new FileInputStream(fileEntity.getAbsoluteUrl());
if("xls".equals(fileEntity.getFormat())){ if ("xls".equals(fileEntity.getFormat())) {
wb = new HSSFWorkbook(is); wb = new HSSFWorkbook(is);
}else if("xlsx".equals(fileEntity.getFormat())){ } else if ("xlsx".equals(fileEntity.getFormat())) {
wb = new XSSFWorkbook(is); wb = new XSSFWorkbook(is);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
@ -206,13 +214,13 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
e.printStackTrace(); e.printStackTrace();
} }
try { try {
if(null != is){ if (null != is) {
is.close(); is.close();
} }
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
if(wb != null){ if (wb != null) {
//获取Sheet1 //获取Sheet1
Sheet sheet = wb.getSheet("Sheet1"); Sheet sheet = wb.getSheet("Sheet1");
//获取最大行数 //获取最大行数
@ -223,51 +231,51 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
int colNum = firstRow.getPhysicalNumberOfCells(); int colNum = firstRow.getPhysicalNumberOfCells();
String[] columns = { String[] columns = {
"学生", "学生",
"签到成绩", "签到成绩",
"章节练习成绩", "章节练习成绩",
"课程实操成绩", "课程实操成绩",
"作业成绩", "作业成绩",
"考试成绩", "考试成绩",
"互动成绩", "互动成绩",
"总成绩", "总成绩",
"手动调整的分数", "手动调整的分数",
"最终成绩", "最终成绩",
"成绩状态", "成绩状态",
"创建时间" "创建时间"
}; };
Map<String,Integer> map = new HashMap<>();//获取需要的表头的列 Map<String, Integer> map = new HashMap<>();//获取需要的表头的列
//从第一列找到需要的表头 //从第一列找到需要的表头
for (int i=0; i<colNum; i++){ for (int i = 0; i < colNum; i++) {
String cellData = getCellFormatValue(firstRow.getCell(i)); String cellData = getCellFormatValue(firstRow.getCell(i));
for(int j=0;j<columns.length;j++){ for (int j = 0; j < columns.length; j++) {
if(columns[j].equals(cellData)){ if (columns[j].equals(cellData)) {
map.put(columns[j],i); map.put(columns[j], i);
} }
} }
} }
//验证所需要的表头是否全 //验证所需要的表头是否全
Integer flag = 0; Integer flag = 0;
for(int i=0;i<columns.length;i++){ for (int i = 0; i < columns.length; i++) {
if(null != map.get(columns[i])){ if (null != map.get(columns[i])) {
flag ++; flag++;
} }
} }
if(flag != columns.length){ if (flag != columns.length) {
String str = " "; String str = " ";
for(int i=0;i<columns.length;i++){ for (int i = 0; i < columns.length; i++) {
str += "\""+columns[i]+"\""+(i == columns.length-1?"":", "); str += "\"" + columns[i] + "\"" + (i == columns.length - 1 ? "" : ", ");
} }
return JsonResult.failMessage("导入失败,表格表头应包含"+str); return JsonResult.failMessage("导入失败,表格表头应包含" + str);
} }
for (int i = 1; i<rowNum; i++) { for (int i = 1; i < rowNum; i++) {
Row row = sheet.getRow(i); Row row = sheet.getRow(i);
if(null == row){ if (null == row) {
errMsg.add(new String[]{"第"+(i+1)+"数据为空"}); errMsg.add(new String[]{"第" + (i + 1) + "数据为空"});
continue; continue;
} }
@ -284,73 +292,61 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
String lastStatus = getCellFormatValue(row.getCell(map.get(columns[10]))); String lastStatus = getCellFormatValue(row.getCell(map.get(columns[10])));
String createTime = getCellFormatValue(row.getCell(map.get(columns[11]))); String createTime = getCellFormatValue(row.getCell(map.get(columns[11])));
//TODO 判断(如重复等复杂判断要额外写) //TODO 判断(如重复等复杂判断要额外写)
if(StringUtils.isBlank(studentId)){ if (StringUtils.isBlank(studentId)) {
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[0])+1)+"列,第"+(i+1)+"行学生为空"}); errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[0]) + 1) + "列,第" + (i + 1) + "行学生为空"});
continue; continue;
}else } else if (StringUtils.isBlank(signinScore)) {
if(StringUtils.isBlank(signinScore)){ errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[1]) + 1) + "列,第" + (i + 1) + "行签到成绩为空"});
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行签到成绩为空"});
continue; continue;
}else } else if (StringUtils.isBlank(courseScore)) {
if(StringUtils.isBlank(courseScore)){ errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[2]) + 1) + "列,第" + (i + 1) + "行章节练习成绩为空"});
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[2])+1)+"列,第"+(i+1)+"行章节练习成绩为空"});
continue; continue;
}else } else if (StringUtils.isBlank(realOperationScore)) {
if(StringUtils.isBlank(realOperationScore)){ errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[3]) + 1) + "列,第" + (i + 1) + "行课程实操成绩为空"});
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[3])+1)+"列,第"+(i+1)+"行课程实操成绩为空"});
continue; continue;
}else } else if (StringUtils.isBlank(questionHomeworkScore)) {
if(StringUtils.isBlank(questionHomeworkScore)){ errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[4]) + 1) + "列,第" + (i + 1) + "行作业成绩为空"});
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[4])+1)+"列,第"+(i+1)+"行作业成绩为空"});
continue; continue;
}else } else if (StringUtils.isBlank(examScore)) {
if(StringUtils.isBlank(examScore)){ errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[5]) + 1) + "列,第" + (i + 1) + "行考试成绩为空"});
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[5])+1)+"列,第"+(i+1)+"行考试成绩为空"});
continue; continue;
}else } else if (StringUtils.isBlank(chatScore)) {
if(StringUtils.isBlank(chatScore)){ errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[6]) + 1) + "列,第" + (i + 1) + "行互动成绩为空"});
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[6])+1)+"列,第"+(i+1)+"行互动成绩为空"});
continue; continue;
}else } else if (StringUtils.isBlank(totalScore)) {
if(StringUtils.isBlank(totalScore)){ errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[7]) + 1) + "列,第" + (i + 1) + "行总成绩为空"});
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[7])+1)+"列,第"+(i+1)+"行总成绩为空"});
continue; continue;
}else } else if (StringUtils.isBlank(manualScore)) {
if(StringUtils.isBlank(manualScore)){ errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[8]) + 1) + "列,第" + (i + 1) + "行手动调整的分数为空"});
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[8])+1)+"列,第"+(i+1)+"行手动调整的分数为空"});
continue; continue;
}else } else if (StringUtils.isBlank(lastScore)) {
if(StringUtils.isBlank(lastScore)){ errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[9]) + 1) + "列,第" + (i + 1) + "行最终成绩为空"});
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[9])+1)+"列,第"+(i+1)+"行最终成绩为空"});
continue; continue;
}else } else if (StringUtils.isBlank(lastStatus)) {
if(StringUtils.isBlank(lastStatus)){ errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[10]) + 1) + "列,第" + (i + 1) + "行成绩状态为空"});
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[10])+1)+"列,第"+(i+1)+"行成绩状态为空"});
continue; continue;
}else } else if (StringUtils.isBlank(createTime)) {
if(StringUtils.isBlank(createTime)){ errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[11]) + 1) + "列,第" + (i + 1) + "行创建时间为空"});
errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[11])+1)+"列,第"+(i+1)+"行创建时间为空"});
continue; continue;
}else } else {
{ //TODO 保存
//TODO 保存 TeacherOpenCourseScoreDashboard teacherOpenCourseScoreDashboard = new TeacherOpenCourseScoreDashboard();
TeacherOpenCourseScoreDashboard teacherOpenCourseScoreDashboard = new TeacherOpenCourseScoreDashboard(); teacherOpenCourseScoreDashboard.setStudentId(Long.parseLong(studentId));
teacherOpenCourseScoreDashboard.setStudentId(Long.parseLong(studentId)); teacherOpenCourseScoreDashboard.setSigninScore(new BigDecimal(signinScore));
teacherOpenCourseScoreDashboard.setSigninScore(new BigDecimal(signinScore)); teacherOpenCourseScoreDashboard.setCourseScore(new BigDecimal(courseScore));
teacherOpenCourseScoreDashboard.setCourseScore(new BigDecimal(courseScore)); teacherOpenCourseScoreDashboard.setRealOperationScore(new BigDecimal(realOperationScore));
teacherOpenCourseScoreDashboard.setRealOperationScore(new BigDecimal(realOperationScore)); teacherOpenCourseScoreDashboard.setQuestionHomeworkScore(new BigDecimal(questionHomeworkScore));
teacherOpenCourseScoreDashboard.setQuestionHomeworkScore(new BigDecimal(questionHomeworkScore)); teacherOpenCourseScoreDashboard.setExamScore(new BigDecimal(examScore));
teacherOpenCourseScoreDashboard.setExamScore(new BigDecimal(examScore)); teacherOpenCourseScoreDashboard.setChatScore(new BigDecimal(chatScore));
teacherOpenCourseScoreDashboard.setChatScore(new BigDecimal(chatScore)); teacherOpenCourseScoreDashboard.setTotalScore(new BigDecimal(totalScore));
teacherOpenCourseScoreDashboard.setTotalScore(new BigDecimal(totalScore)); teacherOpenCourseScoreDashboard.setManualScore(new BigDecimal(manualScore));
teacherOpenCourseScoreDashboard.setManualScore(new BigDecimal(manualScore)); teacherOpenCourseScoreDashboard.setLastScore(new BigDecimal(lastScore));
teacherOpenCourseScoreDashboard.setLastScore(new BigDecimal(lastScore)); teacherOpenCourseScoreDashboard.setLastStatus(lastStatus);
teacherOpenCourseScoreDashboard.setLastStatus(lastStatus); teacherOpenCourseScoreDashboard.setOrgId(coreUser.getOrgId());
teacherOpenCourseScoreDashboard.setOrgId(coreUser.getOrgId()); teacherOpenCourseScoreDashboard.setUserId(coreUser.getId());
teacherOpenCourseScoreDashboard.setUserId(coreUser.getId()); teacherOpenCourseScoreDashboard.setCreateTime(TimeTool.getTime(createTime));
teacherOpenCourseScoreDashboard.setCreateTime(TimeTool.getTime(createTime));
count++;
count++;
} }
} }
} }
@ -358,19 +354,19 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
} }
} }
JsonResult jsonResult = new JsonResult(); JsonResult jsonResult = new JsonResult();
jsonResult.setCode(count>0?JsonReturnCode.SUCCESS.getCode():JsonReturnCode.FAIL.getCode()); jsonResult.setCode(count > 0 ? JsonReturnCode.SUCCESS.getCode() : JsonReturnCode.FAIL.getCode());
jsonResult.setData(errMsg); jsonResult.setData(errMsg);
jsonResult.setMsg((count>0?"导入成功,共导入"+count+"条":"导入失败")+(StringUtils.isNotBlank(msg)?"<br>"+msg:"")); jsonResult.setMsg((count > 0 ? "导入成功,共导入" + count + "条" : "导入失败") + (StringUtils.isNotBlank(msg) ? "<br>" + msg : ""));
return jsonResult; return jsonResult;
} }
public List<Map<String,Object>> getExcelValues (TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery){ public List<Map<String, Object>> getExcelValues(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery) {
return teacherOpenCourseScoreDashboardDao.getExcelValues(teacherOpenCourseScoreDashboardQuery); return teacherOpenCourseScoreDashboardDao.getExcelValues(teacherOpenCourseScoreDashboardQuery);
} }
public String getCellFormatValue(Cell cell) { public String getCellFormatValue(Cell cell) {
String value = null; String value = null;
if (cell != null){ if (cell != null) {
switch (cell.getCellTypeEnum()) { switch (cell.getCellTypeEnum()) {
case STRING: case STRING:
value = cell.getRichStringCellValue().getString(); value = cell.getRichStringCellValue().getString();
@ -401,17 +397,22 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
/** /**
* *
*
* @param teacherOpenCourseId id * @param teacherOpenCourseId id
* @return * @return
*/ */
public boolean updateGrades(Long teacherOpenCourseId) { public boolean updateGrades(Long teacherOpenCourseId) {
//查询权重 //查询权重
TeacherOpenCourseScoreWeight weight = weightDao.single(teacherOpenCourseId); TeacherOpenCourseScoreWeight weight = weightDao.single(teacherOpenCourseId);
TeacherOpenCourseMergeStudentQuery studentQuery = new TeacherOpenCourseMergeStudentQuery();
studentQuery.setTeacherOpenCourseId(teacherOpenCourseId);
List<TeacherOpenCourseMergeStudent> students = mergeStudentDao.getValuesByQueryNotWithPermission(studentQuery);
//todo 查询签到成绩,章节练习成绩,课程实操成绩,作业成绩,考试成绩,互动成绩 //todo 查询签到成绩,章节练习成绩,课程实操成绩,作业成绩,考试成绩,互动成绩
List<TeacherOpenCourseScoreDashboard> studentScores = new ArrayList<>(); List<TeacherOpenCourseScoreDashboard> studentScores = new ArrayList<>();
for (int i = 0; i < 10; i++) { for (TeacherOpenCourseMergeStudent student : students) {
TeacherOpenCourseScoreDashboard scoreDashboard = new TeacherOpenCourseScoreDashboard(); TeacherOpenCourseScoreDashboard scoreDashboard = new TeacherOpenCourseScoreDashboard();
scoreDashboard.setStudentId(i+1L); scoreDashboard.setStudentId(student.getStudentId());
BigDecimal signinScore = BigDecimal.valueOf(new Random().nextInt(100)); BigDecimal signinScore = BigDecimal.valueOf(new Random().nextInt(100));
scoreDashboard.setSigninScore(signinScore); scoreDashboard.setSigninScore(signinScore);
BigDecimal courseScore = BigDecimal.valueOf(new Random().nextInt(100)); BigDecimal courseScore = BigDecimal.valueOf(new Random().nextInt(100));
@ -424,7 +425,7 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
scoreDashboard.setExamScore(examScore); scoreDashboard.setExamScore(examScore);
BigDecimal chatScore = BigDecimal.valueOf(new Random().nextInt(100)); BigDecimal chatScore = BigDecimal.valueOf(new Random().nextInt(100));
scoreDashboard.setChatScore(chatScore); scoreDashboard.setChatScore(chatScore);
BigDecimal totalScore= signinScore.add(courseScore) BigDecimal totalScore = signinScore.add(courseScore)
.add(realOperationScore) .add(realOperationScore)
.add(questionHomeworkScore) .add(questionHomeworkScore)
.add(examScore) .add(examScore)
@ -448,44 +449,44 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
if ("1".equals(resultStatusSetting)) { if ("1".equals(resultStatusSetting)) {
if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getDichotomyScore())) > 0) { if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getDichotomyScore())) > 0) {
scoreDashboard.setLastStatus("及格"); scoreDashboard.setLastStatus("及格");
}else { } else {
scoreDashboard.setLastStatus("不及格"); scoreDashboard.setLastStatus("不及格");
} }
}else if("2".equals(resultStatusSetting)){ } else if ("2".equals(resultStatusSetting)) {
if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getExcellentScore()))>=0) { if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getExcellentScore())) >= 0) {
scoreDashboard.setLastStatus("优秀"); scoreDashboard.setLastStatus("优秀");
}else if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getGoodScore()))>=0) { } else if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getGoodScore())) >= 0) {
scoreDashboard.setLastStatus("良好"); scoreDashboard.setLastStatus("良好");
}else if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getSecondaryScore()))>=0) { } else if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getSecondaryScore())) >= 0) {
scoreDashboard.setLastStatus("中等"); scoreDashboard.setLastStatus("中等");
}else if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getPassScore()))>=0) { } else if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getPassScore())) >= 0) {
scoreDashboard.setLastStatus("及格"); scoreDashboard.setLastStatus("及格");
}else { } else {
scoreDashboard.setLastStatus("不及格"); scoreDashboard.setLastStatus("不及格");
} }
}else if("3".equals(resultStatusSetting)){ } else if ("3".equals(resultStatusSetting)) {
if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getLetteraScore()))>=0) { if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getLetteraScore())) >= 0) {
scoreDashboard.setLastStatus("A"); scoreDashboard.setLastStatus("A");
}else if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getLetterbScore()))>=0) { } else if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getLetterbScore())) >= 0) {
scoreDashboard.setLastStatus("B"); scoreDashboard.setLastStatus("B");
}else if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getLettercScore()))>=0) { } else if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getLettercScore())) >= 0) {
scoreDashboard.setLastStatus("C"); scoreDashboard.setLastStatus("C");
}else if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getLetterdScore()))>=0) { } else if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getLetterdScore())) >= 0) {
scoreDashboard.setLastStatus("D"); scoreDashboard.setLastStatus("D");
}else { } else {
scoreDashboard.setLastStatus("E"); scoreDashboard.setLastStatus("E");
} }
}else { } else {
if (NumberUtil.compare(totalScore.longValue(), 60) > 0) { if (NumberUtil.compare(totalScore.longValue(), 60) > 0) {
scoreDashboard.setLastStatus("及格"); scoreDashboard.setLastStatus("及格");
}else { } else {
scoreDashboard.setLastStatus("不及格"); scoreDashboard.setLastStatus("不及格");
} }
} }
}else { } else {
if (NumberUtil.compare(totalScore.longValue(), 60) > 0) { if (NumberUtil.compare(totalScore.longValue(), 60) > 0) {
scoreDashboard.setLastStatus("及格"); scoreDashboard.setLastStatus("及格");
}else { } else {
scoreDashboard.setLastStatus("不及格"); scoreDashboard.setLastStatus("不及格");
} }
} }

Loading…
Cancel
Save