Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李丛阳
education
Commits
715b68d6
Commit
715b68d6
authored
Apr 27, 2018
by
刘子正
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
学生excel导入 新增导入学生年级
parent
13fe63e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
BStudentRepository.java
...org/rcisoft/business/bstudent/dao/BStudentRepository.java
+6
-2
BStudentServiceImpl.java
...t/business/bstudent/service/impl/BStudentServiceImpl.java
+13
-1
No files found.
src/main/java/org/rcisoft/business/bstudent/dao/BStudentRepository.java
View file @
715b68d6
...
...
@@ -66,9 +66,9 @@ public interface BStudentRepository extends BaseMapper<BStudent> {
List
<
BStudent
>
queryStudentBySlCode
(
@Param
(
"slCode"
)
String
slCode
,
@Param
(
"classCode"
)
String
classCode
);
@Insert
(
"<script>INSERT INTO b_student"
+
"(create_date,update_date,create_by,update_by,remarks,del_flag,flag,business_id,code)VALUES"
+
"(create_date,update_date,create_by,update_by,remarks,del_flag,flag,business_id,code
,grade_code
)VALUES"
+
"<foreach collection=\"list\" item=\"item\" separator=\",\">"
+
"( #{item.createDate},#{item.updateDate},#{item.createBy},#{item.updateBy},#{item.remarks},#{item.delFlag},#{item.flag},#{item.businessId},#{item.code})"
+
"( #{item.createDate},#{item.updateDate},#{item.createBy},#{item.updateBy},#{item.remarks},#{item.delFlag},#{item.flag},#{item.businessId},#{item.code}
,#{item.gradeCode}
)"
+
"</foreach></script>"
)
int
insertList
(
List
<
BStudent
>
bStudents
);
...
...
@@ -164,5 +164,9 @@ public interface BStudentRepository extends BaseMapper<BStudent> {
"and b_student.flag = 1"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BStudent
>
queryStudentsByClassCode
(
String
classCode
);
@Select
(
"select * from b_grade where code = #{gradeCode} and del_flag = 0 and flag = 1"
)
List
<
BStudent
>
checkStudentGrade
(
BStudent
bStudent
);
}
src/main/java/org/rcisoft/business/bstudent/service/impl/BStudentServiceImpl.java
View file @
715b68d6
...
...
@@ -127,7 +127,7 @@ public class BStudentServiceImpl implements BStudentService {
ArrayList
<
SysUser
>
users
=
new
ArrayList
<
SysUser
>();
ArrayList
<
UserRole
>
userRoles
=
new
ArrayList
<
UserRole
>();
String
[]
headers
=
{
"学号"
,
"学生姓名"
,
"性别"
,
"邮箱"
,
"年级"
};
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
,
fals
e
);
//获取excel数据
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
,
tru
e
);
//获取excel数据
if
(
values
.
size
()<=
0
){
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
...
...
@@ -172,6 +172,14 @@ public class BStudentServiceImpl implements BStudentService {
continue
;
}
//判断4:学年是否存在,存在才能录入
BStudent
bs
=
new
BStudent
();
bs
.
setGradeCode
(
value
[
4
]);
if
(
bStudentRepository
.
checkStudentGrade
(
bs
).
size
()
==
0
){
valuesGrade
.
add
(
value
[
4
]);
continue
;
}
//合法:通过了三次判断,证明可建立该用户
valuesOK
.
add
(
value
);
//为合法的用户建立Gitlab账户,并批量存储Student、User和UserRole;
...
...
@@ -204,6 +212,7 @@ public class BStudentServiceImpl implements BStudentService {
//创建完Gitlab账户后,将完整的User信息和UserRole计入users和userRoles中等待插入数据库
BStudent
bStudent
=
new
BStudent
(
value
[
0
]);
bStudent
.
setGradeCode
(
value
[
4
]);
UserUtil
.
setCurrentPersistOperation
(
bStudent
);
if
(!
students
.
contains
(
bStudent
))
{
students
.
add
(
bStudent
);
...
...
@@ -234,6 +243,9 @@ public class BStudentServiceImpl implements BStudentService {
if
(
valuesEmailExist
.
size
()>
0
){
result
+=
"以下邮箱已注册:"
+
JSON
.
toJSONString
(
valuesEmailExist
)+
"。"
;
}
if
(
valuesGrade
.
size
()>
0
){
result
+=
"以下学生的学年信息不存在:"
+
JSON
.
toJSONString
(
valuesGrade
)+
"。"
;
}
if
(
valuesOK
.
size
()<
1
){
...
...
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