beetlsql3-dev
xuliangtong 3 years ago
parent 3df45ee621
commit 202033198a

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -96,3 +96,46 @@ CREATE TABLE `hands_on_achievement` (
`user_id` bigint(20) DEFAULT NULL COMMENT '后台用户ID',
PRIMARY KEY (`hand_on_achievement_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=244 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='课程实操-实操成绩';
create table teacher_open_course_score_weight
(
teacher_open_course_id bigint not null comment '课程id',
teacher_id bigint comment '老师id',
sign_in_result varchar(255) comment '签到成绩(权重)',
chapter_contact_result varchar(255) comment '章节联系成绩(权重)',
course_practice_result varchar(255) comment '课程实操成绩(权重)',
homework_result varchar(255) comment '作业成绩(权重)',
examination_result varchar(255) comment '考试成绩(权重)',
interaction_result varchar(255) comment '互动成绩(权重)',
sign_in_result_setting varchar(255) comment '签到成绩设置1签到次数2到课到率',
sign_in_score varchar(255) comment '签到次数_每签到一次分数',
chapter_contact_result_setting varchar(255) comment '章节联系设置1正确率积分2平均完成度计分',
course_practice_result_setting varchar(255) comment '课程实操成绩设置1平均分2平均完成进度',
homework_result_setting varchar(255) comment '作业成绩设置1平均分(默认1)',
examination_result_setting varchar(255) comment '考试成绩设置1平均分(默认1)',
interaction_result_setting varchar(255) comment '互动成绩设置1留言2提问3回答',
interaction_result_message_score varchar(255) comment '互动成绩留言得分',
interaction_result_question_score varchar(255) comment '互动成绩提问得分',
interaction_result_answer_score varchar(255) comment '互动成绩回答得分',
result_status_setting varchar(255) comment '成绩状态设置1二分法2等级法3字母法',
dichotomy_score varchar(255) comment '二分法分数',
excellent_score varchar(255) comment '等级法优秀分数',
good_score varchar(255) comment '等级法良好分数',
secondary_score varchar(255) comment '等级法中等分数',
pass_score varchar(255) comment '等级法及格分数',
lettera_score varchar(255) comment '字母法A分数',
letterb_score varchar(255) comment '字母法B分数',
letterc_score varchar(255) comment '字母法C分数',
letterd_score varchar(255) comment '字母法D分数',
org_id bigint comment '组织ID',
user_id bigint comment '用户ID',
create_time bigint comment '创建时间',
primary key (teacher_open_course_id)
)
auto_increment = 1
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
alter table teacher_open_course_score_weight comment '教师-我的课程-成绩权重';

@ -1,16 +1,18 @@
package com.ibeetl.jlw.dao;
import com.ibeetl.jlw.entity.TeacherOpenCourseScoreDashboard;
import java.util.List;
import java.util.Map;
import com.ibeetl.jlw.entity.*;
import com.ibeetl.jlw.web.query.TeacherOpenCourseScoreDashboardQuery;
import org.beetl.sql.core.engine.PageQuery;
import org.beetl.sql.mapper.BaseMapper;
import org.beetl.sql.mapper.annotation.SqlResource;
import org.beetl.sql.mapper.BaseMapper;
import org.beetl.sql.core.engine.PageQuery;
import org.beetl.sql.mapper.annotation.Update;
import java.util.List;
/**
* Dao
* Dao
*/
@SqlResource("jlw.teacherOpenCourseScoreDashboard")
public interface TeacherOpenCourseScoreDashboardDao extends BaseMapper<TeacherOpenCourseScoreDashboard>{
@ -22,4 +24,5 @@ public interface TeacherOpenCourseScoreDashboardDao extends BaseMapper<TeacherOp
int updateGivenByIds(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery);
List<TeacherOpenCourseScoreDashboard> getByIds(String ids);
List<TeacherOpenCourseScoreDashboard> getValuesByQuery(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery);
List<Map<String,Object>>getExcelValues(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery);
}

@ -1,17 +1,20 @@
package com.ibeetl.jlw.entity;
import com.ibeetl.admin.core.annotation.Dict;
import javax.validation.constraints.NotNull;
import com.ibeetl.admin.core.entity.BaseEntity;
import org.beetl.sql.annotation.entity.*;
import com.ibeetl.admin.core.util.ValidateConfig;
import org.beetl.sql.annotation.entity.AssignID;
import javax.validation.constraints.NotNull;
import com.ibeetl.admin.core.annotation.Dict;
import java.math.BigDecimal;
import java.util.Date;
/*
* --
* gen by Spring Boot2 Admin 2022-09-15
* gen by Spring Boot2 Admin 2022-09-29
*/
public class TeacherOpenCourseScoreDashboard extends BaseEntity{
@ -23,7 +26,6 @@ public class TeacherOpenCourseScoreDashboard extends BaseEntity{
private Long teacherOpenCourseScoreDashboardId ;
//学生ID
@Dict(type="student.student_name.student_status=1")
private Long studentId ;

@ -1,27 +1,43 @@
package com.ibeetl.jlw.service;
import java.io.*;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.math.BigDecimal;
import cn.jlw.util.ToolUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ibeetl.admin.core.service.CoreBaseService;
import com.ibeetl.admin.core.util.PlatformException;
import com.ibeetl.admin.core.entity.CoreUser;
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.TeacherOpenCourseScoreDashboardDao;
import com.ibeetl.jlw.entity.TeacherOpenCourseScoreDashboard;
import com.ibeetl.jlw.web.query.TeacherOpenCourseScoreDashboardQuery;
import com.ibeetl.jlw.entity.FileEntity;
import com.ibeetl.admin.core.service.CoreBaseService;
import com.ibeetl.admin.core.util.PlatformException;
import org.apache.commons.lang3.StringUtils;
import org.beetl.sql.core.SqlId;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.beetl.sql.core.engine.PageQuery;
import org.beetl.sql.core.SqlId;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* Service
* Service
* ID使insert(*,true)
*/
@ -58,7 +74,7 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
try {
teacherOpenCourseScoreDashboardDao.deleteTeacherOpenCourseScoreDashboardByIds(ids);
} catch (Exception e) {
throw new PlatformException("批量删除开课成绩看板失败", e);
throw new PlatformException("批量删除成绩失败", e);
}
}
@ -144,4 +160,223 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
}
}
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++){
FileEntity fileEntity = fileEntityList.get(item);
if(null != fileEntity){
File file = new File(fileEntity.getAbsoluteUrl());
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())){
wb = new HSSFWorkbook(is);
}else if("xlsx".equals(fileEntity.getFormat())){
wb = new XSSFWorkbook(is);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
if(null != is){
is.close();
}
}catch (Exception e){
e.printStackTrace();
}
if(wb != null){
//获取Sheet1
Sheet sheet = wb.getSheet("Sheet1");
//获取最大行数
int rowNum = sheet.getPhysicalNumberOfRows();
//获取第一行
Row firstRow = sheet.getRow(0);
//获取最大列数
int colNum = firstRow.getPhysicalNumberOfCells();
String columns[] = {
"学生",
"签到成绩",
"章节练习成绩",
"课程实操成绩",
"作业成绩",
"考试成绩",
"互动成绩",
"总成绩",
"手动调整的分数",
"最终成绩",
"成绩状态",
"创建时间"
};
Map<String,Integer> map = new HashMap<>();//获取需要的表头的列
//从第一列找到需要的表头
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);
}
}
}
//验证所需要的表头是否全
Integer flag = 0;
for(int i=0;i<columns.length;i++){
if(null != map.get(columns[i])){
flag ++;
}
}
if(flag != columns.length){
String str = " ";
for(int i=0;i<columns.length;i++){
str += "\""+columns[i]+"\""+(i == columns.length-1?"":", ");
}
return JsonResult.failMessage("导入失败,表格表头应包含"+str);
}
for (int i = 1; i<rowNum; i++) {
Row row = sheet.getRow(i);
if(null == row){
errMsg.add(new String[]{"第"+(i+1)+"数据为空"});
continue;
}
String studentId = getCellFormatValue(row.getCell(map.get(columns[0])));
String signinScore = getCellFormatValue(row.getCell(map.get(columns[1])));
String courseScore = getCellFormatValue(row.getCell(map.get(columns[2])));
String realOperationScore = getCellFormatValue(row.getCell(map.get(columns[3])));
String questionHomeworkScore = getCellFormatValue(row.getCell(map.get(columns[4])));
String examScore = getCellFormatValue(row.getCell(map.get(columns[5])));
String chatScore = getCellFormatValue(row.getCell(map.get(columns[6])));
String totalScore = getCellFormatValue(row.getCell(map.get(columns[7])));
String manualScore = getCellFormatValue(row.getCell(map.get(columns[8])));
String lastScore = getCellFormatValue(row.getCell(map.get(columns[9])));
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)+"行学生为空"});
continue;
}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)+"行章节练习成绩为空"});
continue;
}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)+"行作业成绩为空"});
continue;
}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)+"行互动成绩为空"});
continue;
}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)+"行手动调整的分数为空"});
continue;
}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)+"行成绩状态为空"});
continue;
}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++;
}
}
}
}
}
}
JsonResult jsonResult = new JsonResult();
jsonResult.setCode(count>0?JsonReturnCode.SUCCESS.getCode():JsonReturnCode.FAIL.getCode());
jsonResult.setData(errMsg);
jsonResult.setMsg((count>0?"导入成功,共导入"+count+"条":"导入失败")+(StringUtils.isNotBlank(msg)?"<br>"+msg:""));
return jsonResult;
}
public List<Map<String,Object>> getExcelValues (TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery){
return teacherOpenCourseScoreDashboardDao.getExcelValues(teacherOpenCourseScoreDashboardQuery);
}
public String getCellFormatValue(Cell cell) {
String value = null;
if (cell != null){
switch (cell.getCellTypeEnum()) {
case STRING:
value = cell.getRichStringCellValue().getString();
break;
case NUMERIC:
String dataFormatString = cell.getCellStyle().getDataFormatString();
if ("m/d/yy".equals(dataFormatString) || "yyyy-mm-dd".equals(dataFormatString)) {
DateFormat df = new SimpleDateFormat(dataFormatString);
value = TimeTool.getNowTime(df.format(cell.getDateCellValue()));
} else {
DecimalFormat df = new DecimalFormat("#");
value = df.format(cell.getNumericCellValue());
}
break;
case BOOLEAN:
value = String.valueOf(cell.getBooleanCellValue());
break;
case FORMULA:
value = cell.getCellFormula();
break;
default:
break;
}
}
return value;
}
}

@ -1,53 +1,85 @@
package com.ibeetl.jlw.web;
import cn.jlw.Interceptor.RFile;
import cn.jlw.Interceptor.SCoreUser;
import cn.jlw.Interceptor.GetFile;
import cn.jlw.util.ToolUtils;
import cn.jlw.validate.ValidateConfig;
import com.ibeetl.admin.core.annotation.Function;
import com.ibeetl.admin.core.entity.CoreUser;
import com.ibeetl.admin.core.file.FileService;
import com.ibeetl.admin.core.util.ConvertUtil;
import com.ibeetl.admin.core.util.PlatformException;
import com.ibeetl.admin.core.util.TimeTool;
import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.jlw.entity.TeacherOpenCourseScoreDashboard;
import com.ibeetl.jlw.service.TeacherOpenCourseScoreDashboardService;
import com.ibeetl.jlw.web.query.TeacherOpenCourseScoreDashboardQuery;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.validation.annotation.Validated;
import com.ibeetl.admin.console.web.dto.DictExcelImportData;
import com.ibeetl.admin.console.web.query.UserQuery;
import com.ibeetl.admin.core.annotation.Function;
import com.ibeetl.jlw.entity.*;
import com.ibeetl.jlw.service.*;
import com.ibeetl.jlw.web.query.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import javax.annotation.Resource;
/**
* --
* --
* 线
*/
@RestController
public class TeacherOpenCourseScoreDashboardController{
public class TeacherOpenCourseScoreDashboardController {
private final Log log = LogFactory.getLog(this.getClass());
private static final String MODEL = "/jlw/teacherOpenCourseScoreDashboard";
private static final String API = "/api/teacherOpenCourseScoreDashboard";
@Resource private TeacherOpenCourseScoreDashboardService teacherOpenCourseScoreDashboardService;
@Resource
private TeacherOpenCourseScoreDashboardService teacherOpenCourseScoreDashboardService;
@Resource FileService fileService;
@Resource
FileService fileService;
/* 前端接口 */
@PostMapping(API + "/getPageList.do")
public JsonResult<PageQuery> getPageList(TeacherOpenCourseScoreDashboardQuery condition,@SCoreUser CoreUser coreUser){
if(null == coreUser){
public JsonResult<PageQuery> getPageList(TeacherOpenCourseScoreDashboardQuery condition, @SCoreUser CoreUser coreUser) {
if (null == coreUser) {
return JsonResult.failMessage("请登录后再操作");
}else{
} else {
PageQuery page = condition.getPageQuery();
teacherOpenCourseScoreDashboardService.queryByConditionQuery(page);
return JsonResult.success(page);
@ -56,23 +88,23 @@ public class TeacherOpenCourseScoreDashboardController{
@GetMapping(API + "/getInfo.do")
public JsonResult<TeacherOpenCourseScoreDashboard>getInfo(TeacherOpenCourseScoreDashboardQuery param,@SCoreUser CoreUser coreUser) {
if(null == coreUser){
public JsonResult<TeacherOpenCourseScoreDashboard> getInfo(TeacherOpenCourseScoreDashboardQuery param, @SCoreUser CoreUser coreUser) {
if (null == coreUser) {
return JsonResult.failMessage("请登录后再操作");
}else{
} else {
TeacherOpenCourseScoreDashboard teacherOpenCourseScoreDashboard = teacherOpenCourseScoreDashboardService.getInfo(param);
return JsonResult.success(teacherOpenCourseScoreDashboard);
return JsonResult.success(teacherOpenCourseScoreDashboard);
}
}
@GetMapping(API + "/getList.do")
public JsonResult<List<TeacherOpenCourseScoreDashboard>>getList(TeacherOpenCourseScoreDashboardQuery param,@SCoreUser CoreUser coreUser) {
if(null == coreUser){
public JsonResult<List<TeacherOpenCourseScoreDashboard>> getList(TeacherOpenCourseScoreDashboardQuery param, @SCoreUser CoreUser coreUser) {
if (null == coreUser) {
return JsonResult.failMessage("请登录后再操作");
}else{
List<TeacherOpenCourseScoreDashboard>list = teacherOpenCourseScoreDashboardService.getValuesByQuery(param);
return JsonResult.success(list);
} else {
List<TeacherOpenCourseScoreDashboard> list = teacherOpenCourseScoreDashboardService.getValuesByQuery(param);
return JsonResult.success(list);
}
}
@ -82,7 +114,7 @@ public class TeacherOpenCourseScoreDashboardController{
@GetMapping(MODEL + "/index.do")
@Function("teacherOpenCourseScoreDashboard.query")
public ModelAndView index() {
ModelAndView view = new ModelAndView("/jlw/teacherOpenCourseScoreDashboard/index.html") ;
ModelAndView view = new ModelAndView("/jlw/teacherOpenCourseScoreDashboard/index.html");
view.addObject("search", TeacherOpenCourseScoreDashboardQuery.class.getName());
return view;
}
@ -100,10 +132,10 @@ public class TeacherOpenCourseScoreDashboardController{
@Function("teacherOpenCourseScoreDashboard.add")
public ModelAndView add(Long teacherOpenCourseScoreDashboardId) {
ModelAndView view = new ModelAndView("/jlw/teacherOpenCourseScoreDashboard/add.html");
if(null != teacherOpenCourseScoreDashboardId){
if (null != teacherOpenCourseScoreDashboardId) {
TeacherOpenCourseScoreDashboard teacherOpenCourseScoreDashboard = teacherOpenCourseScoreDashboardService.queryById(teacherOpenCourseScoreDashboardId);
view.addObject("teacherOpenCourseScoreDashboard", teacherOpenCourseScoreDashboard);
}else {
} else {
view.addObject("teacherOpenCourseScoreDashboard", new TeacherOpenCourseScoreDashboard());
}
return view;
@ -113,7 +145,7 @@ public class TeacherOpenCourseScoreDashboardController{
@PostMapping(MODEL + "/list.json")
@Function("teacherOpenCourseScoreDashboard.query")
public JsonResult<PageQuery> list(TeacherOpenCourseScoreDashboardQuery condition){
public JsonResult<PageQuery> list(TeacherOpenCourseScoreDashboardQuery condition) {
PageQuery page = condition.getPageQuery();
teacherOpenCourseScoreDashboardService.queryByCondition(page);
return JsonResult.success(page);
@ -121,29 +153,29 @@ public class TeacherOpenCourseScoreDashboardController{
@PostMapping(MODEL + "/addAll.json")
@Function("teacherOpenCourseScoreDashboard.add")
public JsonResult addAll(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery,@SCoreUser CoreUser coreUser){
if(null == coreUser){
public JsonResult addAll(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery, @SCoreUser CoreUser coreUser) {
if (null == coreUser) {
return JsonResult.failMessage("请登录后再操作");
}else{
teacherOpenCourseScoreDashboardQuery.setUserId(coreUser.getId());
teacherOpenCourseScoreDashboardQuery.setOrgId(coreUser.getOrgId());
} else {
teacherOpenCourseScoreDashboardQuery.setUserId(coreUser.getId());
teacherOpenCourseScoreDashboardQuery.setOrgId(coreUser.getOrgId());
String msg = teacherOpenCourseScoreDashboardService.addAll(teacherOpenCourseScoreDashboardQuery);
if (StringUtils.isBlank(msg)) {
return JsonResult.success();
} else {
return JsonResult.failMessage("新增失败,"+msg);
return JsonResult.failMessage("新增失败," + msg);
}
}
}
@PostMapping(MODEL + "/add.json")
@Function("teacherOpenCourseScoreDashboard.add")
public JsonResult add(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery, BindingResult result,@SCoreUser CoreUser coreUser){
if(result.hasErrors()){
public JsonResult add(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery, BindingResult result, @SCoreUser CoreUser coreUser) {
if (result.hasErrors()) {
return JsonResult.failMessage(result);
}else{
teacherOpenCourseScoreDashboardQuery.setUserId(coreUser.getId());
teacherOpenCourseScoreDashboardQuery.setOrgId(coreUser.getOrgId());
} else {
teacherOpenCourseScoreDashboardQuery.setUserId(coreUser.getId());
teacherOpenCourseScoreDashboardQuery.setOrgId(coreUser.getOrgId());
return teacherOpenCourseScoreDashboardService.add(teacherOpenCourseScoreDashboardQuery);
}
}
@ -151,16 +183,16 @@ public class TeacherOpenCourseScoreDashboardController{
@PostMapping(MODEL + "/edit.json")
@Function("teacherOpenCourseScoreDashboard.edit")
public JsonResult<String> update(@Validated(ValidateConfig.UPDATE.class) TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery, BindingResult result) {
if(result.hasErrors()){
if (result.hasErrors()) {
return JsonResult.failMessage(result);
}else {
teacherOpenCourseScoreDashboardQuery.setUserId(null);
teacherOpenCourseScoreDashboardQuery.setOrgId(null);
} else {
teacherOpenCourseScoreDashboardQuery.setUserId(null);
teacherOpenCourseScoreDashboardQuery.setOrgId(null);
String msg = teacherOpenCourseScoreDashboardService.edit(teacherOpenCourseScoreDashboardQuery);
if (StringUtils.isBlank(msg)) {
return JsonResult.success();
} else {
return JsonResult.failMessage("更新失败,"+msg);
return JsonResult.failMessage("更新失败," + msg);
}
}
}
@ -168,16 +200,16 @@ public class TeacherOpenCourseScoreDashboardController{
@GetMapping(MODEL + "/view.json")
@Function("teacherOpenCourseScoreDashboard.query")
public JsonResult<TeacherOpenCourseScoreDashboard>queryInfo(Long teacherOpenCourseScoreDashboardId) {
TeacherOpenCourseScoreDashboard teacherOpenCourseScoreDashboard = teacherOpenCourseScoreDashboardService.queryById( teacherOpenCourseScoreDashboardId);
return JsonResult.success(teacherOpenCourseScoreDashboard);
public JsonResult<TeacherOpenCourseScoreDashboard> queryInfo(Long teacherOpenCourseScoreDashboardId) {
TeacherOpenCourseScoreDashboard teacherOpenCourseScoreDashboard = teacherOpenCourseScoreDashboardService.queryById(teacherOpenCourseScoreDashboardId);
return JsonResult.success(teacherOpenCourseScoreDashboard);
}
@GetMapping(MODEL + "/getValues.json")
@Function("teacherOpenCourseScoreDashboard.query")
public JsonResult<List<TeacherOpenCourseScoreDashboard>>getValues(TeacherOpenCourseScoreDashboardQuery param) {
List<TeacherOpenCourseScoreDashboard>list = teacherOpenCourseScoreDashboardService.getValuesByQuery(param);
return JsonResult.success(list);
public JsonResult<List<TeacherOpenCourseScoreDashboard>> getValues(TeacherOpenCourseScoreDashboardQuery param) {
List<TeacherOpenCourseScoreDashboard> list = teacherOpenCourseScoreDashboardService.getValuesByQuery(param);
return JsonResult.success(list);
}
@ -190,4 +222,210 @@ public class TeacherOpenCourseScoreDashboardController{
}
//下载模板信息
@GetMapping(MODEL + "/downloadTemplate.json")
public void download(HttpServletRequest request, HttpServletResponse response, @SCoreUser CoreUser coreUser) {
if (null == coreUser) {
return;
}
XSSFWorkbook workbook = null;
InputStream is = null;
try {
//TODO 改导入模板名字
is = new FileInputStream(GetFile.p + File.separator + "filesystem" + File.separator + "template" + File.separator + "导入模板.xlsx");
workbook = new XSSFWorkbook(is);
try {
if (null != is) {
is.close();
}
} catch (Exception e) {
e.printStackTrace();
}
//准备将Excel的输出流通过response输出到页面下载
//八进制输出流
response.setContentType("application/octet-stream");
//这后面可以设置导出Excel的名称此例中名为template.xls
response.setHeader("Content-disposition", "attachment;filename=competitionTeacher(" + TimeTool.getNowTime("YMD") + ").xls");
//刷新缓冲
response.flushBuffer();
//workbook将Excel写入到response的输出流中供页面下载
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != workbook) {
workbook.close();
}
if (null != response && null != response.getOutputStream()) {
response.getOutputStream().close();
}
} catch (Exception e) {
}
}
}
//导入模板信息
@PostMapping(MODEL + "/importTemplate.json")
@Function("teacherOpenCourseScoreDashboard.importTemplate")
public JsonResult importTemplate(@RFile List<FileEntity> fileEntityList, @SCoreUser CoreUser coreUser) {
if (null == coreUser) {
return JsonResult.failMessage("请登录后再操作");
}
List<Long> list = new ArrayList<>();
JsonResult jsonResult = teacherOpenCourseScoreDashboardService.importTemplate(fileEntityList, list, coreUser);
if (list.size() > 0) {
teacherOpenCourseScoreDashboardService.deleteByList(list);
}
return jsonResult;
}
//导出信息
@RequestMapping(MODEL + "/excel/export.json")
public void export(HttpServletRequest request, HttpServletResponse response, TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery, @SCoreUser CoreUser coreUser) {
if (null == coreUser) {
return;
}
HSSFWorkbook workbook = null;
try {
//表头数据
String[] header = {
"学生",
"签到成绩",
"章节练习成绩",
"课程实操成绩",
"作业成绩",
"考试成绩",
"互动成绩",
"总成绩",
"手动调整的分数",
"最终成绩",
"成绩状态",
"创建时间"
};
String[] headerCode = {
"studentId",
"signinScore",
"courseScore",
"realOperationScore",
"questionHomeworkScore",
"examScore",
"chatScore",
"totalScore",
"manualScore",
"lastScore",
"lastStatus",
"createTime"
};
//数据内容
List<Map<String, Object>> mapList = teacherOpenCourseScoreDashboardService.getExcelValues(teacherOpenCourseScoreDashboardQuery);
//内容宽度
Map<String, Object> widthMap = mapList.get(0);
mapList.remove(0);
//声明一个工作簿
workbook = new HSSFWorkbook();
//生成一个表格,设置表格名称为"Sheet1"
HSSFSheet sheet = workbook.createSheet("Sheet1");
//冻结表头
sheet.createFreezePane(0, 1, 0, 1);
//设置默认列宽度为5个字节
sheet.setDefaultColumnWidth(5);
//创建第一行表头
HSSFRow headRow = sheet.createRow(0);
//头部样式
HSSFCellStyle headerStyle = workbook.createCellStyle();
//垂直居中
headerStyle.setVerticalAlignment(headerStyle.getVerticalAlignmentEnum().CENTER);
//水平居中
headerStyle.setAlignment(HorizontalAlignment.CENTER);
//单元格样式
HSSFCellStyle cellStyle = workbook.createCellStyle();
//垂直居中
cellStyle.setVerticalAlignment(cellStyle.getVerticalAlignmentEnum().CENTER);
//水平居左
cellStyle.setAlignment(HorizontalAlignment.CENTER);
//自动换行
cellStyle.setWrapText(true);
//遍历添加表头
for (int i = 0; i < header.length; i++) {
//设置表格特定的列宽度
if (null != widthMap.get(headerCode[i])) {
String width = widthMap.get(headerCode[i]).toString().split("\\.")[0];
Integer w = Integer.parseInt(width) > header[i].length() * 3 ? Integer.parseInt(width) : header[i].length() * 3;
sheet.setColumnWidth(i, w * 190);
}
//创建一个单元格
HSSFCell cell = headRow.createCell(i);
//创建一个内容对象
HSSFRichTextString text = new HSSFRichTextString(header[i]);
//将内容对象的文字内容写入到单元格中
cell.setCellValue(text);
//设置样式
cell.setCellStyle(headerStyle);
}
//遍历结果集,把内容加入表格
for (int i = 0; i < mapList.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
row.setHeight((short) (50 * 10));
Map<String, Object> map = mapList.get(i);
for (int j = 0; j < headerCode.length; j++) {
HSSFCell cell = row.createCell(j);
cell.setCellStyle(cellStyle);
HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " ");
cell.setCellValue(text);
}
}
//准备将Excel的输出流通过response输出到页面下载
//八进制输出流
response.setContentType("application/octet-stream");
//这后面可以设置导出Excel的名称此例中名为student.xls
response.setHeader("Content-disposition", "attachment;filename=competitionTeacher(" + TimeTool.getNowTime("YMD") + ").xls");
//刷新缓冲
response.flushBuffer();
//workbook将Excel写入到response的输出流中供页面下载
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != workbook) {
workbook.close();
}
if (null != response && null != response.getOutputStream()) {
response.getOutputStream().close();
}
} catch (Exception e) {
}
}
}
}

@ -1,22 +1,25 @@
package com.ibeetl.jlw.web.query;
import cn.jlw.validate.ValidateConfig;
import com.ibeetl.jlw.entity.TeacherOpenCourseScoreDashboard;
import org.apache.commons.lang3.StringUtils;
import com.ibeetl.admin.core.annotation.Query;
import com.ibeetl.admin.core.util.Tool;
import com.ibeetl.admin.core.util.enums.CoreDictType;
import com.ibeetl.admin.core.web.query.PageParam;
import com.ibeetl.jlw.entity.TeacherOpenCourseScoreDashboard;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
/**
*
*
*/
public class TeacherOpenCourseScoreDashboardQuery extends PageParam {
@NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
@Query(name = "课程开课-成绩看板ID", display = false)
private Long teacherOpenCourseScoreDashboardId;
@Query(name = "学生ID", display = true,type=Query.TYPE_DICT,dict="student.student_name.student_status=1")
@Query(name = "学生ID", display = false)
private Long studentId;
@Query(name = "签到成绩", display = false)
private BigDecimal signinScore;

@ -388,3 +388,161 @@ getValuesByQuery
getExcelValues
===
* 根据不为空的参数进行查询导入需要的参数
SELECT * FROM (
(
select
MAX(LENGTH(t.student_id)) student_id,
MAX(LENGTH(t.signin_score)) signin_score,
MAX(LENGTH(t.course_score)) course_score,
MAX(LENGTH(t.real_operation_score)) real_operation_score,
MAX(LENGTH(t.question_homework_score)) question_homework_score,
MAX(LENGTH(t.exam_score)) exam_score,
MAX(LENGTH(t.chat_score)) chat_score,
MAX(LENGTH(t.total_score)) total_score,
MAX(LENGTH(t.manual_score)) manual_score,
MAX(LENGTH(t.last_score)) last_score,
MAX(LENGTH(t.last_status)) last_status,
MAX(LENGTH(t.create_time)) create_time
from teacher_open_course_score_dashboard t
where 1=1 and #function("teacherOpenCourseScoreDashboard.query")#
@if(!isEmpty(teacherOpenCourseScoreDashboardId)){
and t.teacher_open_course_score_dashboard_id =#teacherOpenCourseScoreDashboardId#
@}
@if(!isEmpty(teacherOpenCourseScoreDashboardIdPlural)){
and find_in_set(t.teacher_open_course_score_dashboard_id,#teacherOpenCourseScoreDashboardIdPlural#)
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
@if(!isEmpty(signinScore)){
and t.signin_score =#signinScore#
@}
@if(!isEmpty(courseScore)){
and t.course_score =#courseScore#
@}
@if(!isEmpty(realOperationScore)){
and t.real_operation_score =#realOperationScore#
@}
@if(!isEmpty(questionHomeworkScore)){
and t.question_homework_score =#questionHomeworkScore#
@}
@if(!isEmpty(examScore)){
and t.exam_score =#examScore#
@}
@if(!isEmpty(chatScore)){
and t.chat_score =#chatScore#
@}
@if(!isEmpty(totalScore)){
and t.total_score =#totalScore#
@}
@if(!isEmpty(manualScore)){
and t.manual_score =#manualScore#
@}
@if(!isEmpty(lastScore)){
and t.last_score =#lastScore#
@}
@if(!isEmpty(lastStatus)){
and t.last_status =#lastStatus#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(orgIdPlural)){
and find_in_set(t.org_id,#orgIdPlural#)
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(userIdPlural)){
and find_in_set(t.user_id,#userIdPlural#)
@}
@if(!isEmpty(createTime)){
and t.create_time =#createTime#
@}
)
UNION ALL
(
select
t.student_id ,
t.signin_score ,
t.course_score ,
t.real_operation_score ,
t.question_homework_score ,
t.exam_score ,
t.chat_score ,
t.total_score ,
t.manual_score ,
t.last_score ,
t.last_status ,
t.create_time
from teacher_open_course_score_dashboard t
where 1=1 and #function("teacherOpenCourseScoreDashboard.query")#
@if(!isEmpty(teacherOpenCourseScoreDashboardId)){
and t.teacher_open_course_score_dashboard_id =#teacherOpenCourseScoreDashboardId#
@}
@if(!isEmpty(teacherOpenCourseScoreDashboardIdPlural)){
and find_in_set(t.teacher_open_course_score_dashboard_id,#teacherOpenCourseScoreDashboardIdPlural#)
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
@if(!isEmpty(signinScore)){
and t.signin_score =#signinScore#
@}
@if(!isEmpty(courseScore)){
and t.course_score =#courseScore#
@}
@if(!isEmpty(realOperationScore)){
and t.real_operation_score =#realOperationScore#
@}
@if(!isEmpty(questionHomeworkScore)){
and t.question_homework_score =#questionHomeworkScore#
@}
@if(!isEmpty(examScore)){
and t.exam_score =#examScore#
@}
@if(!isEmpty(chatScore)){
and t.chat_score =#chatScore#
@}
@if(!isEmpty(totalScore)){
and t.total_score =#totalScore#
@}
@if(!isEmpty(manualScore)){
and t.manual_score =#manualScore#
@}
@if(!isEmpty(lastScore)){
and t.last_score =#lastScore#
@}
@if(!isEmpty(lastStatus)){
and t.last_status =#lastStatus#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(orgIdPlural)){
and find_in_set(t.org_id,#orgIdPlural#)
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(userIdPlural)){
and find_in_set(t.user_id,#userIdPlural#)
@}
@if(!isEmpty(createTime)){
and t.create_time =#createTime#
@}
)
)t

@ -79,6 +79,10 @@ layui.define([ 'form', 'laydate', 'table','element','handsOnSimulationTasksApi',
editor.setToolbarAutoFixed(false);
}
}
$("input[name='taskTitle']").val("");
$("input[name='taskScore']").val("");
$("input[name='taskOrder']").val("");
$("input[name='assessmentTime']").val("");
});
exports('add',view);
});

@ -2,7 +2,18 @@
layui.define([], function(exports) {
var api={
updateHandsOnSimulationTasks:function(form,callback){
Lib.submitForm("/jlw/handsOnSimulationTasks/edit.json",form,{},callback)
var formPara = form.serializeJson();
console.log(formPara)
var taskTitleElement = formPara.taskTitle[0];
var taskScoreElement = formPara.taskScore[0];
var taskOrderElement = formPara.taskOrder[0];
var assessmentTime = formPara.assessmentTime[0];
formPara.taskTitle = taskTitleElement;
formPara.taskScore = taskScoreElement;
formPara.taskOrder = taskOrderElement;
formPara.assessmentTime = assessmentTime;
console.log(formPara)
Lib.submitForm("/jlw/handsOnSimulationTasks/edit.json",form,formPara,callback)
},
addHandsOnSimulationTasks:function(form,callback){
var formPara = form.serializeJson();

@ -9,7 +9,7 @@ layui.define(['table', 'teacherOpenCourseScoreDashboardApi'], function(exports)
if(data==null){
return ;
}
Common.openConfirm("确认要删除这些开课成绩看板?",function(){
Common.openConfirm("确认要删除这些成绩?",function(){
var ids =Common.concatBatchId(data,"teacherOpenCourseScoreDashboardId");
teacherOpenCourseScoreDashboardApi.del(ids,function(){
Common.info("删除成功");

@ -12,6 +12,13 @@ layui.define([], function(exports) {
callback();
})
}
,
exportExcel:function(form,callback){
var formPara = form.serializeJson();
Common.getAjax("/jlw/teacherOpenCourseScoreDashboard/excel/export.json", formPara, function(fileId) {
callback(fileId);
})
}
};
exports('teacherOpenCourseScoreDashboardApi',api);

@ -6,8 +6,7 @@
<div class="layui-inline">
<label class="layui-form-label">学生ID</label>
<div class="layui-input-inline">
<layui:simpleDictSelect style='layui-input-inline' type="student.student_name.student_status=1"
id="studentId" name="studentId" value="${teacherOpenCourseScoreDashboard.studentId}" layVerify="" />
<input type="text" id="studentId" name="studentId" value="${teacherOpenCourseScoreDashboard.studentId}" class="layui-input" >
</div>
</div>
<div class="layui-inline">

@ -6,8 +6,7 @@
<div class="layui-inline">
<label class="layui-form-label">学生ID</label>
<div class="layui-input-inline">
<layui:simpleDictSelect style='layui-input-inline' type="student.student_name.student_status=1"
id="studentId" name="studentId" value="${teacherOpenCourseScoreDashboard.studentId}" layVerify="" />
<input type="text" id="studentId" name="studentId" value="${teacherOpenCourseScoreDashboard.studentId}" class="layui-input" >
</div>
</div>
<div class="layui-inline">

@ -16,6 +16,7 @@
<!--# if(!isEmpty(search)) {-->
<layui:accessButton function="teacherOpenCourseScoreDashboard.query" action="refresh"><i class="layui-icon">&#xe669;</i>刷新</layui:accessButton>
<!--# }-->
<layui:accessButton function="teacherOpenCourseScoreDashboard.exportDocument" action="exportDocument">导出</layui:accessButton>
</div>
</div>
</script>

Loading…
Cancel
Save