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
811b18e9
Commit
811b18e9
authored
Aug 07, 2023
by
baochunxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#G:公众号选课后端接口上传
parent
8db017d6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
430 additions
and
199 deletions
+430
-199
ruoyi-admin/src/main/resources/application.yml
+6
-6
smart-campus/src/main/java/yangtz/cs/liu/campus/service/curricula/IStudentScoreService.java
+9
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/curricula/StudentScoreServiceImpl.java
+342
-190
smart-campus/src/main/java/yangtz/cs/liu/campus/vo/student/SchoolStudentScoreVo.java
+3
-1
smart-campus/src/main/java/yangtz/cs/liu/wechat/controller/courseSelection/WxCouresSelection.java
+66
-0
smart-campus/src/main/resources/mapper/curricula/StudentScoreMapper.xml
+4
-2
No files found.
ruoyi-admin/src/main/resources/application.yml
View file @
811b18e9
...
@@ -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
:
...
...
smart-campus/src/main/java/yangtz/cs/liu/campus/service/curricula/IStudentScoreService.java
View file @
811b18e9
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
);
}
}
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/curricula/StudentScoreServiceImpl.java
View file @
811b18e9
...
@@ -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,349 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, Sch
...
@@ -45,19 +54,349 @@ 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
=
section_type
.
split
(
"\\+"
);
//获取班级成绩
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 +658,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreMapper, Sch
...
@@ -319,194 +658,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
);
}
}
}
smart-campus/src/main/java/yangtz/cs/liu/campus/vo/student/SchoolStudentScoreVo.java
View file @
811b18e9
...
@@ -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
;
...
...
smart-campus/src/main/java/yangtz/cs/liu/wechat/controller/courseSelection/WxCouresSelection.java
0 → 100644
View file @
811b18e9
package
yangtz
.
cs
.
liu
.
wechat
.
controller
.
courseSelection
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
java.util.List
;
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.CurriculaStudent
;
import
yangtz.cs.liu.campus.service.curricula.ICurriculaStudentService
;
import
yangtz.cs.liu.campus.service.curricula.IStudentScoreService
;
import
yangtz.cs.liu.campus.vo.student.SchoolStudentScoreVo
;
/**
* 公众号,选课
*/
@RestController
@RequestMapping
(
"/wx/course"
)
public
class
WxCouresSelection
{
@Autowired
IStudentScoreService
iStudentScoreService
;
@Autowired
ICurriculaStudentService
iCurriculaStudentService
;
/**
* 学生成绩查询
*/
@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
.
save
(
curriculaStudent
);
return
AjaxResult
.
success
(
"选课成功"
);
}
catch
(
Exception
e
){
return
AjaxResult
.
error
(
"选课失败"
);
}
}
}
smart-campus/src/main/resources/mapper/curricula/StudentScoreMapper.xml
View file @
811b18e9
...
@@ -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>
...
...
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