Commit 5ae57e55 by zhaopanyu

Merge branch 'master' of 49.232.152.146:xhxy/smart_school

parents 252c0441 d011f37f
...@@ -88,20 +88,20 @@ spring: ...@@ -88,20 +88,20 @@ spring:
# redis 配置 # redis 配置
redis: redis:
# 地址 # 地址
host: localhost # host: localhost
# host: 43.143.63.140 host: 43.143.63.140
# host: 47.105.176.202 # host: 47.105.176.202
# host: 127.0.0.1 # host: 127.0.0.1
# 端口,默认为6379 # 端口,默认为6379
# port: 8134 # port: 8134
port: 6379 # port: 6379
# port: 16379 port: 16379
# port: 9121 # port: 9121
# 数据库索引 # 数据库索引
database: 11 database: 11
# 密码 # 密码
password: # password:
# password: lbt18062367596 password: lbt18062367596
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
lettuce: lettuce:
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button type="success" icon="el-icon-download" size="mini" @click="upload.open = true">导入</el-button> <el-button type="success" icon="el-icon-download" size="mini" @click="upload.open = true">导入</el-button>
<el-button type="warning" icon="el-icon-upload2" size="mini" @click="exportRecord">导出</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
...@@ -493,6 +494,23 @@ export default { ...@@ -493,6 +494,23 @@ export default {
}) })
}, },
//导出列表数据
exportRecord(){
let data = {
curriculaId:this.queryParams.curriculaId,
studentName:this.queryParams.studentName,
examType:this.queryParams.examType,
classId:this.queryParams.classId,
}
this.download(
"curricula/studentScore/export",
{
...data,
},
`学生成绩管理_${new Date().getTime()}.xlsx`
);
},
//下载模板 //下载模板
downloadTemplate() { downloadTemplate() {
this.download( this.download(
......
...@@ -77,4 +77,13 @@ public class CurriCulaVariableController extends BaseController { ...@@ -77,4 +77,13 @@ public class CurriCulaVariableController extends BaseController {
public AjaxResult selectClass(@RequestParam("grade") String grade){ public AjaxResult selectClass(@RequestParam("grade") String grade){
return AjaxResult.success(curriculaVariableService.selectClass(grade)); return AjaxResult.success(curriculaVariableService.selectClass(grade));
} }
/**
* 获取选课任务下拉框
* @return
*/
@GetMapping("/getGrade")
public AjaxResult getGrade(){
return AjaxResult.success(curriculaVariableService.getGrade());
}
} }
\ No newline at end of file
...@@ -65,6 +65,17 @@ public class CurriculaStudentController extends BaseController { ...@@ -65,6 +65,17 @@ public class CurriculaStudentController extends BaseController {
} }
/** /**
* 查看夏季二次分班列表
* @param curriculaStudentVo
* @return
*/
@GetMapping("/listXjEc")
public TableDataInfo listXjEc(CurriculaStudentVo curriculaStudentVo){
startPage();
return getDataTable(curriculaStudentService.selectCurriculaStudentListXjQm(curriculaStudentVo));
}
/**
* 查看艺体选课情况列表 * 查看艺体选课情况列表
* @param curriculaStudentVo * @param curriculaStudentVo
* @return * @return
...@@ -83,22 +94,6 @@ public class CurriculaStudentController extends BaseController { ...@@ -83,22 +94,6 @@ public class CurriculaStudentController extends BaseController {
public void export(HttpServletResponse response,CurriculaStudentVo curriculaStudentVo) public void export(HttpServletResponse response,CurriculaStudentVo curriculaStudentVo)
{ {
List<CurriculaStudentVo> list = curriculaStudentService.selectCurriculaStudentList(curriculaStudentVo); List<CurriculaStudentVo> list = curriculaStudentService.selectCurriculaStudentList(curriculaStudentVo);
// list.forEach(curriculaStudentVo1 -> {
// if(null == curriculaStudentVo1.getSelectedMajor() || "".equals(curriculaStudentVo1.getSelectedMajor())){
//
// }else {
// String[] split = curriculaStudentVo1.getSelectedMajor().split(",");
// String selectedMajorName = "";
// for (int i=0;i<split.length;i++) {
// if (i == split.length - 1){
// selectedMajorName += sysDictDataService.selectDictLabel(split[i],"specialty") + ",";
// }else {
// selectedMajorName += sysDictDataService.selectDictLabel(split[i],"specialty");
// }
// }
// curriculaStudentVo1.setSelectedMajorName(selectedMajorName);
// }
// });
for (CurriculaStudentVo studentVo : list) { for (CurriculaStudentVo studentVo : list) {
if (null != studentVo.getSelectedMajor()){ if (null != studentVo.getSelectedMajor()){
if (studentVo.getSelectedMajor().length() > 0){ if (studentVo.getSelectedMajor().length() > 0){
...@@ -167,6 +162,24 @@ public class CurriculaStudentController extends BaseController { ...@@ -167,6 +162,24 @@ public class CurriculaStudentController extends BaseController {
} }
/** /**
* 导出夏季二次分班情况列表
*/
@Log(title = "夏季选课情况", businessType = BusinessType.EXPORT)
@PostMapping("/exportXjEc")
public void exportXjEc(HttpServletResponse response,CurriculaStudentVo curriculaStudentVo)
{
List<CurriculaStudentVo> curriculaStudentVoList = curriculaStudentService.selectCurriculaStudentListXjQm(curriculaStudentVo);
List<CurriculaStudentXjVo> list = new ArrayList<>();
curriculaStudentVoList.forEach(curriculaStudentVo1 -> {
CurriculaStudentXjVo curriculaStudentXjVo = new CurriculaStudentXjVo();
BeanUtils.copyProperties(curriculaStudentVo1,curriculaStudentXjVo);
list.add(curriculaStudentXjVo);
});
ExcelUtil<CurriculaStudentXjVo> util = new ExcelUtil<CurriculaStudentXjVo>(CurriculaStudentXjVo.class);
util.exportExcel(response, list, "选课情况数据");
}
/**
* 导出艺体选课情况列表 * 导出艺体选课情况列表
*/ */
@Log(title = "艺体选课情况", businessType = BusinessType.EXPORT) @Log(title = "艺体选课情况", businessType = BusinessType.EXPORT)
...@@ -183,4 +196,43 @@ public class CurriculaStudentController extends BaseController { ...@@ -183,4 +196,43 @@ public class CurriculaStudentController extends BaseController {
ExcelUtil<CurriculaStudentYtVo> util = new ExcelUtil<CurriculaStudentYtVo>(CurriculaStudentYtVo.class); ExcelUtil<CurriculaStudentYtVo> util = new ExcelUtil<CurriculaStudentYtVo>(CurriculaStudentYtVo.class);
util.exportExcel(response, list, "选课情况数据"); util.exportExcel(response, list, "选课情况数据");
} }
/**
* 查看选课情况列表(班主任)
* @param curriculaStudentVo
* @return
*/
@GetMapping("/listBzr")
public TableDataInfo listBzr(CurriculaStudentVo curriculaStudentVo){
startPage();
return getDataTable(curriculaStudentService.selectCurriculaStudentListBzr(curriculaStudentVo));
}
/**
* 导出选课情况列表(班主任)
*/
@Log(title = "选课情况", businessType = BusinessType.EXPORT)
@PostMapping("/exportBzr")
public void exportBzr(HttpServletResponse response,CurriculaStudentVo curriculaStudentVo)
{
List<CurriculaStudentVo> list = curriculaStudentService.selectCurriculaStudentListBzr(curriculaStudentVo);
for (CurriculaStudentVo studentVo : list) {
if (null != studentVo.getSelectedMajor()){
if (studentVo.getSelectedMajor().length() > 0){
String[] split = studentVo.getSelectedMajor().split(",");
String selectedMajorName = "";
for (int i=0;i<split.length;i++) {
if (i == split.length - 1){
selectedMajorName += sysDictDataService.selectDictLabel("specialty",split[i]);
}else {
selectedMajorName += sysDictDataService.selectDictLabel("specialty",split[i])+ ",";
}
}
studentVo.setSelectedMajorName(selectedMajorName);
}
}
}
ExcelUtil<CurriculaStudentVo> util = new ExcelUtil<CurriculaStudentVo>(CurriculaStudentVo.class);
util.exportExcel(response, list, "选课情况数据");
}
} }
package yangtz.cs.liu.campus.controller.curricula;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yangtz.cs.liu.campus.service.curricula.IDivisionClassesService;
import yangtz.cs.liu.campus.vo.curricula.SchoolDivisionClassesVo;
import java.util.List;
@RestController
@RequestMapping("/schoolDivision")
public class SchoolDivisionClassController extends BaseController {
@Autowired
private IDivisionClassesService divisionClassesService;
/**
* 首次分班规则
* @param list
* @return
*/
@PostMapping("/add")
public AjaxResult add(@RequestBody List<SchoolDivisionClassesVo> list){
return toAjax(divisionClassesService.insertDivisionClasses(list));
}
/**
* 获取每种课程选择人数
* @param
* @return
*/
@GetMapping("/getNumber")
public AjaxResult getNumber(@RequestParam("curriculaId") Long curriculaId){
return AjaxResult.success(divisionClassesService.getNumber(curriculaId));
}
/**
* 二次分班规则
* @param list
* @return
*/
@PostMapping("/addEc")
public AjaxResult addEc(@RequestBody List<SchoolDivisionClassesVo> list){
return toAjax(divisionClassesService.insertDivisionClassesEc(list));
}
}
package yangtz.cs.liu.campus.controller.curricula; package yangtz.cs.liu.campus.controller.curricula;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import yangtz.cs.liu.campus.domain.student.SchoolStudentScore; import yangtz.cs.liu.campus.domain.student.SchoolStudentScore;
import yangtz.cs.liu.campus.service.curricula.IStudentScoreService; import yangtz.cs.liu.campus.service.curricula.IStudentScoreService;
import yangtz.cs.liu.campus.vo.curricula.CurriculaStudentVo;
import yangtz.cs.liu.campus.vo.curricula.CurriculaStudentYtVo;
import yangtz.cs.liu.campus.vo.curricula.StudentScoreVo;
import yangtz.cs.liu.campus.vo.student.SchoolStudentScoreVo; import yangtz.cs.liu.campus.vo.student.SchoolStudentScoreVo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -36,6 +43,24 @@ public class StudentScoreController extends BaseController { ...@@ -36,6 +43,24 @@ public class StudentScoreController extends BaseController {
} }
/** /**
* 导出成绩管理列表
*/
@Log(title = "成绩管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void exportYt(HttpServletResponse response, SchoolStudentScoreVo schoolStudentScoreVo)
{
List<SchoolStudentScoreVo> schoolStudentScoreVoList = studentScoreService.selectStudentScoreList(schoolStudentScoreVo);
List<StudentScoreVo> list = new ArrayList<>();
schoolStudentScoreVoList.forEach(schoolStudentScoreVo1 -> {
StudentScoreVo studentScoreVo = new StudentScoreVo();
BeanUtils.copyProperties(schoolStudentScoreVo1,studentScoreVo);
list.add(studentScoreVo);
});
ExcelUtil<StudentScoreVo> util = new ExcelUtil<StudentScoreVo>(StudentScoreVo.class);
util.exportExcel(response, list, "成绩管理数据");
}
/**
* 下载模板 * 下载模板
* *
* @return * @return
......
package yangtz.cs.liu.campus.domain.curricula;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import lombok.Data;
/**
* 公众号选课返回信息
*/
@Data
public class CurriclaStudentVo {
/** 主键id */
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/** 学生主键id */
private Long studentId;
/** 选课任务主键id */
private Long curriculaId;
/** 课程类型(1-春季选课,2-夏季选课,3-艺体) */
private String courseType;
/** 选课时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date curriculaTime;
/** 选课状态(1-未选课,2-已选课) */
private String curriculaState;
/** 已选课程 */
private String selectedCourse;
/** 已选专业 */
private String selectedMajor;
/** 所选科目 */
private String selectedSubject;
/** 任务名称 */
private String taskName;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
}
...@@ -31,5 +31,5 @@ public class CurriculaStudent { ...@@ -31,5 +31,5 @@ public class CurriculaStudent {
/** 所选科目 */ /** 所选科目 */
private String selectedSubject; private String selectedSubject;
/** 是否删除 */ /** 是否删除 */
private String delFalg; private String delFlag;
} }
package yangtz.cs.liu.campus.domain.curricula;
import com.core.domain.OurBaseEntity;
import lombok.Data;
@Data
public class SchoolDivisionClasses extends OurBaseEntity {
/** 选课id */
private Long curriculaId;
/** 课程 */
private String course;
/** 分班班级名称 */
private String divisionClassesName;
/** 分班规则(1平行分班,2分层分班) */
private String divisionClassesRule;
/** 分班次数(1首次分班,2二次分班) */
private String divisionClassesFrequency;
}
package yangtz.cs.liu.campus.domain.curricula;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
@Data
public class SchoolDivisionStudent {
/** 主键id */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 分班班级主键id */
private Long divisionClassesId;
/** 学生主键id */
private Long studentId;
/** 删除状态 */
private String delFlag;
}
...@@ -241,15 +241,17 @@ public class SchoolClassEducational extends BaseEntity ...@@ -241,15 +241,17 @@ public class SchoolClassEducational extends BaseEntity
{ {
return teacherWord; return teacherWord;
} }
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag() @Override
{ public String getDelFlag() {
return delFlag; return delFlag;
} }
@Override
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public void setGradeId(Long gradeId) public void setGradeId(Long gradeId)
{ {
this.gradeId = gradeId; this.gradeId = gradeId;
......
...@@ -25,6 +25,13 @@ public interface CurriculaStudentMapper extends BaseMapper<CurriculaStudent> { ...@@ -25,6 +25,13 @@ public interface CurriculaStudentMapper extends BaseMapper<CurriculaStudent> {
List<CurriculaStudentVo> selectCurriculaStudentList(CurriculaStudentVo curriculaStudentVo); List<CurriculaStudentVo> selectCurriculaStudentList(CurriculaStudentVo curriculaStudentVo);
/** /**
* 查看选课情况列表(班主任)
* @param curriculaStudentVo
* @return
*/
List<CurriculaStudentVo> selectCurriculaStudentListBzr(CurriculaStudentVo curriculaStudentVo);
/**
* 查看春季选课情况列表 * 查看春季选课情况列表
* @param curriculaStudentVo * @param curriculaStudentVo
* @return * @return
...@@ -39,6 +46,13 @@ public interface CurriculaStudentMapper extends BaseMapper<CurriculaStudent> { ...@@ -39,6 +46,13 @@ public interface CurriculaStudentMapper extends BaseMapper<CurriculaStudent> {
List<CurriculaStudentVo> selectCurriculaStudentListXj(CurriculaStudentVo curriculaStudentVo); List<CurriculaStudentVo> selectCurriculaStudentListXj(CurriculaStudentVo curriculaStudentVo);
/** /**
* 查看夏季二次分班情况列表
* @param curriculaStudentVo
* @return
*/
List<CurriculaStudentVo> selectCurriculaStudentListXjEc(CurriculaStudentVo curriculaStudentVo);
/**
* 查看艺体选课情况列表 * 查看艺体选课情况列表
* @param curriculaStudentVo * @param curriculaStudentVo
* @return * @return
......
...@@ -29,4 +29,10 @@ public interface CurriculaVariableMapper extends BaseMapper<CurriculaVariable> ...@@ -29,4 +29,10 @@ public interface CurriculaVariableMapper extends BaseMapper<CurriculaVariable>
* @return * @return
*/ */
List<Map<String,String>> selectClass(@Param("grade") String grade); List<Map<String,String>> selectClass(@Param("grade") String grade);
/**
* 获取选课任务下拉框
* @return
*/
List<Map<String, String>> getGrade();
} }
package yangtz.cs.liu.campus.mapper.curricula;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import yangtz.cs.liu.campus.domain.curricula.SchoolDivisionClasses;
import java.util.List;
import java.util.Map;
public interface DivisionClassesMapper extends BaseMapper<SchoolDivisionClasses> {
/**
* 获取选择某种课程的总人数
* @param curriculaId
* @return
*/
List<Map<String, String>> getNumber(@Param("curriculaId") Long curriculaId);
}
package yangtz.cs.liu.campus.mapper.curricula;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import yangtz.cs.liu.campus.domain.curricula.SchoolDivisionStudent;
public interface DivisionStudentMapper extends BaseMapper<SchoolDivisionStudent> {
}
...@@ -36,4 +36,18 @@ public interface ICurriculaStudentService extends IService<CurriculaStudent> { ...@@ -36,4 +36,18 @@ public interface ICurriculaStudentService extends IService<CurriculaStudent> {
*/ */
List<CurriculaStudentVo> selectCurriculaStudentListYt(CurriculaStudentVo curriculaStudentVo); List<CurriculaStudentVo> selectCurriculaStudentListYt(CurriculaStudentVo curriculaStudentVo);
/**
* 查看夏季选课情况列表
* @param curriculaStudentVo
* @return
*/
List<CurriculaStudentVo> selectCurriculaStudentListXjQm(CurriculaStudentVo curriculaStudentVo);
/**
* 查看选课情况列表(班主任)
* @param curriculaStudentVo
* @return
*/
List<CurriculaStudentVo> selectCurriculaStudentListBzr(CurriculaStudentVo curriculaStudentVo);
} }
package yangtz.cs.liu.campus.service.curricula; package yangtz.cs.liu.campus.service.curricula;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import yangtz.cs.liu.campus.domain.curricula.CurriculaVariable; import yangtz.cs.liu.campus.domain.curricula.CurriculaVariable;
import yangtz.cs.liu.campus.vo.curricula.CurriculaVariableVo; import yangtz.cs.liu.campus.vo.curricula.CurriculaVariableVo;
...@@ -49,4 +48,10 @@ public interface ICurriculaVariableService extends IService<CurriculaVariable> { ...@@ -49,4 +48,10 @@ public interface ICurriculaVariableService extends IService<CurriculaVariable> {
* @return * @return
*/ */
int updateCurriculaVariable(CurriculaVariable curriculaVariable); int updateCurriculaVariable(CurriculaVariable curriculaVariable);
/**
* 获取选课任务下拉框
* @return
*/
List<Map<String,String>> getGrade();
} }
package yangtz.cs.liu.campus.service.curricula;
import com.baomidou.mybatisplus.extension.service.IService;
import yangtz.cs.liu.campus.domain.curricula.SchoolDivisionClasses;
import yangtz.cs.liu.campus.vo.curricula.SchoolDivisionClassesVo;
import java.util.List;
import java.util.Map;
public interface IDivisionClassesService extends IService<SchoolDivisionClasses> {
/**
* 首次分班规则
* @param list
* @return
*/
int insertDivisionClasses(List<SchoolDivisionClassesVo> list);
/**
* 获取每种课程选择人数
* @return
*/
List<Map<String,String>> getNumber(Long curriculaId);
/**
* 二次分班规则
* @param list
* @return
*/
int insertDivisionClassesEc(List<SchoolDivisionClassesVo> list);
}
package yangtz.cs.liu.campus.service.curricula; package yangtz.cs.liu.campus.service.curricula;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import yangtz.cs.liu.campus.domain.curricula.CurriculaStudent;
import yangtz.cs.liu.campus.domain.student.SchoolStudentScore; import yangtz.cs.liu.campus.domain.student.SchoolStudentScore;
import yangtz.cs.liu.campus.vo.student.SchoolStudentScoreVo; import yangtz.cs.liu.campus.vo.student.SchoolStudentScoreVo;
...@@ -15,6 +16,9 @@ public interface IStudentScoreService extends IService<SchoolStudentScore> { ...@@ -15,6 +16,9 @@ public interface IStudentScoreService extends IService<SchoolStudentScore> {
*/ */
List<SchoolStudentScoreVo> selectStudentScoreList(SchoolStudentScoreVo schoolStudentScoreVo); List<SchoolStudentScoreVo> selectStudentScoreList(SchoolStudentScoreVo schoolStudentScoreVo);
//根据学生ID查询成绩
List<SchoolStudentScoreVo> selectStudentScoreList(Long studentId);
/** /**
* 查询学生成绩详细信息 * 查询学生成绩详细信息
* @param id * @param id
...@@ -62,4 +66,9 @@ public interface IStudentScoreService extends IService<SchoolStudentScore> { ...@@ -62,4 +66,9 @@ public interface IStudentScoreService extends IService<SchoolStudentScore> {
* @return * @return
*/ */
int deleteStudentScore(Long[] ids); int deleteStudentScore(Long[] ids);
/**
* 根据类型查询三类成绩
*/
List<SchoolStudentScoreVo> getStudentTypeViwe(CurriculaStudent curriculaStudent);
} }
...@@ -43,7 +43,7 @@ public class CurriculaStudentServiceImpl extends ServiceImpl<CurriculaStudentMap ...@@ -43,7 +43,7 @@ public class CurriculaStudentServiceImpl extends ServiceImpl<CurriculaStudentMap
} }
/** /**
* 查看夏季选课情况列表 * 查看夏季选课情况列表(一次、二次、三次)
* @param curriculaStudentVo * @param curriculaStudentVo
* @return * @return
*/ */
...@@ -54,7 +54,7 @@ public class CurriculaStudentServiceImpl extends ServiceImpl<CurriculaStudentMap ...@@ -54,7 +54,7 @@ public class CurriculaStudentServiceImpl extends ServiceImpl<CurriculaStudentMap
//查询学生成绩 //查询学生成绩
LambdaQueryWrapper<SchoolStudentScore> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SchoolStudentScore> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolStudentScore::getStudentId,curriculaStudentVo1.getStudentId()) wrapper.eq(SchoolStudentScore::getStudentId,curriculaStudentVo1.getStudentId())
.like(SchoolStudentScore::getExamType,"1,2,3") .in(SchoolStudentScore::getExamType,1,2,3)
.orderByDesc(SchoolStudentScore::getExamType).last("LIMIT 1"); .orderByDesc(SchoolStudentScore::getExamType).last("LIMIT 1");
SchoolStudentScore schoolStudentScore = studentScoreMapper.selectOne(wrapper); SchoolStudentScore schoolStudentScore = studentScoreMapper.selectOne(wrapper);
if (StringUtils.isNotNull(schoolStudentScore)){ if (StringUtils.isNotNull(schoolStudentScore)){
...@@ -173,4 +173,134 @@ public class CurriculaStudentServiceImpl extends ServiceImpl<CurriculaStudentMap ...@@ -173,4 +173,134 @@ public class CurriculaStudentServiceImpl extends ServiceImpl<CurriculaStudentMap
List<CurriculaStudentVo> curriculaStudentVoList = curriculaStudentMapper.selectCurriculaStudentListYt(curriculaStudentVo); List<CurriculaStudentVo> curriculaStudentVoList = curriculaStudentMapper.selectCurriculaStudentListYt(curriculaStudentVo);
return curriculaStudentVoList; return curriculaStudentVoList;
} }
/**
* 查看夏季选课情况(期末)
* @param curriculaStudentVo
* @return
*/
@Override
public List<CurriculaStudentVo> selectCurriculaStudentListXjQm(CurriculaStudentVo curriculaStudentVo) {
List<CurriculaStudentVo> curriculaStudentVoList = curriculaStudentMapper.selectCurriculaStudentListXjEc(curriculaStudentVo);
curriculaStudentVoList.forEach(curriculaStudentVo1 -> {
//查询学生成绩
LambdaQueryWrapper<SchoolStudentScore> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolStudentScore::getStudentId,curriculaStudentVo1.getStudentId())
.eq(SchoolStudentScore::getExamType,"4");
SchoolStudentScore schoolStudentScore = studentScoreMapper.selectOne(wrapper);
if (StringUtils.isNotNull(schoolStudentScore)){
//物理+政治+化学
if (curriculaStudentVo1.getSelectedCourse().equals("1")){
double courseScore = schoolStudentScore.getPhysics() + schoolStudentScore.getPolitics() + schoolStudentScore.getChemistry();
curriculaStudentVo1.setCourseScore(courseScore);
}
//物理+政治+生物
if (curriculaStudentVo1.getSelectedCourse().equals("2")){
double courseScore = schoolStudentScore.getPhysics() + schoolStudentScore.getPolitics() + schoolStudentScore.getBiology();
curriculaStudentVo1.setCourseScore(courseScore);
}
//物理+政治+地理
if (curriculaStudentVo1.getSelectedCourse().equals("3")){
double courseScore = schoolStudentScore.getPhysics() + schoolStudentScore.getPolitics() + schoolStudentScore.getGeography();
curriculaStudentVo1.setCourseScore(courseScore);
}
//物理+政治+历史
if (curriculaStudentVo1.getSelectedCourse().equals("4")){
double courseScore = schoolStudentScore.getPhysics() + schoolStudentScore.getPolitics() + schoolStudentScore.getHistory();
curriculaStudentVo1.setCourseScore(courseScore);
}
//物理+历史+化学
if (curriculaStudentVo1.getSelectedCourse().equals("5")){
double courseScore = schoolStudentScore.getPhysics() + schoolStudentScore.getHistory() + schoolStudentScore.getChemistry();
curriculaStudentVo1.setCourseScore(courseScore);
}
//物理+历史+生物
if (curriculaStudentVo1.getSelectedCourse().equals("6")){
double courseScore = schoolStudentScore.getPhysics() + schoolStudentScore.getHistory() + schoolStudentScore.getBiology();
curriculaStudentVo1.setCourseScore(courseScore);
}
//物理+地理+化学
if (curriculaStudentVo1.getSelectedCourse().equals("7")){
double courseScore = schoolStudentScore.getPhysics() + schoolStudentScore.getGeography() + schoolStudentScore.getChemistry();
curriculaStudentVo1.setCourseScore(courseScore);
}
//物理+地理+生物
if (curriculaStudentVo1.getSelectedCourse().equals("8")){
double courseScore = schoolStudentScore.getPhysics() + schoolStudentScore.getGeography() + schoolStudentScore.getBiology();
curriculaStudentVo1.setCourseScore(courseScore);
}
//物理+化学+生物
if (curriculaStudentVo1.getSelectedCourse().equals("9")){
double courseScore = schoolStudentScore.getPhysics() + schoolStudentScore.getChemistry() + schoolStudentScore.getBiology();
curriculaStudentVo1.setCourseScore(courseScore);
}
//物理+历史+地理
if (curriculaStudentVo1.getSelectedCourse().equals("10")){
double courseScore = schoolStudentScore.getPhysics() + schoolStudentScore.getHistory() + schoolStudentScore.getGeography();
curriculaStudentVo1.setCourseScore(courseScore);
}
//化学+政治+地理
if (curriculaStudentVo1.getSelectedCourse().equals("11")){
double courseScore = schoolStudentScore.getChemistry() + schoolStudentScore.getPolitics() + schoolStudentScore.getGeography();
curriculaStudentVo1.setCourseScore(courseScore);
}
//化学+政治+历史
if (curriculaStudentVo1.getSelectedCourse().equals("12")){
double courseScore = schoolStudentScore.getChemistry() + schoolStudentScore.getPolitics() + schoolStudentScore.getHistory();
curriculaStudentVo1.setCourseScore(courseScore);
}
//化学+政治+生物
if (curriculaStudentVo1.getSelectedCourse().equals("13")){
double courseScore = schoolStudentScore.getChemistry() + schoolStudentScore.getPolitics() + schoolStudentScore.getBiology();
curriculaStudentVo1.setCourseScore(courseScore);
}
//化学+历史+地理
if (curriculaStudentVo1.getSelectedCourse().equals("14")){
double courseScore = schoolStudentScore.getChemistry() + schoolStudentScore.getHistory() + schoolStudentScore.getGeography();
curriculaStudentVo1.setCourseScore(courseScore);
}
//化学+历史+生物
if (curriculaStudentVo1.getSelectedCourse().equals("15")){
double courseScore = schoolStudentScore.getChemistry() + schoolStudentScore.getHistory() + schoolStudentScore.getBiology();
curriculaStudentVo1.setCourseScore(courseScore);
}
//化学+地理+生物
if (curriculaStudentVo1.getSelectedCourse().equals("16")){
double courseScore = schoolStudentScore.getChemistry() + schoolStudentScore.getGeography() + schoolStudentScore.getBiology();
curriculaStudentVo1.setCourseScore(courseScore);
}
//生物+政治+地理
if (curriculaStudentVo1.getSelectedCourse().equals("17")){
double courseScore = schoolStudentScore.getBiology() + schoolStudentScore.getPolitics() + schoolStudentScore.getGeography();
curriculaStudentVo1.setCourseScore(courseScore);
}
//生物+历史+地理
if (curriculaStudentVo1.getSelectedCourse().equals("18")){
double courseScore = schoolStudentScore.getBiology() + schoolStudentScore.getHistory() + schoolStudentScore.getGeography();
curriculaStudentVo1.setCourseScore(courseScore);
}
//生物+政治+历史
if (curriculaStudentVo1.getSelectedCourse().equals("19")){
double courseScore = schoolStudentScore.getBiology() + schoolStudentScore.getPolitics() + schoolStudentScore.getHistory();
curriculaStudentVo1.setCourseScore(courseScore);
}
//政治+历史+地理
if (curriculaStudentVo1.getSelectedCourse().equals("20")){
double courseScore = schoolStudentScore.getPolitics() + schoolStudentScore.getHistory() + schoolStudentScore.getGeography();
curriculaStudentVo1.setCourseScore(courseScore);
}
}
});
return curriculaStudentVoList;
}
/**
* 查看选课情况列表(班主任)
* @param curriculaStudentVo
* @return
*/
@Override
public List<CurriculaStudentVo> selectCurriculaStudentListBzr(CurriculaStudentVo curriculaStudentVo) {
return curriculaStudentMapper.selectCurriculaStudentListBzr(curriculaStudentVo);
}
} }
...@@ -16,7 +16,6 @@ import yangtz.cs.liu.campus.mapper.curricula.CurriculaStudentMapper; ...@@ -16,7 +16,6 @@ import yangtz.cs.liu.campus.mapper.curricula.CurriculaStudentMapper;
import yangtz.cs.liu.campus.mapper.curricula.CurriculaVariableMapper; import yangtz.cs.liu.campus.mapper.curricula.CurriculaVariableMapper;
import yangtz.cs.liu.campus.mapper.schoolgrade.SchoolGradeMapper; import yangtz.cs.liu.campus.mapper.schoolgrade.SchoolGradeMapper;
import yangtz.cs.liu.campus.service.curricula.ICurriculaVariableService; import yangtz.cs.liu.campus.service.curricula.ICurriculaVariableService;
import yangtz.cs.liu.campus.service.schoolgrade.ISchoolGradeService;
import yangtz.cs.liu.campus.vo.curricula.CurriculaVariableVo; import yangtz.cs.liu.campus.vo.curricula.CurriculaVariableVo;
import static com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank; import static com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank;
...@@ -161,4 +160,13 @@ public class CurriculaVariableServiceImpl extends ServiceImpl<CurriculaVariableM ...@@ -161,4 +160,13 @@ public class CurriculaVariableServiceImpl extends ServiceImpl<CurriculaVariableM
} }
return curriculaVariableMapper.updateById(curriculaVariable); return curriculaVariableMapper.updateById(curriculaVariable);
} }
/**
* 获取选课任务下拉框
* @return
*/
@Override
public List<Map<String, String>> getGrade() {
return curriculaVariableMapper.getGrade();
}
} }
package yangtz.cs.liu.campus.service.impl.curricula;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import yangtz.cs.liu.campus.domain.curricula.SchoolDivisionClasses;
import yangtz.cs.liu.campus.domain.curricula.SchoolDivisionStudent;
import yangtz.cs.liu.campus.mapper.curricula.DivisionClassesMapper;
import yangtz.cs.liu.campus.mapper.curricula.DivisionStudentMapper;
import yangtz.cs.liu.campus.service.curricula.ICurriculaStudentService;
import yangtz.cs.liu.campus.service.curricula.IDivisionClassesService;
import yangtz.cs.liu.campus.vo.curricula.CurriculaStudentVo;
import yangtz.cs.liu.campus.vo.curricula.SchoolDivisionClassesVo;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class DivisionClassesServiceImpl extends ServiceImpl<DivisionClassesMapper, SchoolDivisionClasses> implements IDivisionClassesService {
@Autowired
private DivisionClassesMapper divisionClassesMapper;
@Autowired
private ICurriculaStudentService curriculaStudentService;
@Autowired
private DivisionStudentMapper divisionStudentMapper;
/**
* 首次分班规则
* @param list
* @return
*/
@Override
@Transactional
public int insertDivisionClasses(List<SchoolDivisionClassesVo> list) {
int row = 0;
for (SchoolDivisionClassesVo classesVo : list) {
if (null == classesVo.getClassesNumber() || null == classesVo.getPeopleNumber()){
throw new ServiceException("班级数量或每班人数不能为空");
}
if (classesVo.getClassesNumber() == 0 || classesVo.getPeopleNumber() == 0){
throw new ServiceException("班级数量或每班人数不能为0");
}
if (classesVo.getCoursePeopleNumber() < classesVo.getClassesNumber()){
throw new ServiceException("输入的班级数量大于该课程总人数");
}
if (classesVo.getClassesNumber() * classesVo.getPeopleNumber() < classesVo.getCoursePeopleNumber() ){
throw new ServiceException("输入的班级数量和每班人数不符");
}
if (classesVo.getPeopleNumber() > classesVo.getCoursePeopleNumber()){
throw new ServiceException("输入的每班人数大于该课程总人数");
}
//创建班级
//输入的班级数量
int classesNumber = classesVo.getClassesNumber();
String className = "";
switch (classesVo.getCourse()){
case "1" :
className = "物政化";
break;
case "2":
className = "物政生";
break;
case "3":
className = "物政地";
break;
case "4":
className = "物政历";
break;
case "5":
className = "物历化";
break;
case "6":
className = "物历生";
break;
case "7":
className = "物地化";
break;
case "8":
className = "物地生";
break;
case "9":
className = "物化生";
break;
case "10":
className = "物历地";
break;
case "11":
className = "化政地";
break;
case "12":
className = "化政历";
break;
case "13":
className = "化政生";
break;
case "14":
className = "化历地";
break;
case "15":
className = "化历生";
break;
case "16":
className = "化地生";
break;
case "17":
className = "生政地";
break;
case "18":
className = "生历地";
break;
case "19":
className = "生政历";
break;
case "20":
className = "政历地";
break;
}
//新增班级
SchoolDivisionClasses schoolDivisionClasses = new SchoolDivisionClasses();
schoolDivisionClasses.setCurriculaId(classesVo.getCurriculaId());
schoolDivisionClasses.setCourse(classesVo.getCourse());
schoolDivisionClasses.setDivisionClassesRule(classesVo.getDivisionClassesRule());
schoolDivisionClasses.setDivisionClassesFrequency(classesVo.getDivisionClassesFrequency());
schoolDivisionClasses.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
schoolDivisionClasses.setCreateTime(DateUtils.getNowDate());
for (int i = 1; i <= classesNumber; i++) {
schoolDivisionClasses.setDivisionClassesName(className + i + "班");
row += divisionClassesMapper.insert(schoolDivisionClasses);
}
//查询首次分班对应的班级
LambdaQueryWrapper<SchoolDivisionClasses> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolDivisionClasses::getCurriculaId,classesVo.getCurriculaId())
.eq(SchoolDivisionClasses::getCourse,classesVo.getCourse())
.eq(SchoolDivisionClasses::getDivisionClassesFrequency,"1")
.eq(SchoolDivisionClasses::getDelFlag,"0")
.orderByAsc(SchoolDivisionClasses::getDivisionClassesName);
List<SchoolDivisionClasses> divisionClasses = divisionClassesMapper.selectList(wrapper);
CurriculaStudentVo curriculaStudentVo = new CurriculaStudentVo();
curriculaStudentVo.setCurriculaId(classesVo.getCurriculaId());
curriculaStudentVo.setSelectedCourse(classesVo.getCourse());
curriculaStudentVo.setCourseType("2");
List<CurriculaStudentVo> curriculaStudentVoList = curriculaStudentService.selectCurriculaStudentListXj(curriculaStudentVo);
//判断此次分班是平行分班还是分层分班
if (classesVo.getDivisionClassesRule().equals("1")){
//平行分班
//根据成绩进行排名 从高到低
List<CurriculaStudentVo> curriculaStudentVos = curriculaStudentVoList.stream().sorted(Comparator.comparing(CurriculaStudentVo::getCourseScore).reversed()).collect(Collectors.toList());
//生成不重复随机数
Random random = new Random();
List<Integer> list1 = new ArrayList<>();
while (true){
int index = random.nextInt(divisionClasses.size());
if (!list1.contains(index)){
list1.add(index);
}
if (list1.size() == divisionClasses.size()){
break;
}
}
List<CurriculaStudentVo> studentVoList = new ArrayList<>();
//新增成绩好的学生与分班班级关系
for (int i = 0; i < divisionClasses.size(); i++) {
SchoolDivisionStudent schoolDivisionStudent = new SchoolDivisionStudent();
schoolDivisionStudent.setDivisionClassesId(divisionClasses.get(list1.get(i)).getId());
CurriculaStudentVo curriculaStudentVo1 = curriculaStudentVos.get(i);
schoolDivisionStudent.setStudentId(curriculaStudentVo1.getStudentId());
divisionStudentMapper.insert(schoolDivisionStudent);
studentVoList.add(curriculaStudentVo1);
}
for (CurriculaStudentVo studentVo : studentVoList) {
curriculaStudentVos.remove(studentVo);
}
//随机新增剩余同学与分班班级关系
for (int i = 0; i < divisionClasses.size(); i++) {
//随机生成每班人数减1个随机数
Random random1 = new Random();
List<Integer> people = new ArrayList<>();
if (classesVo.getPeopleNumber() - 1 != 0){
while (true){
int index = random1.nextInt(classesVo.getPeopleNumber() - 1);
if (!people.contains(index)){
people.add(index);
}
if (people.size() == classesVo.getPeopleNumber() - 1){
break;
}
}
}
for (int j = 0; j < classesVo.getPeopleNumber() - 1; j++) {
SchoolDivisionStudent schoolDivisionStudent = new SchoolDivisionStudent();
schoolDivisionStudent.setDivisionClassesId(divisionClasses.get(i).getId());
CurriculaStudentVo curriculaStudentVo1 = curriculaStudentVos.get(people.get(j));
schoolDivisionStudent.setStudentId(curriculaStudentVo1.getStudentId());
divisionStudentMapper.insert(schoolDivisionStudent);
}
}
}else {
//分层分班
//根据成绩进行排名 从高到低
List<CurriculaStudentVo> curriculaStudentVos = curriculaStudentVoList.stream().sorted(Comparator.comparing(CurriculaStudentVo::getCourseScore).reversed()).collect(Collectors.toList());
int index = 0;
for (SchoolDivisionClasses schoolDivisionClasses1 : divisionClasses) {
SchoolDivisionStudent schoolDivisionStudent = new SchoolDivisionStudent();
//分班班级id
Long id = schoolDivisionClasses1.getId();
schoolDivisionStudent.setDivisionClassesId(id);
List<CurriculaStudentVo> studentVoList = new ArrayList<>();
//判断学生人数能不能整除输入的每班人数
if (curriculaStudentVos.size() % classesVo.getPeopleNumber() == 0){
for (int i = 0; i < classesVo.getPeopleNumber(); i++) {
CurriculaStudentVo studentVo = curriculaStudentVos.get(i);
schoolDivisionStudent.setStudentId(studentVo.getStudentId());
divisionStudentMapper.insert(schoolDivisionStudent);
studentVoList.add(studentVo);
}
for (CurriculaStudentVo studentVo : studentVoList) {
curriculaStudentVos.remove(studentVo);
}
studentVoList.clear();
}else {
int index1 = curriculaStudentVos.size() / classesVo.getPeopleNumber();
if (index == index1){
for (int i = 0; i < curriculaStudentVos.size() % classesVo.getPeopleNumber(); i++) {
CurriculaStudentVo studentVo = curriculaStudentVos.get(i);
schoolDivisionStudent.setStudentId(studentVo.getStudentId());
divisionStudentMapper.insert(schoolDivisionStudent);
studentVoList.add(studentVo);
}
for (CurriculaStudentVo studentVo : studentVoList) {
curriculaStudentVos.remove(studentVo);
}
studentVoList.clear();
}else {
for (int j = 0; j < classesVo.getPeopleNumber(); j++) {
CurriculaStudentVo studentVo = curriculaStudentVos.get(j);
schoolDivisionStudent.setStudentId(studentVo.getStudentId());
divisionStudentMapper.insert(schoolDivisionStudent);
studentVoList.add(studentVo);
}
for (CurriculaStudentVo studentVo : studentVoList) {
curriculaStudentVos.remove(studentVo);
}
studentVoList.clear();
index ++;
}
}
}
}
}
return row;
}
/**
* 获取每种课程选择人数
* @return
*/
@Override
public List<Map<String, String>> getNumber(Long curriculaId) {
return divisionClassesMapper.getNumber(curriculaId);
}
/**
* 二次分班规则
* @param list
* @return
*/
@Override
public int insertDivisionClassesEc(List<SchoolDivisionClassesVo> list) {
int row = 0;
for (SchoolDivisionClassesVo classesVo : list) {
if (null == classesVo.getClassesNumber() || null == classesVo.getPeopleNumber()){
throw new ServiceException("班级数量或每班人数不能为空");
}
if (classesVo.getClassesNumber() == 0 || classesVo.getPeopleNumber() == 0){
throw new ServiceException("班级数量或每班人数不能为0");
}
if (classesVo.getCoursePeopleNumber() < classesVo.getClassesNumber()){
throw new ServiceException("输入的班级数量大于该课程总人数");
}
if (classesVo.getClassesNumber() * classesVo.getPeopleNumber() < classesVo.getCoursePeopleNumber() ){
throw new ServiceException("输入的班级数量和每班人数不符");
}
if (classesVo.getPeopleNumber() > classesVo.getCoursePeopleNumber()){
throw new ServiceException("输入的每班人数大于该课程总人数");
}
//创建班级
//输入的班级数量
int classesNumber = classesVo.getClassesNumber();
String className = "";
switch (classesVo.getCourse()){
case "1" :
className = "物政化";
break;
case "2":
className = "物政生";
break;
case "3":
className = "物政地";
break;
case "4":
className = "物政历";
break;
case "5":
className = "物历化";
break;
case "6":
className = "物历生";
break;
case "7":
className = "物地化";
break;
case "8":
className = "物地生";
break;
case "9":
className = "物化生";
break;
case "10":
className = "物历地";
break;
case "11":
className = "化政地";
break;
case "12":
className = "化政历";
break;
case "13":
className = "化政生";
break;
case "14":
className = "化历地";
break;
case "15":
className = "化历生";
break;
case "16":
className = "化地生";
break;
case "17":
className = "生政地";
break;
case "18":
className = "生历地";
break;
case "19":
className = "生政历";
break;
case "20":
className = "政历地";
break;
}
//新增班级
SchoolDivisionClasses schoolDivisionClasses = new SchoolDivisionClasses();
schoolDivisionClasses.setCurriculaId(classesVo.getCurriculaId());
schoolDivisionClasses.setCourse(classesVo.getCourse());
schoolDivisionClasses.setDivisionClassesRule(classesVo.getDivisionClassesRule());
schoolDivisionClasses.setDivisionClassesFrequency(classesVo.getDivisionClassesFrequency());
schoolDivisionClasses.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
schoolDivisionClasses.setCreateTime(DateUtils.getNowDate());
for (int i = 1; i <= classesNumber; i++) {
schoolDivisionClasses.setDivisionClassesName(className + i + "班");
row += divisionClassesMapper.insert(schoolDivisionClasses);
}
//查询首次分班对应的班级
LambdaQueryWrapper<SchoolDivisionClasses> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolDivisionClasses::getCurriculaId,classesVo.getCurriculaId())
.eq(SchoolDivisionClasses::getCourse,classesVo.getCourse())
.eq(SchoolDivisionClasses::getDivisionClassesFrequency,"2")
.eq(SchoolDivisionClasses::getDelFlag,"0")
.orderByAsc(SchoolDivisionClasses::getDivisionClassesName);
List<SchoolDivisionClasses> divisionClasses = divisionClassesMapper.selectList(wrapper);
CurriculaStudentVo curriculaStudentVo = new CurriculaStudentVo();
curriculaStudentVo.setCurriculaId(classesVo.getCurriculaId());
curriculaStudentVo.setSelectedCourse(classesVo.getCourse());
curriculaStudentVo.setCourseType("2");
List<CurriculaStudentVo> curriculaStudentVoList = curriculaStudentService.selectCurriculaStudentListXjQm(curriculaStudentVo);
//判断此次分班是平行分班还是分层分班
if (classesVo.getDivisionClassesRule().equals("1")){
//平行分班
//根据成绩进行排名 从高到低
List<CurriculaStudentVo> curriculaStudentVos = curriculaStudentVoList.stream().sorted(Comparator.comparing(CurriculaStudentVo::getCourseScore).reversed()).collect(Collectors.toList());
//生成不重复随机数
Random random = new Random();
List<Integer> list1 = new ArrayList<>();
while (true){
int index = random.nextInt(divisionClasses.size());
if (!list1.contains(index)){
list1.add(index);
}
if (list1.size() == divisionClasses.size()){
break;
}
}
List<CurriculaStudentVo> studentVoList = new ArrayList<>();
//新增成绩好的学生与分班班级关系
for (int i = 0; i < divisionClasses.size(); i++) {
SchoolDivisionStudent schoolDivisionStudent = new SchoolDivisionStudent();
schoolDivisionStudent.setDivisionClassesId(divisionClasses.get(list1.get(i)).getId());
CurriculaStudentVo curriculaStudentVo1 = curriculaStudentVos.get(i);
schoolDivisionStudent.setStudentId(curriculaStudentVo1.getStudentId());
divisionStudentMapper.insert(schoolDivisionStudent);
studentVoList.add(curriculaStudentVo1);
}
for (CurriculaStudentVo studentVo : studentVoList) {
curriculaStudentVos.remove(studentVo);
}
//随机新增剩余同学与分班班级关系
for (int i = 0; i < divisionClasses.size(); i++) {
//随机生成每班人数减1个随机数
Random random1 = new Random();
List<Integer> people = new ArrayList<>();
if (classesVo.getPeopleNumber() - 1 != 0){
while (true){
int index = random1.nextInt(classesVo.getPeopleNumber() - 1);
if (!people.contains(index)){
people.add(index);
}
if (people.size() == classesVo.getPeopleNumber() - 1){
break;
}
}
}
for (int j = 0; j < classesVo.getPeopleNumber() - 1; j++) {
SchoolDivisionStudent schoolDivisionStudent = new SchoolDivisionStudent();
schoolDivisionStudent.setDivisionClassesId(divisionClasses.get(i).getId());
CurriculaStudentVo curriculaStudentVo1 = curriculaStudentVos.get(people.get(j));
schoolDivisionStudent.setStudentId(curriculaStudentVo1.getStudentId());
divisionStudentMapper.insert(schoolDivisionStudent);
}
}
}else {
//分层分班
//根据成绩进行排名 从高到低
List<CurriculaStudentVo> curriculaStudentVos = curriculaStudentVoList.stream().sorted(Comparator.comparing(CurriculaStudentVo::getCourseScore).reversed()).collect(Collectors.toList());
int index = 0;
for (SchoolDivisionClasses schoolDivisionClasses1 : divisionClasses) {
SchoolDivisionStudent schoolDivisionStudent = new SchoolDivisionStudent();
//分班班级id
Long id = schoolDivisionClasses1.getId();
schoolDivisionStudent.setDivisionClassesId(id);
List<CurriculaStudentVo> studentVoList = new ArrayList<>();
//判断学生人数能不能整除输入的每班人数
if (curriculaStudentVos.size() % classesVo.getPeopleNumber() == 0){
for (int i = 0; i < classesVo.getPeopleNumber(); i++) {
CurriculaStudentVo studentVo = curriculaStudentVos.get(i);
schoolDivisionStudent.setStudentId(studentVo.getStudentId());
divisionStudentMapper.insert(schoolDivisionStudent);
studentVoList.add(studentVo);
}
for (CurriculaStudentVo studentVo : studentVoList) {
curriculaStudentVos.remove(studentVo);
}
studentVoList.clear();
}else {
int index1 = curriculaStudentVos.size() / classesVo.getPeopleNumber();
if (index == index1){
for (int i = 0; i < curriculaStudentVos.size() % classesVo.getPeopleNumber(); i++) {
CurriculaStudentVo studentVo = curriculaStudentVos.get(i);
schoolDivisionStudent.setStudentId(studentVo.getStudentId());
divisionStudentMapper.insert(schoolDivisionStudent);
studentVoList.add(studentVo);
}
for (CurriculaStudentVo studentVo : studentVoList) {
curriculaStudentVos.remove(studentVo);
}
studentVoList.clear();
}else {
for (int j = 0; j < classesVo.getPeopleNumber(); j++) {
CurriculaStudentVo studentVo = curriculaStudentVos.get(j);
schoolDivisionStudent.setStudentId(studentVo.getStudentId());
divisionStudentMapper.insert(schoolDivisionStudent);
studentVoList.add(studentVo);
}
for (CurriculaStudentVo studentVo : studentVoList) {
curriculaStudentVos.remove(studentVo);
}
studentVoList.clear();
index ++;
}
}
}
}
}
return row;
}
}
...@@ -7,10 +7,16 @@ import com.ruoyi.common.exception.base.BaseException; ...@@ -7,10 +7,16 @@ import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.reflect.ReflectUtils;
import com.ruoyi.system.service.impl.SysDictDataServiceImpl;
import java.util.HashMap;
import java.util.Iterator;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import yangtz.cs.liu.campus.domain.curricula.CurriculaStudent;
import yangtz.cs.liu.campus.domain.schoolAuthority.SchoolAuthority;
import yangtz.cs.liu.campus.domain.schoolClass.SchoolClass; import yangtz.cs.liu.campus.domain.schoolClass.SchoolClass;
import yangtz.cs.liu.campus.domain.student.SchoolStudent; import yangtz.cs.liu.campus.domain.student.SchoolStudent;
import yangtz.cs.liu.campus.domain.student.SchoolStudentScore; import yangtz.cs.liu.campus.domain.student.SchoolStudentScore;
...@@ -25,6 +31,7 @@ import java.util.Comparator; ...@@ -25,6 +31,7 @@ import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import yangtz.cs.liu.campus.vo.student.SchoolStudentVO;
@Service @Service
public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, SchoolStudentScore> implements IStudentScoreService { public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, SchoolStudentScore> implements IStudentScoreService {
...@@ -35,6 +42,8 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, Sch ...@@ -35,6 +42,8 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, Sch
private SchoolStudentMapper schoolStudentMapper; private SchoolStudentMapper schoolStudentMapper;
@Autowired @Autowired
private SchoolClassMapper schoolClassMapper; private SchoolClassMapper schoolClassMapper;
@Autowired
private SysDictDataServiceImpl dictDataService;
/** /**
* 查询学生成绩列表 * 查询学生成绩列表
...@@ -45,19 +54,353 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, Sch ...@@ -45,19 +54,353 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, Sch
public List<SchoolStudentScoreVo> selectStudentScoreList(SchoolStudentScoreVo schoolStudentScoreVo) { public List<SchoolStudentScoreVo> selectStudentScoreList(SchoolStudentScoreVo schoolStudentScoreVo) {
List<SchoolStudentScoreVo> list = studentScoreMapper.selectStudentScoreList(schoolStudentScoreVo); List<SchoolStudentScoreVo> list = studentScoreMapper.selectStudentScoreList(schoolStudentScoreVo);
list.forEach(studentScoreVo -> { list.forEach(studentScoreVo -> {
//计算考试成绩年级排名/班级排名 this.handleAchievement(studentScoreVo);
});
return list;
}
/**
* 查看学生成绩详细信息
* @param id
* @return
*/
@Override
public SchoolStudentScoreVo selectStudentScoreById(Long id) {
return studentScoreMapper.selectStudentScoreById(id);
}
/**
* 导入
* @param list
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public String importExamDetail(List<SchoolStudentScoreVo> list,Long curriculaId) {
// 准备记录日志数据
int successNum = 0;
StringBuilder successMsg = new StringBuilder();
for (SchoolStudentScoreVo schoolStudentScoreVo : list) {
LambdaQueryWrapper<SchoolStudent> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolStudent::getIdCard,schoolStudentScoreVo.getIdCard());
SchoolStudent schoolStudent = schoolStudentMapper.selectOne(wrapper);
if (StringUtils.isNotNull(schoolStudent)){
//赋值
SchoolStudentScore schoolStudentScore = new SchoolStudentScore();
schoolStudentScore.setStudentId(schoolStudent.getId());
schoolStudentScore.setCurriculaId(curriculaId);
schoolStudentScore.setClassId(schoolStudent.getClassId());
schoolStudentScore.setExamType(schoolStudentScoreVo.getExamType());
schoolStudentScore.setLanguage(schoolStudentScoreVo.getLanguage());
schoolStudentScore.setMath(schoolStudentScoreVo.getMath());
schoolStudentScore.setEnglish(schoolStudentScoreVo.getEnglish());
schoolStudentScore.setPolitics(schoolStudentScoreVo.getPolitics());
schoolStudentScore.setGeography(schoolStudentScoreVo.getGeography());
schoolStudentScore.setHistory(schoolStudentScoreVo.getHistory());
schoolStudentScore.setPhysics(schoolStudentScoreVo.getPhysics());
schoolStudentScore.setChemistry(schoolStudentScoreVo.getChemistry());
schoolStudentScore.setBiology(schoolStudentScoreVo.getBiology());
schoolStudentScore.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
schoolStudentScore.setCreateTime(DateUtils.getNowDate());
LambdaQueryWrapper<SchoolStudentScore> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(SchoolStudentScore::getExamType,schoolStudentScore.getExamType())
.eq(SchoolStudentScore::getStudentId,schoolStudentScore.getStudentId())
.eq(SchoolStudentScore::getDelFlag,"0");
List<SchoolStudentScore> schoolStudentScores = studentScoreMapper.selectList(wrapper1);
String examType = schoolStudentScoreVo.getExamType();
switch (examType){
case "1":
examType = "一次";
break;
case "2":
examType = "二次";
break;
case "3":
examType = "三次";
break;
}
if (schoolStudentScores.size() > 0){
throw new ServiceException("已存在" + schoolStudentScoreVo.getStudentName() + "学生" + examType + "考试成绩");
}
studentScoreMapper.insert(schoolStudentScore);
successNum ++;
}
}
successMsg.insert(0, "恭喜您,数据已导入成功!共有 " + successNum + " 条,数据如下:");
return successMsg.toString();
}
/**
* 校验
* @param list
*/
@Override
public void checkImport(List<SchoolStudentScoreVo> list) {
//是否为空
if (StringUtils.isNull(list) || list.size() == 0) {
throw new ServiceException("导入数据不能为空");
}
//记录日志数据
int failureNum = 0;
StringBuilder failureMsg = new StringBuilder();
for (SchoolStudentScoreVo schoolStudentScoreVo : list) {
if (StringUtils.isNull(schoolStudentScoreVo.getStudentName())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、学生姓名为空,请你重新输入!");
} else if (StringUtils.isNull(schoolStudentScoreVo.getIdCard())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、身份证号为空,请你重新输入!");
} else if (StringUtils.isEmpty(schoolStudentScoreVo.getStudentNumber())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、学号为空,请您重新输入!");
} else if (StringUtils.isEmpty(schoolStudentScoreVo.getClassName())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、班级为空,请您重新输入!");
} else if (StringUtils.isNull(schoolStudentScoreVo.getExamType())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、考试类型为空,请您重新输入!");
} else {
LambdaQueryWrapper<SchoolStudent> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolStudent::getStudentName,schoolStudentScoreVo.getStudentName())
.eq(SchoolStudent::getIdCard,schoolStudentScoreVo.getIdCard());
List<SchoolStudent> schoolStudents = schoolStudentMapper.selectList(wrapper);
if (StringUtils.isNull(schoolStudents) || schoolStudents.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、" + schoolStudentScoreVo.getStudentName() + "同学不存在,请您重新输入! ");
}else {
SchoolStudent schoolStudent = schoolStudents.get(0);
LambdaQueryWrapper<SchoolClass> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SchoolClass::getId,schoolStudent.getClassId())
.eq(SchoolClass::getClassName,schoolStudentScoreVo.getClassName());
List<SchoolClass> schoolClasses = schoolClassMapper.selectList(queryWrapper);
if (StringUtils.isNull(schoolClasses) || schoolClasses.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、" + schoolStudentScoreVo.getClassName() + "班级" + schoolStudentScoreVo.getStudentName() + "同学不存在,请您重新输入! ");
}
}
}
}
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共" + failureNum + "条数据格式不正确,错误如下:");
throw new BaseException(failureMsg.toString());
}
}
/**
* 根据身份证号获取学生信息
* @param idCard
* @return
*/
@Override
public SchoolStudentScoreVo selectStudent(String idCard) {
SchoolStudentScoreVo schoolStudentScoreVo = studentScoreMapper.selectStudent(idCard);
if (StringUtils.isNull(schoolStudentScoreVo)){
throw new ServiceException("未查询到该学生信息,请仔细核对身份证号码");
}
return schoolStudentScoreVo;
}
/**
* 新增学生成绩信息
* @param schoolStudentScore
* @return
*/
@Override
@Transactional
public int insertStudentScore(SchoolStudentScore schoolStudentScore) {
//判断是否存在该学生此次考试成绩
LambdaQueryWrapper<SchoolStudentScore> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolStudentScore::getExamType,schoolStudentScore.getExamType())
.eq(SchoolStudentScore::getStudentId,schoolStudentScore.getStudentId())
.eq(SchoolStudentScore::getDelFlag,"0");
List<SchoolStudentScore> schoolStudentScores = studentScoreMapper.selectList(wrapper);
if (schoolStudentScores.size() > 0){
throw new ServiceException("已存在该学生此次考试成绩");
}
schoolStudentScore.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
schoolStudentScore.setCreateTime(DateUtils.getNowDate());
return studentScoreMapper.insert(schoolStudentScore);
}
/**
* 修改学生成绩信息
* @param schoolStudentScore
* @return
*/
@Override
public int updateStudentScore(SchoolStudentScore schoolStudentScore) {
schoolStudentScore.setUpdateBy(SecurityUtils.getLoginUser().getUser().getUserName());
schoolStudentScore.setUpdateTime(DateUtils.getNowDate());
return studentScoreMapper.updateById(schoolStudentScore);
}
/**
* 批量删除学生成绩信息
* @param ids
* @return
*/
@Override
public int deleteStudentScore(Long[] ids) {
return studentScoreMapper.deleteStudentScore(ids);
}
private Map<String,String> typeMap = new HashMap<String,String>(){{
this.put("语","language");
this.put("数","math");
this.put("英","english");
this.put("政","politics");
this.put("地","geography");
this.put("历","history");
this.put("物","physics");
this.put("化","chemistry");
this.put("生","biology");
}};
//排名
private Map<String,String> ranKingMap = new HashMap<String,String>(){{
this.put("语","ywRanking");
this.put("数","sxRanking");
this.put("英","yyRanking");
this.put("政","zzRanking");
this.put("地","dlRanking");
this.put("历","lsRanking");
this.put("物","wlRanking");
this.put("化","hxRanking");
this.put("生","swRanking");
}};
/**
* 查询学生三类行成绩
* @param curriculaStudent
* @return
*/
@Override
public List<SchoolStudentScoreVo> getStudentTypeViwe(CurriculaStudent curriculaStudent) {
//获取学生id
Long studentId = curriculaStudent.getStudentId();
//获取课程信息
String selectedCourse = curriculaStudent.getSelectedCourse();
//学生信息查询年级信息
SchoolStudentVO info = schoolStudentMapper.getInfo(studentId);
//获取年级
SchoolClass schoolClass = schoolClassMapper.selectById(info.getClassId());
//对比课程中文名
String section_type = dictDataService.selectDictLabel("section_type" , selectedCourse);
String[] split = new String[3];
split[0] = section_type.substring(0,1);
split[1] = section_type.substring(1,2);
split[2] = section_type.substring(2,3);
//获取班级成绩
List<SchoolStudentScoreVo> schoolStudentScoreVos = this.selectStudentScoreList(studentId);
for (SchoolStudentScoreVo data : schoolStudentScoreVos) {
//重新计算年级总排名,值给根据选择专业去判断
//个人3课总成绩
Double toleType = (Double)ReflectUtils.invokeGetter(data,typeMap.get(split[0])) + (Double)ReflectUtils.invokeGetter(data,typeMap.get(split[1])) +(Double)ReflectUtils.invokeGetter(data,typeMap.get(split[2]));
data.setTotalScore(toleType);
//获取其他学生三门总成绩 做对比
SchoolStudentScoreVo schoolStudentScoreVo1 = new SchoolStudentScoreVo();
//查询本年级所有成绩列表
schoolStudentScoreVo1.setGradeValue(schoolClass.getGradeValue());
schoolStudentScoreVo1.setExamType(data.getExamType());
List<SchoolStudentScoreVo> list1 = studentScoreMapper.selectStudentScoreList(schoolStudentScoreVo1);
//重写总成绩
list1.forEach(voDate->{
voDate.setTotalScore((Double)ReflectUtils.invokeGetter(voDate,typeMap.get(split[0])) + (Double)ReflectUtils.invokeGetter(voDate,typeMap.get(split[1])) +(Double)ReflectUtils.invokeGetter(voDate,typeMap.get(split[2])));
});
//按总成绩降序排序
List<SchoolStudentScoreVo> collect = list1.stream().sorted(Comparator.comparing(SchoolStudentScoreVo::getTotalScore).reversed()).collect(Collectors.toList());
//排名
int index = 1;
double totalScore = data.getTotalScore();
for (int i = 0; i < collect.size(); i++) {
SchoolStudentScoreVo studentScoreVo1 = collect.get(i);
if (Double.compare(totalScore,studentScoreVo1.getTotalScore()) != 0 && Double.compare(totalScore,studentScoreVo1.getTotalScore()) == -1){
index ++;
}
}
data.setRanking(index);
}
//重新封装返回值去除无效值
List<SchoolStudentScoreVo> listVo = new ArrayList<>();
schoolStudentScoreVos.forEach(data->{
SchoolStudentScoreVo scoreVo = new SchoolStudentScoreVo();
scoreVo.setStudentId(data.getStudentId());
scoreVo.setClassId(data.getClassId());
scoreVo.setStudentName(data.getStudentName());
scoreVo.setStudentNumber(data.getStudentNumber());
scoreVo.setIdCard(data.getIdCard());
scoreVo.setClassName(data.getClassName());
scoreVo.setExamType(data.getExamType());
scoreVo.setTotalScore(data.getTotalScore());
scoreVo.setRanking(data.getRanking());
ReflectUtils.invokeSetter(scoreVo,typeMap.get(split[0]), (Double)ReflectUtils.invokeGetter(data,typeMap.get(split[0])));
ReflectUtils.invokeSetter(scoreVo,typeMap.get(split[1]), (Double)ReflectUtils.invokeGetter(data,typeMap.get(split[1])));
ReflectUtils.invokeSetter(scoreVo,typeMap.get(split[2]), (Double)ReflectUtils.invokeGetter(data,typeMap.get(split[2])));
ReflectUtils.invokeSetter(scoreVo,ranKingMap.get(split[0]), ReflectUtils.invokeGetter(data,ranKingMap.get(split[0])));
ReflectUtils.invokeSetter(scoreVo,ranKingMap.get(split[1]), ReflectUtils.invokeGetter(data,ranKingMap.get(split[1])));
ReflectUtils.invokeSetter(scoreVo,ranKingMap.get(split[2]), ReflectUtils.invokeGetter(data,ranKingMap.get(split[2])));
listVo.add(scoreVo);
});
return listVo;
}
/**
* 根据学生ID查询所有成绩
* @param studentId
* @return
*/
@Override
public List<SchoolStudentScoreVo> selectStudentScoreList(Long studentId) {
SchoolStudentScoreVo schoolStudentScoreVo = new SchoolStudentScoreVo();
schoolStudentScoreVo.setStudentId(studentId);
List<SchoolStudentScoreVo> schoolStudentScoreVos = studentScoreMapper
.selectStudentScoreList(schoolStudentScoreVo);
//学生信息查询年级信息
SchoolStudentVO info = schoolStudentMapper.getInfo(studentId);
//获取年级
SchoolClass schoolClass = schoolClassMapper.selectById(info.getClassId());
for (SchoolStudentScoreVo data : schoolStudentScoreVos) {
//之查看学生本年级的成绩
data.setGradeValue(schoolClass.getGradeValue());
this.handleAchievement(data);
}
Iterator<SchoolStudentScoreVo> iterator = schoolStudentScoreVos.iterator();
while (iterator.hasNext()){
SchoolStudentScoreVo next = iterator.next();
if (StringUtils.equals("4",next.getExamType())){
iterator.remove();
}
}
return schoolStudentScoreVos;
}
private SchoolStudentScoreVo handleAchievement(SchoolStudentScoreVo studentScoreVo){
//计算考试成绩年级排名/班级排名
//按年级查询 //按年级查询
SchoolStudentScoreVo schoolStudentScoreVo1 = new SchoolStudentScoreVo(); SchoolStudentScoreVo schoolStudentScoreVo1 = new SchoolStudentScoreVo();
schoolStudentScoreVo1.setCurriculaId(studentScoreVo.getCurriculaId()); schoolStudentScoreVo1.setCurriculaId(studentScoreVo.getCurriculaId());
schoolStudentScoreVo1.setExamType(studentScoreVo.getExamType()); schoolStudentScoreVo1.setExamType(studentScoreVo.getExamType());
if (studentScoreVo.getGradeValue()!=null){
schoolStudentScoreVo1.setGradeValue(studentScoreVo.getGradeValue());
}
List<SchoolStudentScoreVo> list1 = studentScoreMapper.selectStudentScoreList(schoolStudentScoreVo1); List<SchoolStudentScoreVo> list1 = studentScoreMapper.selectStudentScoreList(schoolStudentScoreVo1);
//按班级查询 //按班级查询
SchoolStudentScoreVo schoolStudentScoreVo2 = new SchoolStudentScoreVo(); SchoolStudentScoreVo schoolStudentScoreVo2 = new SchoolStudentScoreVo();
schoolStudentScoreVo2.setCurriculaId(studentScoreVo.getCurriculaId()); schoolStudentScoreVo2.setCurriculaId(studentScoreVo.getCurriculaId());
schoolStudentScoreVo2.setClassId(studentScoreVo.getClassId()); schoolStudentScoreVo2.setClassId(studentScoreVo.getClassId());
schoolStudentScoreVo2.setExamType(studentScoreVo.getExamType()); schoolStudentScoreVo2.setExamType(studentScoreVo.getExamType());
if (studentScoreVo.getGradeValue()!=null){
schoolStudentScoreVo2.setGradeValue(studentScoreVo.getGradeValue());
}
List<SchoolStudentScoreVo> list2 = studentScoreMapper.selectStudentScoreList(schoolStudentScoreVo2); List<SchoolStudentScoreVo> list2 = studentScoreMapper.selectStudentScoreList(schoolStudentScoreVo2);
//总成绩年级排名 //总成绩年级排名
...@@ -319,194 +662,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, Sch ...@@ -319,194 +662,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, Sch
} }
} }
studentScoreVo.setSwClassRanking(indexSw1); studentScoreVo.setSwClassRanking(indexSw1);
}); return studentScoreVo;
return list;
}
/**
* 查看学生成绩详细信息
* @param id
* @return
*/
@Override
public SchoolStudentScoreVo selectStudentScoreById(Long id) {
return studentScoreMapper.selectStudentScoreById(id);
}
/**
* 导入
* @param list
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public String importExamDetail(List<SchoolStudentScoreVo> list,Long curriculaId) {
// 准备记录日志数据
int successNum = 0;
StringBuilder successMsg = new StringBuilder();
for (SchoolStudentScoreVo schoolStudentScoreVo : list) {
LambdaQueryWrapper<SchoolStudent> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolStudent::getIdCard,schoolStudentScoreVo.getIdCard());
SchoolStudent schoolStudent = schoolStudentMapper.selectOne(wrapper);
if (StringUtils.isNotNull(schoolStudent)){
//赋值
SchoolStudentScore schoolStudentScore = new SchoolStudentScore();
schoolStudentScore.setStudentId(schoolStudent.getId());
schoolStudentScore.setCurriculaId(curriculaId);
schoolStudentScore.setClassId(schoolStudent.getClassId());
schoolStudentScore.setExamType(schoolStudentScoreVo.getExamType());
schoolStudentScore.setLanguage(schoolStudentScoreVo.getLanguage());
schoolStudentScore.setMath(schoolStudentScoreVo.getMath());
schoolStudentScore.setEnglish(schoolStudentScoreVo.getEnglish());
schoolStudentScore.setPolitics(schoolStudentScoreVo.getPolitics());
schoolStudentScore.setGeography(schoolStudentScoreVo.getGeography());
schoolStudentScore.setHistory(schoolStudentScoreVo.getHistory());
schoolStudentScore.setPhysics(schoolStudentScoreVo.getPhysics());
schoolStudentScore.setChemistry(schoolStudentScoreVo.getChemistry());
schoolStudentScore.setBiology(schoolStudentScoreVo.getBiology());
schoolStudentScore.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
schoolStudentScore.setCreateTime(DateUtils.getNowDate());
LambdaQueryWrapper<SchoolStudentScore> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(SchoolStudentScore::getExamType,schoolStudentScore.getExamType())
.eq(SchoolStudentScore::getStudentId,schoolStudentScore.getStudentId())
.eq(SchoolStudentScore::getDelFlag,"0");
List<SchoolStudentScore> schoolStudentScores = studentScoreMapper.selectList(wrapper1);
String examType = schoolStudentScoreVo.getExamType();
switch (examType){
case "1":
examType = "一次";
break;
case "2":
examType = "二次";
break;
case "3":
examType = "三次";
break;
}
if (schoolStudentScores.size() > 0){
throw new ServiceException("已存在" + schoolStudentScoreVo.getStudentName() + "学生" + examType + "考试成绩");
}
studentScoreMapper.insert(schoolStudentScore);
successNum ++;
}
} }
successMsg.insert(0, "恭喜您,数据已导入成功!共有 " + successNum + " 条,数据如下:");
return successMsg.toString();
}
/**
* 校验
* @param list
*/
@Override
public void checkImport(List<SchoolStudentScoreVo> list) {
//是否为空
if (StringUtils.isNull(list) || list.size() == 0) {
throw new ServiceException("导入数据不能为空");
}
//记录日志数据
int failureNum = 0;
StringBuilder failureMsg = new StringBuilder();
for (SchoolStudentScoreVo schoolStudentScoreVo : list) {
if (StringUtils.isNull(schoolStudentScoreVo.getStudentName())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、学生姓名为空,请你重新输入!");
} else if (StringUtils.isNull(schoolStudentScoreVo.getIdCard())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、身份证号为空,请你重新输入!");
} else if (StringUtils.isEmpty(schoolStudentScoreVo.getStudentNumber())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、学号为空,请您重新输入!");
} else if (StringUtils.isEmpty(schoolStudentScoreVo.getClassName())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、班级为空,请您重新输入!");
} else if (StringUtils.isNull(schoolStudentScoreVo.getExamType())) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、考试类型为空,请您重新输入!");
} else {
LambdaQueryWrapper<SchoolStudent> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolStudent::getStudentName,schoolStudentScoreVo.getStudentName())
.eq(SchoolStudent::getIdCard,schoolStudentScoreVo.getIdCard());
List<SchoolStudent> schoolStudents = schoolStudentMapper.selectList(wrapper);
if (StringUtils.isNull(schoolStudents) || schoolStudents.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、" + schoolStudentScoreVo.getStudentName() + "同学不存在,请您重新输入! ");
}else {
SchoolStudent schoolStudent = schoolStudents.get(0);
LambdaQueryWrapper<SchoolClass> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SchoolClass::getId,schoolStudent.getClassId())
.eq(SchoolClass::getClassName,schoolStudentScoreVo.getClassName());
List<SchoolClass> schoolClasses = schoolClassMapper.selectList(queryWrapper);
if (StringUtils.isNull(schoolClasses) || schoolClasses.size() == 0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、" + schoolStudentScoreVo.getClassName() + "班级" + schoolStudentScoreVo.getStudentName() + "同学不存在,请您重新输入! ");
}
}
}
}
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共" + failureNum + "条数据格式不正确,错误如下:");
throw new BaseException(failureMsg.toString());
}
}
/**
* 根据身份证号获取学生信息
* @param idCard
* @return
*/
@Override
public SchoolStudentScoreVo selectStudent(String idCard) {
SchoolStudentScoreVo schoolStudentScoreVo = studentScoreMapper.selectStudent(idCard);
if (StringUtils.isNull(schoolStudentScoreVo)){
throw new ServiceException("未查询到该学生信息,请仔细核对身份证号码");
}
return schoolStudentScoreVo;
}
/**
* 新增学生成绩信息
* @param schoolStudentScore
* @return
*/
@Override
@Transactional
public int insertStudentScore(SchoolStudentScore schoolStudentScore) {
//判断是否存在该学生此次考试成绩
LambdaQueryWrapper<SchoolStudentScore> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolStudentScore::getExamType,schoolStudentScore.getExamType())
.eq(SchoolStudentScore::getStudentId,schoolStudentScore.getStudentId())
.eq(SchoolStudentScore::getDelFlag,"0");
List<SchoolStudentScore> schoolStudentScores = studentScoreMapper.selectList(wrapper);
if (schoolStudentScores.size() > 0){
throw new ServiceException("已存在该学生此次考试成绩");
}
schoolStudentScore.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
schoolStudentScore.setCreateTime(DateUtils.getNowDate());
return studentScoreMapper.insert(schoolStudentScore);
}
/**
* 修改学生成绩信息
* @param schoolStudentScore
* @return
*/
@Override
public int updateStudentScore(SchoolStudentScore schoolStudentScore) {
schoolStudentScore.setUpdateBy(SecurityUtils.getLoginUser().getUser().getUserName());
schoolStudentScore.setUpdateTime(DateUtils.getNowDate());
return studentScoreMapper.updateById(schoolStudentScore);
}
/**
* 批量删除学生成绩信息
* @param ids
* @return
*/
@Override
public int deleteStudentScore(Long[] ids) {
return studentScoreMapper.deleteStudentScore(ids);
}
} }
package yangtz.cs.liu.campus.vo.curricula; package yangtz.cs.liu.campus.vo.curricula;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import lombok.Data; import lombok.Data;
...@@ -16,6 +14,8 @@ public class CurriculaStudentVo { ...@@ -16,6 +14,8 @@ public class CurriculaStudentVo {
private Long studentId; private Long studentId;
/** 选课主键id */ /** 选课主键id */
private Long curriculaId; private Long curriculaId;
/** 班主任id */
private Long bzrId;
/** 班级主键id */ /** 班级主键id */
private Long classId; private Long classId;
/** 班级 */ /** 班级 */
......
package yangtz.cs.liu.campus.vo.curricula;
import com.core.domain.OurBaseEntity;
import lombok.Data;
@Data
public class SchoolDivisionClassesVo extends OurBaseEntity {
/** 选课id */
private Long curriculaId;
/** 课程 */
private String course;
/** 课程名称 */
private String courseName;
/** 每种课程总人数 */
private Integer coursePeopleNumber;
/** 班级数量 */
private Integer classesNumber;
/** 每班人数 */
private Integer peopleNumber;
/** 分班班级名称 */
private String divisionClassesName;
/** 分班规则(1平行分班,2分层分班) */
private String divisionClassesRule;
/** 分班次数(1首次分班,2二次分班) */
private String divisionClassesFrequency;
}
package yangtz.cs.liu.campus.vo.curricula;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
@Data
public class StudentScoreVo {
private Long id;
/** 学生主键id */
private Long studentId;
/** 选课主键id */
private Long curriculaId;
/** 班级主键id */
private Long classId;
/** 学生姓名 */
@Excel(name = "学生姓名")
private String studentName;
/** 学号 */
@Excel(name = "学号")
private String studentNumber;
/** 身份证号 */
@Excel(name = "身份证号")
private String idCard;
/** 班级 */
@Excel(name = "班级")
private String className;
/** 考试类型 */
@Excel(name = "考试类型",combo = {"一次","二次","三次","期末"},readConverterExp = "1=一次,2=二次,3=三次,4=期末")
private String examType;
/** 总成绩 */
@Excel(name = "总成绩")
private double totalScore;
/** 年级排名 */
@Excel(name = "年级排名")
private Integer ranking;
/** 班级排名 */
private Integer classRanking;
/** 语文 */
@Excel(name = "语文")
private double language;
/** 年级排名 */
@Excel(name = "年级排名")
private Integer ywRanking;
/** 班级排名 */
private Integer ywClassRanking;
/** 数学 */
@Excel(name = "数学")
private double math;
/** 年级排名 */
@Excel(name = "年级排名")
private Integer sxRanking;
/** 班级排名 */
private Integer sxClassRanking;
/** 英语 */
@Excel(name = "英语")
private double english;
/** 年级排名 */
@Excel(name = "年级排名")
private Integer yyRanking;
/** 班级排名 */
private Integer yyClassRanking;
/** 政治 */
@Excel(name = "政治")
private double politics;
/** 年级排名 */
@Excel(name = "年级排名")
private Integer zzRanking;
/** 班级排名 */
private Integer zzClassRanking;
/** 地理 */
@Excel(name = "地理")
private double geography;
/** 年级排名 */
@Excel(name = "年级排名")
private Integer dlRanking;
/** 班级排名 */
private Integer dlClassRanking;
/** 历史 */
@Excel(name = "历史")
private double history;
/** 年级排名 */
@Excel(name = "年级排名")
private Integer lsRanking;
/** 班级排名 */
private Integer lsClassRanking;
/** 物理 */
@Excel(name = "物理")
private double physics;
/** 年级排名 */
@Excel(name = "年级排名")
private Integer wlRanking;
/** 班级排名 */
private Integer wlClassRanking;
/** 化学 */
@Excel(name = "化学")
private double chemistry;
/** 年级排名 */
@Excel(name = "年级排名")
private Integer hxRanking;
/** 班级排名 */
private Integer hxClassRanking;
/** 生物 */
@Excel(name = "生物")
private double biology;
/** 年级排名 */
@Excel(name = "年级排名")
private Integer swRanking;
/** 班级排名 */
private Integer swClassRanking;
}
...@@ -30,12 +30,14 @@ public class SchoolStudentScoreVo extends OurBaseEntity { ...@@ -30,12 +30,14 @@ public class SchoolStudentScoreVo extends OurBaseEntity {
/** 班级 */ /** 班级 */
@Excel(name = "班级") @Excel(name = "班级")
private String className; private String className;
/**年级值*/
private Integer gradeValue;
/** 考试类型 */ /** 考试类型 */
@Excel(name = "考试类型",combo = {"一次","二次","三次","期末"},readConverterExp = "1=一次,2=二次,3=三次,4=期末") @Excel(name = "考试类型",combo = {"一次","二次","三次","期末"},readConverterExp = "1=一次,2=二次,3=三次,4=期末")
private String examType; private String examType;
/** 总成绩 */ /** 总成绩 */
private double totalScore; private double totalScore;
/** 年级排名 */ /** 总成绩年级排名 */
private Integer ranking; private Integer ranking;
/** 班级排名 */ /** 班级排名 */
private Integer classRanking; private Integer classRanking;
......
package yangtz.cs.liu.wechat.controller.courseSelection;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.AjaxResult;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import yangtz.cs.liu.campus.domain.curricula.CurriclaStudentVo;
import yangtz.cs.liu.campus.domain.curricula.CurriculaStudent;
import yangtz.cs.liu.campus.domain.curricula.CurriculaVariable;
import yangtz.cs.liu.campus.domain.schoolgrade.SchoolGrade;
import yangtz.cs.liu.campus.service.curricula.ICurriculaStudentService;
import yangtz.cs.liu.campus.service.curricula.ICurriculaVariableService;
import yangtz.cs.liu.campus.service.curricula.IStudentScoreService;
import yangtz.cs.liu.campus.vo.curricula.CurriculaStudentVo;
import yangtz.cs.liu.campus.vo.student.SchoolStudentScoreVo;
/**
* 公众号,选课
*/
@RestController
@RequestMapping("/wx/course")
public class WxCouresSelection {
@Autowired
IStudentScoreService iStudentScoreService;
@Autowired
ICurriculaStudentService iCurriculaStudentService;
@Autowired
ICurriculaVariableService iCurriculaVariableService;
/**
* 学生选号信息查询
*/
@GetMapping("/getCourseInfo/{studentId}")
private AjaxResult getCourseInfo(@PathVariable("studentId") Long studentId){
//查询学生个人选课信息
LambdaQueryWrapper<CurriculaStudent> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CurriculaStudent::getStudentId,studentId);
wrapper.eq(CurriculaStudent::getDelFlag,"0");
//查询出学生任务信息
CurriculaStudent one = iCurriculaStudentService.getOne(wrapper);
//查询选课信息
CurriculaVariable byId = iCurriculaVariableService.getById(one.getCurriculaId());
CurriclaStudentVo data = new CurriclaStudentVo();
//拼接返回对象
BeanUtils.copyProperties(one,data);
BeanUtils.copyProperties(byId,data);
return AjaxResult.success(data);
}
/**
* 学生成绩查询
*/
@GetMapping("/achievement/{studentId}")
private AjaxResult getStudentAchievements(@PathVariable("studentId") Long studentId){
List<SchoolStudentScoreVo> schoolStudentScoreVos = iStudentScoreService
.selectStudentScoreList(studentId);
return AjaxResult.success(schoolStudentScoreVos);
}
/**
* 据物理化类型查看
*/
@GetMapping("/studenttypeview")
private AjaxResult getStudentTypeview( CurriculaStudent curriculaStudent){
List<SchoolStudentScoreVo> studentTypeViwe = iStudentScoreService
.getStudentTypeViwe(curriculaStudent);
return AjaxResult.success(studentTypeViwe);
}
/**
* 保存选课信息
*/
@PostMapping("/savestudentcourse")
private AjaxResult saveStudentcourse(@RequestBody CurriculaStudent curriculaStudent){
//保存专业信息
try {
iCurriculaStudentService.updateById(curriculaStudent);
return AjaxResult.success("选课成功");
}catch (Exception e){
return AjaxResult.error("选课失败");
}
}
}
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<result property="id" column="id" /> <result property="id" column="id" />
<result property="studentId" column="student_id" /> <result property="studentId" column="student_id" />
<result property="curriculaId" column="curricula_id" /> <result property="curriculaId" column="curricula_id" />
<result property="classId" column="class_id" />
<result property="className" column="class_name" /> <result property="className" column="class_name" />
<result property="studentName" column="student_name" /> <result property="studentName" column="student_name" />
<result property="idCard" column="id_card" /> <result property="idCard" column="id_card" />
...@@ -18,11 +19,11 @@ ...@@ -18,11 +19,11 @@
<result property="selectedMajor" column="selected_major" /> <result property="selectedMajor" column="selected_major" />
<result property="selectedSubject" column="selected_subject" /> <result property="selectedSubject" column="selected_subject" />
<result property="divisionClassesName" column="division_classes_name" /> <result property="divisionClassesName" column="division_classes_name" />
<result property="delFlag" column="del_flag" /> <result property="delFalg" column="del_flag" />
</resultMap> </resultMap>
<select id="countNum" parameterType="Long" resultType="Map"> <select id="countNum" parameterType="Long" resultType="Map">
SELECT COUNT(id) as zrs,(SELECT COUNT(id) FROM curricula_student WHERE curricula_id = #{curriculaId} and curricula_state = '2' AND del_flag = '0') as yxrs FROM curricula_student WHERE curricula_id = #{curriculaId} AND del_flag = '0' SELECT COUNT(id) as zrs, (SELECT COUNT(id) FROM curricula_student WHERE curricula_id = #{curriculaId} and curricula_state = '2' AND del_flag = '0') as yxrs FROM curricula_student WHERE curricula_id = #{curriculaId} AND del_flag = '0'
</select> </select>
<!--选课情况列表--> <!--选课情况列表-->
...@@ -53,6 +54,7 @@ ...@@ -53,6 +54,7 @@
<if test="courseType != null and courseType != ''">and xk.course_type = #{courseType}</if> <if test="courseType != null and courseType != ''">and xk.course_type = #{courseType}</if>
<if test="curriculaState != null and curriculaState != ''">and xk.curricula_state = #{curriculaState}</if> <if test="curriculaState != null and curriculaState != ''">and xk.curricula_state = #{curriculaState}</if>
<if test="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if> <if test="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
group by xk.id,xk.student_id,xk.curricula_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject,dc.division_classes_name
</select> </select>
<!--春季选课情况列表--> <!--春季选课情况列表-->
...@@ -83,9 +85,9 @@ ...@@ -83,9 +85,9 @@
<if test="classId != null">and xs.class_id = #{classId}</if> <if test="classId != null">and xs.class_id = #{classId}</if>
<if test="selectedMajor != null and selectedMajor != ''">and xk.selected_major like concat('%', #{selectedMajor}, '%')</if> <if test="selectedMajor != null and selectedMajor != ''">and xk.selected_major like concat('%', #{selectedMajor}, '%')</if>
<if test="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if> <if test="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
group by xk.id,xk.student_id,xk.curricula_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject,dc.division_classes_name
</select> </select>
<!--夏季选课情况列表--> <!--夏季选课情况列表-->
<select id="selectCurriculaStudentListXj" parameterType="CurriculaStudentVo" resultMap="CurriculaStudentVoResult"> <select id="selectCurriculaStudentListXj" parameterType="CurriculaStudentVo" resultMap="CurriculaStudentVoResult">
SELECT SELECT
...@@ -108,12 +110,45 @@ ...@@ -108,12 +110,45 @@
LEFT JOIN school_student xs ON xk.student_id = xs.id LEFT JOIN school_student xs ON xk.student_id = xs.id
LEFT JOIN school_class bj ON xs.class_id = bj.id LEFT JOIN school_class bj ON xs.class_id = bj.id
LEFT JOIN school_division_student ds ON xk.student_id = ds.student_id LEFT JOIN school_division_student ds ON xk.student_id = ds.student_id
LEFT JOIN school_division_classes dc ON ds.division_classes_id = dc.id LEFT JOIN school_division_classes dc ON ds.division_classes_id = dc.id and dc.division_classes_frequency = '1'
WHERE WHERE
xk.curricula_id = #{curriculaId} and xk.course_type = '2' and xk.del_flag = '0' xk.curricula_id = #{curriculaId} and xk.course_type = '2' and xk.del_flag = '0'
<if test="classId != null">and xs.class_id = #{classId}</if> <if test="classId != null">and xs.class_id = #{classId}</if>
<if test="selectedCourse != null and selectedCourse != ''">and xk.selected_course = #{selectedCourse}</if> <if test="selectedCourse != null and selectedCourse != ''">and xk.selected_course = #{selectedCourse}</if>
<if test="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if> <if test="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
group by xk.id,xk.student_id,xk.curricula_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject
ORDER BY xk.selected_course ASC
</select>
<!--夏季二次分班情况列表-->
<select id="selectCurriculaStudentListXjEc" parameterType="CurriculaStudentVo" resultMap="CurriculaStudentVoResult">
SELECT
xk.id,
xk.student_id,
xk.curricula_id,
bj.class_name,
xs.student_name,
xs.id_card,
xs.school_no AS student_number,
xk.course_type,
xk.curricula_time,
xk.curricula_state,
xk.selected_course,
xk.selected_major,
xk.selected_subject,
dc.division_classes_name
FROM
curricula_student xk
LEFT JOIN school_student xs ON xk.student_id = xs.id
LEFT JOIN school_class bj ON xs.class_id = bj.id
LEFT JOIN school_division_student ds ON xk.student_id = ds.student_id
LEFT JOIN school_division_classes dc ON ds.division_classes_id = dc.id and dc.division_classes_frequency = '2'
WHERE
xk.curricula_id = #{curriculaId} and xk.course_type = '2' and xk.del_flag = '0'
<if test="classId != null">and xs.class_id = #{classId}</if>
<if test="selectedCourse != null and selectedCourse != ''">and xk.selected_course = #{selectedCourse}</if>
<if test="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
GROUP BY xk.id,xk.student_id,xk.curricula_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject
ORDER BY xk.selected_course ASC ORDER BY xk.selected_course ASC
</select> </select>
...@@ -145,7 +180,41 @@ ...@@ -145,7 +180,41 @@
<if test="classId != null">and xs.class_id = #{classId}</if> <if test="classId != null">and xs.class_id = #{classId}</if>
<if test="selectedSubject != null and selectedSubject != ''">and xk.selected_subject = #{selectedSubject}</if> <if test="selectedSubject != null and selectedSubject != ''">and xk.selected_subject = #{selectedSubject}</if>
<if test="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if> <if test="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
GROUP BY xk.id,xk.student_id,xk.curricula_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject,dc.division_classes_name
ORDER BY xk.selected_subject ASC ORDER BY xk.selected_subject ASC
</select> </select>
<!--查看选课情况列表(班主任)-->
<select id="selectCurriculaStudentListBzr" parameterType="CurriculaStudentVo" resultMap="CurriculaStudentVoResult">
SELECT
xk.id,
xk.student_id,
xk.curricula_id,
xs.class_id,
bj.class_name,
xs.student_name,
xs.id_card,
xs.school_no AS student_number,
xk.course_type,
xk.curricula_time,
xk.curricula_state,
xk.selected_course,
xk.selected_major,
xk.selected_subject,
dc.division_classes_name
FROM
curricula_student xk
LEFT JOIN school_student xs ON xk.student_id = xs.id
LEFT JOIN school_class bj ON xs.class_id = bj.id
LEFT JOIN school_division_student ds ON xk.student_id = ds.student_id
LEFT JOIN school_division_classes dc ON ds.division_classes_id = dc.id
WHERE
xk.curricula_id = #{curriculaId} AND xk.del_flag = '0' AND xs.class_id IN (SELECT class_id FROM school_class_headmaster WHERE teacher_id = #{teacherId})
<if test="courseType != null and courseType != ''">and xk.course_type = #{courseType}</if>
<if test="classId != null and classId != ''">and xs.class_id = #{classId}</if>
<if test="curriculaState != null and curriculaState != ''">and xk.curricula_state = #{curriculaState}</if>
<if test="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
GROUP BY xk.id,xk.student_id,xk.curricula_id,xs.class_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -63,4 +63,15 @@ ...@@ -63,4 +63,15 @@
<select id="selectClass" parameterType="String" resultType="Map"> <select id="selectClass" parameterType="String" resultType="Map">
SELECT id as classId,class_name as className FROM school_class WHERE grade_id = (SELECT id FROM school_grade where grade_year = #{grade} AND del_flag = '0') SELECT id as classId,class_name as className FROM school_class WHERE grade_id = (SELECT id FROM school_grade where grade_year = #{grade} AND del_flag = '0')
</select> </select>
<select id="getGrade" resultType="Map">
select
cv.id as curriculaId,
cv.task_name as curriculaName,
cv.grade as grade,
(SELECT COUNT(id) as yxrs FROM curricula_student WHERE curricula_id = cv.id and curricula_state = '2' AND del_flag = '0') as yxrs,
(SELECT COUNT(id) as zrs FROM curricula_student WHERE curricula_id = cv.id AND del_flag = '0') as zrs
from curricula_variable cv
where cv.del_flag = '0'
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="yangtz.cs.liu.campus.mapper.curricula.DivisionClassesMapper">
<select id="getNumber" parameterType="Long" resultType="Map">
SELECT cs.selected_course as selectedCourse, zd.dict_label as selectedCourseName, COUNT(cs.selected_course) as peopleNumber
FROM curricula_student cs
LEFT JOIN sys_dict_data zd ON cs.selected_course = zd.dict_value AND zd.dict_type = "section_type"
WHERE zd.dict_label IS NOT NULL AND cs.course_type = '2' AND cs.del_flag = '0' AND cs.curricula_id = #{curriculaId}
GROUP BY cs.selected_course
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="yangtz.cs.liu.campus.mapper.curricula.DivisionStudentMapper">
</mapper>
\ No newline at end of file
...@@ -59,8 +59,10 @@ ...@@ -59,8 +59,10 @@
LEFT JOIN school_student xs ON cj.student_id = xs.id LEFT JOIN school_student xs ON cj.student_id = xs.id
LEFT JOIN school_class bj ON cj.class_id = bj.id LEFT JOIN school_class bj ON cj.class_id = bj.id
WHERE WHERE
cj.curricula_id = #{curriculaId} cj.del_flag = '0'
AND cj.del_flag = '0' <if test="curriculaId != null and curriculaId != ''">and cj.curricula_id = #{curriculaId} </if>
<if test="gradeValue != null and gradeValue != ''">and bj.grade_value = #{gradeValue} </if>
<if test="studentId != null and studentId != ''">and cj.student_id = #{studentId} </if>
<if test="examType != null and examType != ''">and cj.exam_type = #{examType}</if> <if test="examType != null and examType != ''">and cj.exam_type = #{examType}</if>
<if test="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if> <if test="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
<if test="classId != null">and cj.class_id = #{classId}</if> <if test="classId != null">and cj.class_id = #{classId}</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment