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