Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dd_school
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangqi
dd_school
Commits
ca7a53bf
Commit
ca7a53bf
authored
Aug 04, 2023
by
duxingshan
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
11dd987a
c1be1ad5
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1074 additions
and
5 deletions
+1074
-5
smart-campus/src/main/java/yangtz/cs/liu/campus/controller/curricula/CurriCulaVariableController.java
+30
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/controller/curricula/CurriculaStudentController.java
+65
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/controller/curricula/StudentScoreController.java
+64
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/domain/curricula/CurriculaStudent.java
+6
-2
smart-campus/src/main/java/yangtz/cs/liu/campus/domain/student/SchoolStudentScore.java
+39
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/mapper/curricula/CurriculaStudentMapper.java
+15
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/mapper/curricula/StudentScoreMapper.java
+17
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/service/curricula/ICurriculaStudentService.java
+18
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/service/curricula/ICurriculaVariableService.java
+14
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/service/curricula/IStudentScoreService.java
+30
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/curricula/CurriculaStudentServiceImpl.java
+27
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/curricula/CurriculaVariableServiceImpl.java
+44
-1
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/curricula/StudentScoreServiceImpl.java
+419
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/vo/curricula/CurriculaStudentVo.java
+55
-1
smart-campus/src/main/java/yangtz/cs/liu/campus/vo/student/SchoolStudentScoreVo.java
+115
-0
smart-campus/src/main/resources/mapper/curricula/CurriculaStudentMapper.xml
+42
-1
smart-campus/src/main/resources/mapper/curricula/StudentScoreMapper.xml
+74
-0
No files found.
smart-campus/src/main/java/yangtz/cs/liu/campus/controller/curricula/CurriCulaVariableController.java
View file @
ca7a53bf
...
...
@@ -30,6 +30,16 @@ public class CurriCulaVariableController extends BaseController {
}
/**
* 获取选课任务详细信息
* @param id
* @return
*/
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
){
return
AjaxResult
.
success
(
curriculaVariableService
.
selectCurriculaVariableById
(
id
));
}
/**
* 新增选课任务
* @param curriculaVariable
* @return
...
...
@@ -38,4 +48,23 @@ public class CurriCulaVariableController extends BaseController {
public
AjaxResult
add
(
@RequestBody
CurriculaVariable
curriculaVariable
){
return
toAjax
(
curriculaVariableService
.
insertCurriculaVariable
(
curriculaVariable
));
}
/**
* 修改选课任务
* @param curriculaVariable
* @return
*/
@PostMapping
(
"/edit"
)
public
AjaxResult
edit
(
@RequestBody
CurriculaVariable
curriculaVariable
){
return
toAjax
(
curriculaVariableService
.
updateById
(
curriculaVariable
));
}
/**
* 获取当前最新级部
* @return
*/
@GetMapping
(
"/getNewGrade"
)
public
AjaxResult
getNewGrade
(){
return
AjaxResult
.
success
(
curriculaVariableService
.
getNewGrade
());
}
}
\ No newline at end of file
smart-campus/src/main/java/yangtz/cs/liu/campus/controller/curricula/CurriculaStudentController.java
0 → 100644
View file @
ca7a53bf
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.page.TableDataInfo
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
yangtz.cs.liu.campus.service.curricula.ICurriculaStudentService
;
import
yangtz.cs.liu.campus.vo.curricula.CurriculaStudentVo
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 学生选课情况
*/
@RestController
@RequestMapping
(
"/curricula/student"
)
public
class
CurriculaStudentController
extends
BaseController
{
@Autowired
private
ICurriculaStudentService
curriculaStudentService
;
/**
* 查看选课情况列表
* @param curriculaStudentVo
* @return
*/
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
CurriculaStudentVo
curriculaStudentVo
){
startPage
();
return
getDataTable
(
curriculaStudentService
.
selectCurriculaStudentList
(
curriculaStudentVo
));
}
/**
* 导出选课情况列表
*/
@Log
(
title
=
"选课情况"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
CurriculaStudentVo
curriculaStudentVo
)
{
List
<
CurriculaStudentVo
>
list
=
curriculaStudentService
.
selectCurriculaStudentList
(
curriculaStudentVo
);
list
.
forEach
(
curriculaStudentVo1
->
{
if
(
null
!=
curriculaStudentVo1
.
getSelectedMajor
()
&&
""
.
equals
(
curriculaStudentVo1
.
getSelectedMajor
())){
String
[]
split
=
curriculaStudentVo1
.
getSelectedMajor
().
split
(
","
);
String
selectedMajorName
=
""
;
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
if
(
i
==
split
.
length
-
1
){
selectedMajorName
+=
curriculaStudentService
.
selectZyZd
(
split
[
i
])
+
","
;
}
else
{
selectedMajorName
+=
curriculaStudentService
.
selectZyZd
(
split
[
i
]);
}
}
curriculaStudentVo1
.
setSelectedMajorName
(
selectedMajorName
);
}
});
ExcelUtil
<
CurriculaStudentVo
>
util
=
new
ExcelUtil
<
CurriculaStudentVo
>(
CurriculaStudentVo
.
class
);
util
.
exportExcel
(
response
,
list
,
"选课情况数据"
);
}
}
smart-campus/src/main/java/yangtz/cs/liu/campus/controller/curricula/StudentScoreController.java
0 → 100644
View file @
ca7a53bf
package
yangtz
.
cs
.
liu
.
campus
.
controller
.
curricula
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
yangtz.cs.liu.campus.domain.schoolClass.SchoolClass
;
import
yangtz.cs.liu.campus.domain.student.SchoolStudentScore
;
import
yangtz.cs.liu.campus.service.curricula.IStudentScoreService
;
import
yangtz.cs.liu.campus.vo.student.SchoolStudentScoreVo
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 选课-学生成绩管理
*/
@RestController
@RequestMapping
(
"/curricula/studentScore"
)
public
class
StudentScoreController
extends
BaseController
{
@Autowired
private
IStudentScoreService
studentScoreService
;
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SchoolStudentScoreVo
schoolStudentScoreVo
){
startPage
();
return
getDataTable
(
studentScoreService
.
selectStudentScoreList
(
schoolStudentScoreVo
));
}
/**
* 下载模板
*
* @return
*/
@PostMapping
(
"/importTemplate"
)
public
void
importTemplate
(
HttpServletResponse
response
)
{
ExcelUtil
<
SchoolStudentScoreVo
>
util
=
new
ExcelUtil
<>(
SchoolStudentScoreVo
.
class
);
util
.
importTemplateExcel
(
response
,
"学生成绩表"
);
}
/**
* 导入
*
* @param file
* @return
* @throws Exception
*/
@PostMapping
(
"/importData"
)
public
AjaxResult
importData
(
MultipartFile
file
)
throws
Exception
{
ExcelUtil
<
SchoolStudentScoreVo
>
util
=
new
ExcelUtil
<
SchoolStudentScoreVo
>(
SchoolStudentScoreVo
.
class
);
List
<
SchoolStudentScoreVo
>
list
=
util
.
importExcel
(
file
.
getInputStream
());
//校验
studentScoreService
.
checkImport
(
list
);
//导入
String
message
=
studentScoreService
.
importExamDetail
(
list
);
return
AjaxResult
.
success
(
message
);
}
}
smart-campus/src/main/java/yangtz/cs/liu/campus/domain/curricula/CurriculaStudent.java
View file @
ca7a53bf
...
...
@@ -24,8 +24,12 @@ public class CurriculaStudent {
private
Date
curriculaTime
;
/** 选课状态(1-未选课,2-已选课) */
private
String
curriculaState
;
/** 已选专业/课程 */
private
String
selectedCourse
;
/** 已选课程 */
private
Integer
selectedCourse
;
/** 已选专业 */
private
String
selectedMajor
;
/** 所选科目 */
private
Integer
selectedSubject
;
/** 是否删除 */
private
String
delFalg
;
}
smart-campus/src/main/java/yangtz/cs/liu/campus/domain/student/SchoolStudentScore.java
0 → 100644
View file @
ca7a53bf
package
yangtz
.
cs
.
liu
.
campus
.
domain
.
student
;
import
com.core.domain.OurBaseEntity
;
import
lombok.Data
;
/**
* 学生成绩对象
*/
@Data
public
class
SchoolStudentScore
extends
OurBaseEntity
{
/** 学生主键id */
private
Long
studentId
;
/** 选课主键id */
private
Long
curriculaId
;
/** 班级主键id */
private
Long
classId
;
/** 考试类型 */
private
String
examType
;
/** 语文 */
private
Integer
language
;
/** 数学 */
private
Integer
math
;
/** 英语 */
private
Integer
english
;
/** 政治 */
private
Integer
politics
;
/** 地理 */
private
Integer
geography
;
/** 历史 */
private
Integer
history
;
/** 物理 */
private
Integer
physics
;
/** 化学 */
private
Integer
chemistry
;
/** 生物 */
private
Integer
biology
;
}
smart-campus/src/main/java/yangtz/cs/liu/campus/mapper/curricula/CurriculaStudentMapper.java
View file @
ca7a53bf
...
...
@@ -3,7 +3,9 @@ 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.CurriculaStudent
;
import
yangtz.cs.liu.campus.vo.curricula.CurriculaStudentVo
;
import
java.util.List
;
import
java.util.Map
;
public
interface
CurriculaStudentMapper
extends
BaseMapper
<
CurriculaStudent
>
{
...
...
@@ -15,4 +17,17 @@ public interface CurriculaStudentMapper extends BaseMapper<CurriculaStudent> {
*/
Map
<
String
,
Long
>
countNum
(
@Param
(
"curriculaId"
)
Long
curriculaId
);
/**
* 查看选课情况列表
* @param curriculaStudentVo
* @return
*/
List
<
CurriculaStudentVo
>
selectCurriculaStudentList
(
CurriculaStudentVo
curriculaStudentVo
);
/**
* 查询专业字典
* @param dictValue
* @return
*/
String
selectZyZd
(
@Param
(
"dictValue"
)
String
dictValue
);
}
smart-campus/src/main/java/yangtz/cs/liu/campus/mapper/curricula/StudentScoreMapper.java
0 → 100644
View file @
ca7a53bf
package
yangtz
.
cs
.
liu
.
campus
.
mapper
.
curricula
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
yangtz.cs.liu.campus.domain.student.SchoolStudentScore
;
import
yangtz.cs.liu.campus.vo.student.SchoolStudentScoreVo
;
import
java.util.List
;
public
interface
StudentScoreMapper
extends
BaseMapper
<
SchoolStudentScore
>
{
/**
* 查询学生成绩列表
* @param schoolStudentScoreVo
* @return
*/
List
<
SchoolStudentScoreVo
>
selectStudentScoreList
(
SchoolStudentScoreVo
schoolStudentScoreVo
);
}
smart-campus/src/main/java/yangtz/cs/liu/campus/service/curricula/ICurriculaStudentService.java
View file @
ca7a53bf
package
yangtz
.
cs
.
liu
.
campus
.
service
.
curricula
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
org.apache.ibatis.annotations.Param
;
import
yangtz.cs.liu.campus.domain.curricula.CurriculaStudent
;
import
yangtz.cs.liu.campus.vo.curricula.CurriculaStudentVo
;
import
java.util.List
;
public
interface
ICurriculaStudentService
extends
IService
<
CurriculaStudent
>
{
/**
* 查看选课情况列表
* @param curriculaStudentVo
* @return
*/
List
<
CurriculaStudentVo
>
selectCurriculaStudentList
(
CurriculaStudentVo
curriculaStudentVo
);
/**
* 查询专业字典
* @param dictValue
* @return
*/
String
selectZyZd
(
String
dictValue
);
}
smart-campus/src/main/java/yangtz/cs/liu/campus/service/curricula/ICurriculaVariableService.java
View file @
ca7a53bf
...
...
@@ -5,6 +5,7 @@ import yangtz.cs.liu.campus.domain.curricula.CurriculaVariable;
import
yangtz.cs.liu.campus.vo.curricula.CurriculaVariableVo
;
import
java.util.List
;
import
java.util.Map
;
public
interface
ICurriculaVariableService
extends
IService
<
CurriculaVariable
>
{
/**
...
...
@@ -21,4 +22,17 @@ public interface ICurriculaVariableService extends IService<CurriculaVariable> {
*/
int
insertCurriculaVariable
(
CurriculaVariable
curriculaVariable
);
/**
* 获取选课任务详细信息
* @param id
* @return
*/
CurriculaVariableVo
selectCurriculaVariableById
(
Long
id
);
/**
* 获取当前最新级部
* @return
*/
Map
<
String
,
String
>
getNewGrade
();
}
smart-campus/src/main/java/yangtz/cs/liu/campus/service/curricula/IStudentScoreService.java
0 → 100644
View file @
ca7a53bf
package
yangtz
.
cs
.
liu
.
campus
.
service
.
curricula
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
yangtz.cs.liu.campus.domain.student.SchoolStudentScore
;
import
yangtz.cs.liu.campus.vo.student.SchoolStudentScoreVo
;
import
java.util.List
;
public
interface
IStudentScoreService
extends
IService
<
SchoolStudentScore
>
{
/**
* 查询学生成绩列表
* @param schoolStudentScoreVo
* @return
*/
List
<
SchoolStudentScoreVo
>
selectStudentScoreList
(
SchoolStudentScoreVo
schoolStudentScoreVo
);
/**
* 导入
* @param list
* @return
*/
String
importExamDetail
(
List
<
SchoolStudentScoreVo
>
list
);
/**
* 校验
* @param list
*/
void
checkImport
(
List
<
SchoolStudentScoreVo
>
list
);
}
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/curricula/CurriculaStudentServiceImpl.java
View file @
ca7a53bf
package
yangtz
.
cs
.
liu
.
campus
.
service
.
impl
.
curricula
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
yangtz.cs.liu.campus.domain.curricula.CurriculaStudent
;
import
yangtz.cs.liu.campus.mapper.curricula.CurriculaStudentMapper
;
import
yangtz.cs.liu.campus.service.curricula.ICurriculaStudentService
;
import
yangtz.cs.liu.campus.vo.curricula.CurriculaStudentVo
;
import
java.util.List
;
@Service
public
class
CurriculaStudentServiceImpl
extends
ServiceImpl
<
CurriculaStudentMapper
,
CurriculaStudent
>
implements
ICurriculaStudentService
{
@Autowired
private
CurriculaStudentMapper
curriculaStudentMapper
;
/**
* 查看选课情况列表
* @param curriculaStudentVo
* @return
*/
@Override
public
List
<
CurriculaStudentVo
>
selectCurriculaStudentList
(
CurriculaStudentVo
curriculaStudentVo
)
{
return
curriculaStudentMapper
.
selectCurriculaStudentList
(
curriculaStudentVo
);
}
/**
* 查询专业字典
* @param dictValue
* @return
*/
@Override
public
String
selectZyZd
(
String
dictValue
)
{
return
curriculaStudentMapper
.
selectZyZd
(
dictValue
);
}
}
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/curricula/CurriculaVariableServiceImpl.java
View file @
ca7a53bf
...
...
@@ -11,13 +11,17 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
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.mapper.curricula.CurriculaStudentMapper
;
import
yangtz.cs.liu.campus.mapper.curricula.CurriculaVariableMapper
;
import
yangtz.cs.liu.campus.mapper.schoolgrade.SchoolGradeMapper
;
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
static
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
StringUtils
.
isNotBlank
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -28,6 +32,8 @@ public class CurriculaVariableServiceImpl extends ServiceImpl<CurriculaVariableM
private
CurriculaVariableMapper
curriculaVariableMapper
;
@Autowired
private
CurriculaStudentMapper
curriculaStudentMapper
;
@Autowired
private
SchoolGradeMapper
schoolGradeMapper
;
/**
* 查询选课任务列表
* @param curriculaVariable
...
...
@@ -37,11 +43,12 @@ public class CurriculaVariableServiceImpl extends ServiceImpl<CurriculaVariableM
public
List
<
CurriculaVariableVo
>
selectCurriculaVariableList
(
CurriculaVariableVo
curriculaVariable
)
{
List
<
CurriculaVariableVo
>
list
=
new
ArrayList
<>();
LambdaQueryWrapper
<
CurriculaVariable
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
isNotBlank
(
curriculaVariable
.
getTaskName
()),
CurriculaVariable:
:
getTaskName
,
curriculaVariable
.
getTaskName
())
wrapper
.
like
(
isNotBlank
(
curriculaVariable
.
getTaskName
()),
CurriculaVariable:
:
getTaskName
,
curriculaVariable
.
getTaskName
())
.
eq
(
isNotBlank
(
curriculaVariable
.
getGrade
()),
CurriculaVariable:
:
getGrade
,
curriculaVariable
.
getGrade
())
.
eq
(
CurriculaVariable:
:
getDelFlag
,
"0"
)
.
orderByDesc
(
CurriculaVariable:
:
getGrade
);
List
<
CurriculaVariable
>
curriculaVariables
=
curriculaVariableMapper
.
selectList
(
wrapper
);
//循环选课任务列表,计算总人数和已选人数
curriculaVariables
.
forEach
(
curriculaVariable1
->
{
CurriculaVariableVo
curriculaVariableVo
=
new
CurriculaVariableVo
();
BeanUtils
.
copyProperties
(
curriculaVariable1
,
curriculaVariableVo
);
...
...
@@ -90,4 +97,40 @@ public class CurriculaVariableServiceImpl extends ServiceImpl<CurriculaVariableM
}
return
i
;
}
/**
* 获取选课任务详细信息
* @param id
* @return
*/
@Override
public
CurriculaVariableVo
selectCurriculaVariableById
(
Long
id
)
{
//通过id查询选课任务
CurriculaVariable
curriculaVariable
=
curriculaVariableMapper
.
selectById
(
id
);
//转vo
CurriculaVariableVo
curriculaVariableVo
=
new
CurriculaVariableVo
();
BeanUtils
.
copyProperties
(
curriculaVariable
,
curriculaVariableVo
);
//计算总人数和已选人数
Map
<
String
,
Long
>
map
=
curriculaStudentMapper
.
countNum
(
id
);
Long
zrs
=
map
.
get
(
"zrs"
);
Long
yxrs
=
map
.
get
(
"yxrs"
);
curriculaVariableVo
.
setYxrs
(
zrs
.
intValue
());
curriculaVariableVo
.
setZrs
(
yxrs
.
intValue
());
return
curriculaVariableVo
;
}
/**
* 获取当前最新级部
* @return
*/
@Override
public
Map
<
String
,
String
>
getNewGrade
()
{
LambdaQueryWrapper
<
SchoolGrade
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
SchoolGrade:
:
getDelFlag
,
'0'
)
.
orderByDesc
(
SchoolGrade:
:
getGradeYear
).
last
(
"LIMIT 1"
);
SchoolGrade
schoolGrade
=
schoolGradeMapper
.
selectOne
(
wrapper
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"grade"
,
schoolGrade
.
getGradeYear
());
return
map
;
}
}
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/curricula/StudentScoreServiceImpl.java
0 → 100644
View file @
ca7a53bf
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.exception.base.BaseException
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
yangtz.cs.liu.campus.domain.schoolClass.SchoolClass
;
import
yangtz.cs.liu.campus.domain.student.SchoolStudent
;
import
yangtz.cs.liu.campus.domain.student.SchoolStudentScore
;
import
yangtz.cs.liu.campus.mapper.curricula.StudentScoreMapper
;
import
yangtz.cs.liu.campus.mapper.schoolClass.SchoolClassMapper
;
import
yangtz.cs.liu.campus.mapper.student.SchoolStudentMapper
;
import
yangtz.cs.liu.campus.service.curricula.IStudentScoreService
;
import
yangtz.cs.liu.campus.vo.student.SchoolStudentScoreVo
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
public
class
StudentScoreServiceImpl
extends
ServiceImpl
<
StudentScoreMapper
,
SchoolStudentScore
>
implements
IStudentScoreService
{
@Autowired
private
StudentScoreMapper
studentScoreMapper
;
@Autowired
private
SchoolStudentMapper
schoolStudentMapper
;
@Autowired
private
SchoolClassMapper
schoolClassMapper
;
/**
* 查询学生成绩列表
* @param schoolStudentScoreVo
* @return
*/
@Override
public
List
<
SchoolStudentScoreVo
>
selectStudentScoreList
(
SchoolStudentScoreVo
schoolStudentScoreVo
)
{
List
<
SchoolStudentScoreVo
>
list
=
studentScoreMapper
.
selectStudentScoreList
(
schoolStudentScoreVo
);
list
.
forEach
(
studentScoreVo
->
{
//计算考试成绩年级排名/班级排名
//按年级查询
SchoolStudentScoreVo
schoolStudentScoreVo1
=
new
SchoolStudentScoreVo
();
schoolStudentScoreVo1
.
setCurriculaId
(
studentScoreVo
.
getCurriculaId
());
schoolStudentScoreVo1
.
setExamType
(
studentScoreVo
.
getExamType
());
List
<
SchoolStudentScoreVo
>
list1
=
studentScoreMapper
.
selectStudentScoreList
(
schoolStudentScoreVo1
);
//按班级查询
SchoolStudentScoreVo
schoolStudentScoreVo2
=
new
SchoolStudentScoreVo
();
schoolStudentScoreVo2
.
setCurriculaId
(
studentScoreVo
.
getCurriculaId
());
schoolStudentScoreVo2
.
setClassId
(
studentScoreVo
.
getClassId
());
schoolStudentScoreVo2
.
setExamType
(
studentScoreVo
.
getExamType
());
List
<
SchoolStudentScoreVo
>
list2
=
studentScoreMapper
.
selectStudentScoreList
(
schoolStudentScoreVo2
);
//总成绩年级排名
//按总成绩降序排序
List
<
SchoolStudentScoreVo
>
collect
=
list1
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getTotalScore
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
index
=
1
;
double
totalScore
=
studentScoreVo
.
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
++;
}
}
studentScoreVo
.
setRanking
(
index
);
//总成绩班级排名
//按总成绩降序排序
List
<
SchoolStudentScoreVo
>
collect1
=
list2
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getTotalScore
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
index1
=
1
;
for
(
int
i
=
0
;
i
<
collect1
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVo2
=
collect1
.
get
(
i
);
if
(
Double
.
compare
(
totalScore
,
studentScoreVo2
.
getTotalScore
())
!=
0
&&
Double
.
compare
(
totalScore
,
studentScoreVo2
.
getTotalScore
())
==
-
1
){
index1
++;
}
}
studentScoreVo
.
setClassRanking
(
index1
);
//语文成绩年级排名
//按语文成绩降序排序
List
<
SchoolStudentScoreVo
>
collect2
=
list1
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getLanguage
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
index3
=
1
;
double
language
=
studentScoreVo
.
getLanguage
();
for
(
int
i
=
0
;
i
<
collect2
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVo1
=
collect2
.
get
(
i
);
if
(
Double
.
compare
(
language
,
studentScoreVo1
.
getLanguage
())
!=
0
&&
Double
.
compare
(
language
,
studentScoreVo1
.
getLanguage
())
==
-
1
){
index3
++;
}
}
studentScoreVo
.
setYwRanking
(
index3
);
//语文成绩班级排名
//按语文成绩降序排序
List
<
SchoolStudentScoreVo
>
collect4
=
list2
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getLanguage
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
index4
=
1
;
for
(
int
i
=
0
;
i
<
collect4
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVo2
=
collect4
.
get
(
i
);
if
(
Double
.
compare
(
language
,
studentScoreVo2
.
getLanguage
())
!=
0
&&
Double
.
compare
(
language
,
studentScoreVo2
.
getLanguage
())
==
-
1
){
index4
++;
}
}
studentScoreVo
.
setYwClassRanking
(
index4
);
//数学成绩年级排名
//按数学成绩降序排序
List
<
SchoolStudentScoreVo
>
collect3
=
list1
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getMath
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
index5
=
1
;
double
math
=
studentScoreVo
.
getMath
();
for
(
int
i
=
0
;
i
<
collect3
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVo1
=
collect3
.
get
(
i
);
if
(
Double
.
compare
(
math
,
studentScoreVo1
.
getMath
())
!=
0
&&
Double
.
compare
(
math
,
studentScoreVo1
.
getMath
())
==
-
1
){
index5
++;
}
}
studentScoreVo
.
setSxRanking
(
index5
);
//数学成绩班级排名
//按数学成绩降序排序
List
<
SchoolStudentScoreVo
>
collect6
=
list2
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getMath
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
index6
=
1
;
for
(
int
i
=
0
;
i
<
collect6
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVo2
=
collect6
.
get
(
i
);
if
(
Double
.
compare
(
math
,
studentScoreVo2
.
getMath
())
!=
0
&&
Double
.
compare
(
math
,
studentScoreVo2
.
getMath
())
==
-
1
)
{
index6
++;
}
}
studentScoreVo
.
setSxClassRanking
(
index6
);
//英语成绩年级排名
//按英语成绩降序排序
List
<
SchoolStudentScoreVo
>
collectYy
=
list1
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getEnglish
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexYy
=
1
;
double
english
=
studentScoreVo
.
getEnglish
();
for
(
int
i
=
0
;
i
<
collectYy
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoYy
=
collectYy
.
get
(
i
);
if
(
Double
.
compare
(
english
,
studentScoreVoYy
.
getEnglish
())
!=
0
&&
Double
.
compare
(
english
,
studentScoreVoYy
.
getEnglish
())
==
-
1
){
indexYy
++;
}
}
studentScoreVo
.
setYyRanking
(
indexYy
);
//英语成绩班级排名
//按英语成绩降序排序
List
<
SchoolStudentScoreVo
>
collectYy1
=
list2
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getEnglish
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexYy1
=
1
;
for
(
int
i
=
0
;
i
<
collectYy1
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoYy1
=
collectYy1
.
get
(
i
);
if
(
Double
.
compare
(
english
,
studentScoreVoYy1
.
getEnglish
())
!=
0
&&
Double
.
compare
(
english
,
studentScoreVoYy1
.
getEnglish
())
==
-
1
){
indexYy1
++;
}
}
studentScoreVo
.
setYyClassRanking
(
indexYy1
);
//政治成绩年级排名
//按政治成绩降序排序
List
<
SchoolStudentScoreVo
>
collectZz
=
list1
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getPolitics
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexZz
=
1
;
double
politics
=
studentScoreVo
.
getPolitics
();
for
(
int
i
=
0
;
i
<
collectZz
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoZz
=
collectZz
.
get
(
i
);
if
(
Double
.
compare
(
politics
,
studentScoreVoZz
.
getPolitics
())
!=
0
&&
Double
.
compare
(
politics
,
studentScoreVoZz
.
getPolitics
())
==
-
1
){
indexZz
++;
}
}
studentScoreVo
.
setZzRanking
(
indexZz
);
//政治成绩班级排名
//按政治成绩降序排序
List
<
SchoolStudentScoreVo
>
collectZz1
=
list2
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getPolitics
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexZz1
=
1
;
for
(
int
i
=
0
;
i
<
collectZz1
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoZz1
=
collectZz1
.
get
(
i
);
if
(
Double
.
compare
(
politics
,
studentScoreVoZz1
.
getPolitics
())
!=
0
&&
Double
.
compare
(
politics
,
studentScoreVoZz1
.
getPolitics
())
==
-
1
){
indexZz1
++;
}
}
studentScoreVo
.
setZzClassRanking
(
indexZz1
);
//地理成绩年级排名
//按地理成绩降序排序
List
<
SchoolStudentScoreVo
>
collectDl
=
list1
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getGeography
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexDl
=
1
;
double
geography
=
studentScoreVo
.
getGeography
();
for
(
int
i
=
0
;
i
<
collectDl
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoDl
=
collectDl
.
get
(
i
);
if
(
Double
.
compare
(
geography
,
studentScoreVoDl
.
getGeography
())
!=
0
&&
Double
.
compare
(
geography
,
studentScoreVoDl
.
getGeography
())
==
-
1
){
indexDl
++;
}
}
studentScoreVo
.
setDlRanking
(
indexDl
);
//地理成绩班级排名
//按地理成绩降序排序
List
<
SchoolStudentScoreVo
>
collectDl1
=
list2
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getGeography
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexDl1
=
1
;
for
(
int
i
=
0
;
i
<
collectDl1
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoDl1
=
collectDl1
.
get
(
i
);
if
(
Double
.
compare
(
geography
,
studentScoreVoDl1
.
getGeography
())
!=
0
&&
Double
.
compare
(
geography
,
studentScoreVoDl1
.
getGeography
())
==
-
1
){
indexDl1
++;
}
}
studentScoreVo
.
setDlClassRanking
(
indexDl1
);
//历史成绩年级排名
//按历史成绩降序排序
List
<
SchoolStudentScoreVo
>
collectLs
=
list1
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getHistory
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexLs
=
1
;
double
history
=
studentScoreVo
.
getHistory
();
for
(
int
i
=
0
;
i
<
collectLs
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoLs
=
collectLs
.
get
(
i
);
if
(
Double
.
compare
(
history
,
studentScoreVoLs
.
getHistory
())
!=
0
&&
Double
.
compare
(
history
,
studentScoreVoLs
.
getHistory
())
==
-
1
){
indexLs
++;
}
}
studentScoreVo
.
setLsRanking
(
indexLs
);
//历史成绩班级排名
//按历史成绩降序排序
List
<
SchoolStudentScoreVo
>
collectLs1
=
list2
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getHistory
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexLs1
=
1
;
for
(
int
i
=
0
;
i
<
collectLs1
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoLs1
=
collectLs1
.
get
(
i
);
if
(
Double
.
compare
(
history
,
studentScoreVoLs1
.
getHistory
())
!=
0
&&
Double
.
compare
(
history
,
studentScoreVoLs1
.
getHistory
())
==
-
1
){
indexLs1
++;
}
}
studentScoreVo
.
setLsClassRanking
(
indexLs1
);
//物理成绩年级排名
//按物理成绩降序排序
List
<
SchoolStudentScoreVo
>
collectWl
=
list1
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getPhysics
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexWl
=
1
;
double
physics
=
studentScoreVo
.
getPhysics
();
for
(
int
i
=
0
;
i
<
collectWl
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoWl
=
collectWl
.
get
(
i
);
if
(
Double
.
compare
(
physics
,
studentScoreVoWl
.
getPhysics
())
!=
0
&&
Double
.
compare
(
physics
,
studentScoreVoWl
.
getPhysics
())
==
-
1
){
indexWl
++;
}
}
studentScoreVo
.
setWlRanking
(
indexWl
);
//物理成绩班级排名
//按物理成绩降序排序
List
<
SchoolStudentScoreVo
>
collectWl1
=
list2
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getPhysics
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexWl1
=
1
;
for
(
int
i
=
0
;
i
<
collectWl1
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoWl1
=
collectWl1
.
get
(
i
);
if
(
Double
.
compare
(
physics
,
studentScoreVoWl1
.
getPhysics
())
!=
0
&&
Double
.
compare
(
physics
,
studentScoreVoWl1
.
getPhysics
())
==
-
1
){
indexWl1
++;
}
}
studentScoreVo
.
setWlClassRanking
(
indexWl1
);
//化学成绩年级排名
//按化学成绩降序排序
List
<
SchoolStudentScoreVo
>
collectHx
=
list1
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getChemistry
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexHx
=
1
;
double
chemistry
=
studentScoreVo
.
getChemistry
();
for
(
int
i
=
0
;
i
<
collectHx
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoHx
=
collectHx
.
get
(
i
);
if
(
Double
.
compare
(
chemistry
,
studentScoreVoHx
.
getChemistry
())
!=
0
&&
Double
.
compare
(
chemistry
,
studentScoreVoHx
.
getChemistry
())
==
-
1
){
indexHx
++;
}
}
studentScoreVo
.
setHxRanking
(
indexHx
);
//化学成绩班级排名
//按化学成绩降序排序
List
<
SchoolStudentScoreVo
>
collectHx1
=
list2
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getChemistry
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexHx1
=
1
;
for
(
int
i
=
0
;
i
<
collectHx1
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoHx1
=
collectHx1
.
get
(
i
);
if
(
Double
.
compare
(
chemistry
,
studentScoreVoHx1
.
getChemistry
())
!=
0
&&
Double
.
compare
(
chemistry
,
studentScoreVoHx1
.
getChemistry
())
==
-
1
){
indexHx1
++;
}
}
studentScoreVo
.
setHxClassRanking
(
indexHx1
);
//生物成绩年级排名
//按生物成绩降序排序
List
<
SchoolStudentScoreVo
>
collectSw
=
list1
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getBiology
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexSw
=
1
;
double
biology
=
studentScoreVo
.
getBiology
();
for
(
int
i
=
0
;
i
<
collectSw
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoSw
=
collectSw
.
get
(
i
);
if
(
Double
.
compare
(
biology
,
studentScoreVoSw
.
getBiology
())
!=
0
&&
Double
.
compare
(
biology
,
studentScoreVoSw
.
getBiology
())
==
-
1
){
indexSw
++;
}
}
studentScoreVo
.
setSwRanking
(
indexSw
);
//生物成绩班级排名
//按生物成绩降序排序
List
<
SchoolStudentScoreVo
>
collectSw1
=
list2
.
stream
().
sorted
(
Comparator
.
comparing
(
SchoolStudentScoreVo:
:
getBiology
).
reversed
()).
collect
(
Collectors
.
toList
());
//排名
int
indexSw1
=
1
;
for
(
int
i
=
0
;
i
<
collectSw1
.
size
();
i
++)
{
SchoolStudentScoreVo
studentScoreVoSw1
=
collectSw1
.
get
(
i
);
if
(
Double
.
compare
(
biology
,
studentScoreVoSw1
.
getBiology
())
!=
0
&&
Double
.
compare
(
biology
,
studentScoreVoSw1
.
getBiology
())
==
-
1
){
indexSw1
++;
}
}
studentScoreVo
.
setSwClassRanking
(
indexSw1
);
});
return
list
;
}
/**
* 导入
* @param list
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
importExamDetail
(
List
<
SchoolStudentScoreVo
>
list
)
{
// 准备记录日志数据
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
.
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
());
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
());
}
}
}
smart-campus/src/main/java/yangtz/cs/liu/campus/vo/curricula/CurriculaStudentVo.java
View file @
ca7a53bf
package
yangtz
.
cs
.
liu
.
campus
.
vo
.
curricula
;
public
class
CurriculaStudentVo
{
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.ruoyi.common.annotation.Excel
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
CurriculaStudentVo
{
/** 主键id */
private
Long
id
;
/** 学生主键id */
private
Long
studentId
;
/** 选课主键id */
private
Long
curriculaId
;
/** 班级 */
@Excel
(
name
=
"班级"
)
private
String
className
;
/** 学生姓名 */
@Excel
(
name
=
"学生姓名"
)
private
String
studentName
;
/** 身份证号 */
@Excel
(
name
=
"身份证号"
)
private
String
idCard
;
/** 学号 */
@Excel
(
name
=
"学号"
)
private
String
studentNumber
;
/** 课程类型(1-春季选课,2-夏季选课,3-艺体) */
@Excel
(
name
=
"课程类型"
,
readConverterExp
=
"1=春季选课,2=夏季选课,3=艺体"
)
private
String
courseType
;
/** 选课时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"选课时间"
,
dateFormat
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
curriculaTime
;
/** 选课状态(1-未选课,2-已选课) */
@Excel
(
name
=
"选课状态"
,
readConverterExp
=
"1=未选课,2=已选课"
)
private
String
curriculaState
;
/** 已选课程 */
@Excel
(
name
=
"已选课程"
,
readConverterExp
=
"1=物理+政治+化学,2=物理+政治+生物,3=物理+政治+地理,4=物理+政治+历史,5=物理+历史+化学,6=物理+历史+生物,7=物理+地理+化学,8=物理+地理+生物"
+
",9=物理+化学+生物,10=物理+历史+地理,11=化学+政治+地理,12=化学+政治+历史,13=化学+政治+生物,14=化学+历史+地理,15=化学+历史+生物,16=化学+地理+生物,17=生物+政治+地理"
+
",18=生物+历史+地理,19=生物+政治+历史,20=政治+历史+地理"
)
private
Integer
selectedCourse
;
/** 已选专业 */
private
String
selectedMajor
;
/** 已选专业名称 */
@Excel
(
name
=
"已选专业"
)
private
String
selectedMajorName
;
/** 所选科目 */
@Excel
(
name
=
"所选科目"
,
readConverterExp
=
"1=音乐,2=美术,3=田径,4=舞蹈"
)
private
Integer
selectedSubject
;
/** 所分班级 */
@Excel
(
name
=
"所分班级"
)
private
String
divisionClasses
;
/** 是否删除 */
private
String
delFalg
;
}
smart-campus/src/main/java/yangtz/cs/liu/campus/vo/student/SchoolStudentScoreVo.java
0 → 100644
View file @
ca7a53bf
package
yangtz
.
cs
.
liu
.
campus
.
vo
.
student
;
import
com.core.domain.OurBaseEntity
;
import
com.ruoyi.common.annotation.Excel
;
import
lombok.Data
;
/**
* 学生成绩对象vo
*/
@Data
public
class
SchoolStudentScoreVo
extends
OurBaseEntity
{
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
;
/** 总成绩 */
private
double
totalScore
;
/** 年级排名 */
private
Integer
ranking
;
/** 班级排名 */
private
Integer
classRanking
;
/** 语文 */
@Excel
(
name
=
"语文"
)
private
double
language
;
/** 年级排名 */
private
Integer
ywRanking
;
/** 班级排名 */
private
Integer
ywClassRanking
;
/** 数学 */
@Excel
(
name
=
"数学"
)
private
double
math
;
/** 年级排名 */
private
Integer
sxRanking
;
/** 班级排名 */
private
Integer
sxClassRanking
;
/** 英语 */
@Excel
(
name
=
"英语"
)
private
double
english
;
/** 年级排名 */
private
Integer
yyRanking
;
/** 班级排名 */
private
Integer
yyClassRanking
;
/** 政治 */
@Excel
(
name
=
"政治"
)
private
double
politics
;
/** 年级排名 */
private
Integer
zzRanking
;
/** 班级排名 */
private
Integer
zzClassRanking
;
/** 地理 */
@Excel
(
name
=
"地理"
)
private
double
geography
;
/** 年级排名 */
private
Integer
dlRanking
;
/** 班级排名 */
private
Integer
dlClassRanking
;
/** 历史 */
@Excel
(
name
=
"历史"
)
private
double
history
;
/** 年级排名 */
private
Integer
lsRanking
;
/** 班级排名 */
private
Integer
lsClassRanking
;
/** 物理 */
@Excel
(
name
=
"物理"
)
private
double
physics
;
/** 年级排名 */
private
Integer
wlRanking
;
/** 班级排名 */
private
Integer
wlClassRanking
;
/** 化学 */
@Excel
(
name
=
"化学"
)
private
double
chemistry
;
/** 年级排名 */
private
Integer
hxRanking
;
/** 班级排名 */
private
Integer
hxClassRanking
;
/** 生物 */
@Excel
(
name
=
"生物"
)
private
double
biology
;
/** 年级排名 */
private
Integer
swRanking
;
/** 班级排名 */
private
Integer
swClassRanking
;
public
double
getTotalScore
()
{
return
totalScore
;
}
public
void
setTotalScore
(
double
totalScore
)
{
this
.
totalScore
=
totalScore
;
}
}
smart-campus/src/main/resources/mapper/curricula/CurriculaStudentMapper.xml
View file @
ca7a53bf
...
...
@@ -3,14 +3,21 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"yangtz.cs.liu.campus.mapper.curricula.CurriculaStudentMapper"
>
<resultMap
type=
"CurriculaStudent
"
id=
"CurriculaStudent
Result"
>
<resultMap
type=
"CurriculaStudent
Vo"
id=
"CurriculaStudentVo
Result"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"studentId"
column=
"student_id"
/>
<result
property=
"curriculaId"
column=
"curricula_id"
/>
<result
property=
"className"
column=
"class_name"
/>
<result
property=
"studentName"
column=
"student_name"
/>
<result
property=
"idCard"
column=
"id_card"
/>
<result
property=
"studentNumber"
column=
"student_number"
/>
<result
property=
"courseType"
column=
"course_type"
/>
<result
property=
"curriculaTime"
column=
"curricula_time"
/>
<result
property=
"curriculaState"
column=
"curricula_state"
/>
<result
property=
"selectedCourse"
column=
"selected_course"
/>
<result
property=
"selectedMajor"
column=
"selected_major"
/>
<result
property=
"selectedSubject"
column=
"selected_subject"
/>
<result
property=
"divisionClasses"
column=
"division_classes"
/>
<result
property=
"delFlag"
column=
"del_flag"
/>
</resultMap>
...
...
@@ -18,4 +25,37 @@
SELECT COUNT(id) as zrs,(SELECT COUNT(id) FROM curricula_student WHERE curricula_state = '2' AND del_flag = '0') as yxrs FROM curricula_student WHERE curricula_id = #{curriculaId} AND del_flag = '0'
</select>
<select
id=
"selectCurriculaStudentList"
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
WHERE
xk.curricula_id = #{curriculaId} and xk.del_flag = '0'
<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=
"studentName != null and studentName != ''"
>
and xs.student_name like concat('%', #{studentName}, '%')
</if>
</select>
<select
id=
"selectZyZd"
parameterType=
"String"
resultType=
"String"
>
SELECT dict_label FROM `sys_dict_data` WHERE dict_value=#{dictValue} AND dict_type = "specialty"
</select>
</mapper>
\ No newline at end of file
smart-campus/src/main/resources/mapper/curricula/StudentScoreMapper.xml
0 → 100644
View file @
ca7a53bf
<?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.StudentScoreMapper"
>
<resultMap
type=
"SchoolStudentScoreVo"
id=
"SchoolStudentScoreVoResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"studentId"
column=
"student_id"
/>
<result
property=
"curriculaId"
column=
"curricula_id"
/>
<result
property=
"studentName"
column=
"student_name"
/>
<result
property=
"idCard"
column=
"id_card"
/>
<result
property=
"studentNumber"
column=
"student_number"
/>
<result
property=
"classId"
column=
"class_id"
/>
<result
property=
"className"
column=
"class_name"
/>
<result
property=
"examType"
column=
"exam_type"
/>
<result
property=
"totalScore"
column=
"total_score"
/>
<result
property=
"language"
column=
"language"
/>
<result
property=
"math"
column=
"math"
/>
<result
property=
"english"
column=
"english"
/>
<result
property=
"politics"
column=
"politics"
/>
<result
property=
"geography"
column=
"geography"
/>
<result
property=
"history"
column=
"history"
/>
<result
property=
"physics"
column=
"physics"
/>
<result
property=
"chemistry"
column=
"chemistry"
/>
<result
property=
"biology"
column=
"biology"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<select
id=
"selectStudentScoreList"
parameterType=
"SchoolStudentScoreVo"
resultMap=
"SchoolStudentScoreVoResult"
>
SELECT
cj.id,
cj.student_id,
cj.curricula_id,
xs.student_name,
xs.id_card,
xs.school_no as student_number,
cj.class_id,
bj.class_name,
cj.exam_type,
(cj.`language` + cj.math + cj.english + cj.politics + cj.geography + cj.history + cj.physics + cj.chemistry + cj.biology) as total_score,
cj.`language`,
cj.math,
cj.english,
cj.politics,
cj.geography,
cj.history,
cj.physics,
cj.chemistry,
cj.biology,
cj.create_by,
cj.create_time,
cj.update_by,
cj.update_time
FROM
school_student_score cj
LEFT JOIN school_student xs ON cj.student_id = xs.id
LEFT JOIN school_class bj ON cj.class_id = bj.id
WHERE
cj.curricula_id = #{curriculaId}
AND cj.del_flag = '0'
<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=
"classId != null"
>
and cj.class_id = #{classId}
</if>
<if
test=
"className != null and className != ''"
>
and xs.class_name like concat('%', #{className}, '%')
</if>
ORDER BY
student_id,
exam_type ASC
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment