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
944c288c
Commit
944c288c
authored
May 28, 2018
by
YangZhaoJun1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改文件复制方法,解决bug
parent
92f1bdc7
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
101 additions
and
30 deletions
+101
-30
BArrangeServiceImpl.java
...t/business/barrange/service/impl/BArrangeServiceImpl.java
+22
-1
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+13
-7
BClassRepository.java
...ava/org/rcisoft/business/bclass/dao/BClassRepository.java
+4
-4
BRClassStudentController.java
...s/brclassstudent/controller/BRClassStudentController.java
+6
-3
BRClassStudentRepository.java
...business/brclassstudent/dao/BRClassStudentRepository.java
+8
-0
BRClassStudentService.java
...usiness/brclassstudent/service/BRClassStudentService.java
+1
-1
BRClassStudentServiceImpl.java
...rclassstudent/service/impl/BRClassStudentServiceImpl.java
+2
-3
BRooms.java
src/main/java/org/rcisoft/business/brooms/entity/BRooms.java
+1
-1
BStudentRepository.java
...org/rcisoft/business/bstudent/dao/BStudentRepository.java
+25
-8
BStudent.java
...n/java/org/rcisoft/business/bstudent/entity/BStudent.java
+3
-0
BStudentServiceImpl.java
...t/business/bstudent/service/impl/BStudentServiceImpl.java
+11
-0
BTeacherServiceImpl.java
...t/business/bteacher/service/impl/BTeacherServiceImpl.java
+2
-1
ResultServiceEnums.java
...main/java/org/rcisoft/core/result/ResultServiceEnums.java
+3
-1
No files found.
src/main/java/org/rcisoft/business/barrange/service/impl/BArrangeServiceImpl.java
View file @
944c288c
...
...
@@ -23,11 +23,16 @@ import org.rcisoft.business.blesson.entity.BLesson;
import
org.rcisoft.business.blesson.entity.BLessonDirection
;
import
org.rcisoft.business.brooms.dao.BRoomsRepository
;
import
org.rcisoft.business.brooms.entity.BRooms
;
import
org.rcisoft.business.brslstudent.dao.BRSlStudentRepository
;
import
org.rcisoft.business.brslstudent.entity.BRSlStudent
;
import
org.rcisoft.business.bsl.dao.BSlRepository
;
import
org.rcisoft.business.bsl.entity.BSl
;
import
org.rcisoft.business.bslschedule.dao.BSlScheduleRepository
;
import
org.rcisoft.business.bslschedule.entity.BSlSchedule
;
import
org.rcisoft.business.bslschedule.util.FindTime
;
import
org.rcisoft.business.bstudent.dao.BStudentRepository
;
import
org.rcisoft.business.bstudent.entity.BStudent
;
import
org.rcisoft.business.bstudent.service.BStudentService
;
import
org.rcisoft.business.bteacher.dao.BTeacherRepository
;
import
org.rcisoft.business.bteacher.entity.BTeacher
;
import
org.rcisoft.business.bterm.dao.BTermRepository
;
...
...
@@ -96,11 +101,14 @@ public class BArrangeServiceImpl implements BArrangeService {
private
SysUserMapper
sysUserMapper
;
@Autowired
private
B
ClassRepository
bClass
Repository
;
private
B
StudentRepository
bStudent
Repository
;
@Autowired
private
BTeacherRepository
bTeacherRepository
;
@Autowired
private
BRSlStudentRepository
brSlStudentRepository
;
@Autowired
private
Global
global
;
...
...
@@ -648,6 +656,7 @@ public class BArrangeServiceImpl implements BArrangeService {
}
List
<
BSl
>
sls
=
new
ArrayList
<>();
List
<
BLessonDirection
>
bLessonDirections
=
new
ArrayList
<>();
List
<
BRSlStudent
>
slStudents
=
new
ArrayList
<>();
int
maxSlCode
=
bTermRepository
.
queryMaxSlCodeByTermCode
(
termCode
);
for
(
String
subAgencyId
:
subAgencyIds
){
//查询要开的课
...
...
@@ -687,6 +696,17 @@ public class BArrangeServiceImpl implements BArrangeService {
bLessonDirection
.
setDirectionId
(
bLesson
.
getDirectionId
());
bLessonDirections
.
add
(
bLessonDirection
);
//构造学生选课信息
List
<
BStudent
>
students
=
bStudentRepository
.
queryStudentByEduClassCode
(
schedule
.
getClassCode
());
for
(
BStudent
student
:
students
){
BRSlStudent
brSlStudent
=
new
BRSlStudent
();
brSlStudent
.
setBusinessId
(
IdGen
.
uuid
());
brSlStudent
.
setSlCode
(
sl
.
getCode
());
brSlStudent
.
setStudentCode
(
student
.
getCode
());
slStudents
.
add
(
brSlStudent
);
}
//复制章节及文件目录
chapterService
.
addBslFormLesson
(
null
,
sl
.
getLessonCode
(),
sl
.
getBusinessId
());
}
...
...
@@ -697,6 +717,7 @@ public class BArrangeServiceImpl implements BArrangeService {
bSubtaskRepository
.
updateByPrimaryKeySelective
(
bSubtask
);
//将子任务状态置为已开课
bTermRepository
.
MaxSlCodeByTermCode
(
termCode
,
String
.
valueOf
(
maxSlCode
));
//将该学期的开课序号存入
bDirectionRepository
.
insertList
(
bLessonDirections
);
//批量插入课程方向
brSlStudentRepository
.
insertList
(
slStudents
);
//批量插入学生选课关系
//批量插入
result
=
bSlRepository
.
insertList
(
sls
);
...
...
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
944c288c
...
...
@@ -34,6 +34,9 @@ import org.springframework.transaction.annotation.Propagation;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.*
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -293,12 +296,12 @@ public class BChapterServiceImpl implements BChapterService {
//复制章节的所有文件
try
{
//copyFileToSl(oldPath,newPath,bLessonId,slId
);
File
oldFile
=
new
File
(
oldPath
);
copyFileToSl
(
oldPath
,
newPath
);
/*
File oldFile = new File(oldPath);
File newFile = new File(newPath);
FileUtils
.
copyDirectory
(
oldFile
,
newFile
,
true
);
FileUtils.copyDirectory(oldFile,newFile,true);
*/
}
catch
(
IOException
e
)
{
e
.
printStackTrace
(
);
throw
new
ServiceException
(
ResultServiceEnums
.
COPY_FILES_ERROR
);
}
//数据库操作
...
...
@@ -352,7 +355,7 @@ public class BChapterServiceImpl implements BChapterService {
* @param oldPath
* @param newPath
*/
private
void
copyFileToSl
(
String
oldPath
,
String
newPath
,
String
bLessonId
,
String
slId
)
throws
IOException
{
private
void
copyFileToSl
(
String
oldPath
,
String
newPath
)
throws
IOException
{
File
oldFile
=
new
File
(
oldPath
);
File
[]
fs
=
oldFile
.
listFiles
();
...
...
@@ -362,9 +365,12 @@ public class BChapterServiceImpl implements BChapterService {
}
for
(
File
f
:
fs
)
{
if
(
f
.
isFile
()){
fileCopy
(
f
.
getPath
(),
newPath
+
File
.
separator
+
f
.
getName
());
//调用文件拷贝的方法
Path
link
=
Paths
.
get
(
newPath
+
File
.
separator
+
f
.
getName
());
Path
existing
=
Paths
.
get
(
f
.
getPath
());
Files
.
createLink
(
link
,
existing
);
//fileCopy(f.getPath(),newPath+File.separator+f.getName()); //调用文件拷贝的方法
}
else
if
(
f
.
isDirectory
()){
copyFileToSl
(
f
.
getPath
(),
newPath
+
File
.
separator
+
f
.
getName
()
,
bLessonId
,
slId
);
copyFileToSl
(
f
.
getPath
(),
newPath
+
File
.
separator
+
f
.
getName
());
}
}
}
...
...
src/main/java/org/rcisoft/business/bclass/dao/BClassRepository.java
View file @
944c288c
package
org
.
rcisoft
.
business
.
bclass
.
dao
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.annotations.*
;
import
org.rcisoft.business.bclass.entity.BClass
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -67,5 +64,8 @@ public interface BClassRepository extends BaseMapper<BClass> {
"class_name = #{className} and business_id != #{businessId}</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BClass
>
selectClassesByName
(
BClass
bClass
);
@Update
(
"UPDATE b_class SET student_num = (student_num-1) WHERE FIND_IN_SET(`code`,#{classCodes})"
)
int
updateStudentNumByClassCodes
(
String
classCodes
);
}
src/main/java/org/rcisoft/business/brclassstudent/controller/BRClassStudentController.java
View file @
944c288c
...
...
@@ -56,11 +56,14 @@ public class BRClassStudentController extends PaginationController<BRClassStuden
}
@ApiOperation
(
value
=
"excel导入"
,
notes
=
"excel导入"
)
@ApiImplicitParam
(
name
=
"importFile"
,
value
=
"excel文件"
,
required
=
true
,
dataType
=
"MultipartFile"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"importFile"
,
value
=
"excel文件"
,
required
=
true
,
dataType
=
"MultipartFile"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"0行政班,1企业班"
,
required
=
true
,
dataType
=
"varchar"
)
})
@PreAuthorize
(
"hasRole('ROLE_1001')"
)
@PostMapping
(
value
=
"excelImport"
)
public
Result
excelImport
(
MultipartFile
importFile
)
throws
Exception
{
PersistModel
data
=
bRClassStudentService
.
excelImport
(
MultipartFile2HSSFWorkbookConverter
.
convert
(
importFile
));
public
Result
excelImport
(
MultipartFile
importFile
,
String
type
)
throws
Exception
{
PersistModel
data
=
bRClassStudentService
.
excelImport
(
MultipartFile2HSSFWorkbookConverter
.
convert
(
importFile
)
,
type
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
...
...
src/main/java/org/rcisoft/business/brclassstudent/dao/BRClassStudentRepository.java
View file @
944c288c
...
...
@@ -68,5 +68,13 @@ public interface BRClassStudentRepository extends BaseMapper<BRClassStudent> {
*/
@Delete
(
"delete from b_r_class_student where student_code = #{stuCode}"
)
int
deleteCSByStuId
(
String
stuCode
);
@Select
(
"<script>SELECT bcs.* FROM b_r_class_student bcs "
+
"LEFT JOIN b_class bc on bc.`code`=bcs.class_code "
+
"LEFT JOIN b_student bs on bs.`code`=bcs.student_code "
+
"WHERE bcs.student_code=#{studentCode} "
+
"AND bc.type=#{type}</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BRClassStudent
queryClassStudent
(
String
studentCode
,
String
type
);
}
src/main/java/org/rcisoft/business/brclassstudent/service/BRClassStudentService.java
View file @
944c288c
...
...
@@ -47,7 +47,7 @@ public interface BRClassStudentService{
* @param hwb
* @return
*/
PersistModel
excelImport
(
HSSFWorkbook
hwb
)
throws
IOException
;
PersistModel
excelImport
(
HSSFWorkbook
hwb
,
String
type
)
throws
IOException
;
/**
* 物理删除
...
...
src/main/java/org/rcisoft/business/brclassstudent/service/impl/BRClassStudentServiceImpl.java
View file @
944c288c
...
...
@@ -80,7 +80,7 @@ public class BRClassStudentServiceImpl implements BRClassStudentService {
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
PersistModel
excelImport
(
HSSFWorkbook
hwb
)
throws
IOException
{
public
PersistModel
excelImport
(
HSSFWorkbook
hwb
,
String
type
)
throws
IOException
{
ArrayList
<
BRClassStudent
>
brClassStudents
=
new
ArrayList
<
BRClassStudent
>();
ArrayList
<
String
>
studentCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
classCode
=
new
ArrayList
<
String
>();
...
...
@@ -118,9 +118,8 @@ public class BRClassStudentServiceImpl implements BRClassStudentService {
//1.3 检查班级学生是否存在
BRClassStudent
classStudent
=
new
BRClassStudent
();
//classStudent.setClassCode(value[0]);
classStudent
.
setStudentCode
(
value
[
1
]);
if
((
bRClassStudentRepository
.
selectOne
(
classStudent
))!=
null
)
{
if
((
bRClassStudentRepository
.
queryClassStudent
(
value
[
1
],
type
))!=
null
)
{
repeatCode
.
add
(
value
[
1
]);
continue
;
}
...
...
src/main/java/org/rcisoft/business/brooms/entity/BRooms.java
View file @
944c288c
...
...
@@ -40,7 +40,7 @@ public class BRooms extends IdEntity<BRooms> {
private
String
building
;
/*教室号*/
@Length
(
min
=
1
,
max
=
1
0
,
message
=
"长度最短为1,最长为10
"
)
@Length
(
min
=
1
,
max
=
1
5
,
message
=
"长度最短为1,最长为15
"
)
@NotBlank
private
String
classroomNo
;
...
...
src/main/java/org/rcisoft/business/bstudent/dao/BStudentRepository.java
View file @
944c288c
...
...
@@ -112,7 +112,8 @@ public interface BStudentRepository extends BaseMapper<BStudent> {
String
queryStudentByUserId
(
String
userId
);
@Select
(
"<script>SELECT t3.business_id as businessId, t3.code,t4.`name`,t6.class_name as className,\n"
+
@Select
(
"<script>SELECT t3.business_id as businessId, t3.code,t4.`name`,t6.class_name as className,"
+
"IFNULL(bsc.is_complete,0) as submit, "
+
"(CONCAT((SELECT COUNT(*) from b_r_student_chapter "
+
"where student_id = t3.business_id and sl_id = #{slId} and is_complete = '1'),"
+
"'/',"
+
...
...
@@ -120,19 +121,21 @@ public interface BStudentRepository extends BaseMapper<BStudent> {
") AS finishNum "
+
"FROM\n"
+
"b_r_sl_student t2\n"
+
"LEFT JOIN b_student t3 ON t2.student_code = t3.`code`
\n
"
+
"LEFT JOIN s_user t4 ON t3.`code` = t4.login_name
\n
"
+
"LEFT JOIN b_student t3 ON t2.student_code = t3.`code`
"
+
"LEFT JOIN s_user t4 ON t3.`code` = t4.login_name
"
+
"LEFT JOIN b_r_class_student t5 on t5.student_code = t3.code "
+
"LEFT JOIN b_class t6 on t6.code = t5.class_code "
+
"WHERE\n"
+
"LEFT JOIN b_r_student_chapter bsc on bsc.student_id = t3.business_id "
+
"WHERE "
+
"t2.sl_code = #{slCode} "
+
" and t3.del_flag != 1 and t3.flag = 1"
+
"<if test=\"classCode!=null and classCode != ''\">
\n
"
+
" AND t6.code = #{classCode}
\n
"
+
"<if test=\"classCode!=null and classCode != ''\">
"
+
" AND t6.code = #{classCode}
"
+
"</if>"
+
"<if test=\"keyWord!=null and keyWord != ''\">
\n
"
+
" AND (t3.`code` like CONCAT('%',#{keyWord},'%') or t4.`name` like CONCAT('%',#{keyWord},'%'))
\n
"
+
"<if test=\"keyWord!=null and keyWord != ''\">
"
+
" AND (t3.`code` like CONCAT('%',#{keyWord},'%') or t4.`name` like CONCAT('%',#{keyWord},'%'))
"
+
"</if>"
+
"GROUP BY t3.`code` "
+
"order by className asc,code asc</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BStudent
>
queryStudentInSl
(
@Param
(
"slCode"
)
String
slCode
,
...
...
@@ -171,5 +174,19 @@ public interface BStudentRepository extends BaseMapper<BStudent> {
@Select
(
"select * from b_grade where code = #{gradeCode} and del_flag = 0 and flag = 1"
)
List
<
BClass
>
checkStudentGrade
(
BStudent
bStudent
);
@Select
(
"SELECT bs.* FROM b_student bs "
+
"LEFT JOIN b_r_class_student bcs on bcs.student_code = bs.`code` "
+
"LEFT JOIN b_class bc on bc.`code` = bcs.class_code "
+
"WHERE FIND_IN_SET(bcs.class_code,( "
+
"SELECT bec.classes_id FROM b_edu_class bec WHERE bec.`code` = 'D0001')) "
+
"GROUP BY bs.`code` "
+
"ORDER BY bs.`code`"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BStudent
>
queryStudentByEduClassCode
(
String
classCode
);
@Select
(
"SELECT bcs.class_code from b_student bs \n"
+
"LEFT JOIN b_r_class_student bcs on bcs.student_code = bs.`code`\n"
+
"WHERE bs.business_id = #{id}"
)
List
<
String
>
queryClassCodesById
(
String
id
);
}
src/main/java/org/rcisoft/business/bstudent/entity/BStudent.java
View file @
944c288c
...
...
@@ -90,5 +90,8 @@ public class BStudent extends IdEntity<BStudent> {
@Transient
private
String
condition
;
//模糊查询条件
@Transient
private
String
submit
;
}
src/main/java/org/rcisoft/business/bstudent/service/impl/BStudentServiceImpl.java
View file @
944c288c
...
...
@@ -3,6 +3,7 @@ package org.rcisoft.business.bstudent.service.impl;
import
com.alibaba.druid.util.StringUtils
;
import
com.alibaba.fastjson.JSON
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.rcisoft.business.bclass.dao.BClassRepository
;
import
org.rcisoft.business.brclassstudent.dao.BRClassStudentRepository
;
import
org.rcisoft.business.brclassstudent.entity.BRClassStudent
;
import
org.rcisoft.business.brslstudent.dao.BRSlStudentRepository
;
...
...
@@ -61,6 +62,8 @@ public class BStudentServiceImpl implements BStudentService {
private
BRSlStudentRepository
brSlStudentRepository
;
@Autowired
private
PasswordEncoder
passwordEncoder
;
@Autowired
private
BClassRepository
bClassRepository
;
@Override
public
BStudent
selectOne
(
String
businessId
)
{
...
...
@@ -161,6 +164,7 @@ public class BStudentServiceImpl implements BStudentService {
continue
;
}
value
[
1
].
trim
();
if
(
value
[
1
].
length
()<
1
||
value
[
1
].
length
()>
15
){
//该用户不满足要求,记入valuesShort中
nameTooLong
.
add
(
value
[
0
]);
...
...
@@ -298,6 +302,13 @@ public class BStudentServiceImpl implements BStudentService {
BStudent
student
=
bStudentRepository
.
selectOne
(
bStudent
);
sysUserMapper
.
deleteByCode
(
student
.
getCode
());
List
<
String
>
classCodes
=
bStudentRepository
.
queryClassCodesById
(
id
);
String
clCode
=
""
;
for
(
String
classCode
:
classCodes
){
clCode
+=
classCode
+
","
;
}
bClassRepository
.
updateStudentNumByClassCodes
(
clCode
);
//更新班级人数-1
int
line
=
bStudentRepository
.
deleteByPrimaryKey
(
bStudent
);
brClassStudentRepository
.
deleteCSByStuId
(
student
.
getCode
());
...
...
src/main/java/org/rcisoft/business/bteacher/service/impl/BTeacherServiceImpl.java
View file @
944c288c
...
...
@@ -120,6 +120,7 @@ public class BTeacherServiceImpl implements BTeacherService {
continue
;
}
value
[
1
].
trim
();
if
(
value
[
1
].
length
()<
1
||
value
[
1
].
length
()>
15
){
//该用户不满足要求,记入valuesShort中
nameTooLong
.
add
(
value
[
0
]);
...
...
@@ -182,7 +183,7 @@ public class BTeacherServiceImpl implements BTeacherService {
user.setGitLabId(accountDTO.getId());
user.setGitLabUsername(accountDTO.getUsername());
user.setGitLabImpressionToken(accountDTO.getImpersonationToken());*/
user
.
setHeadPic
(
global
.
getDEFAULT_
STUDENT
_LOCATION
());
user
.
setHeadPic
(
global
.
getDEFAULT_
TEACHER
_LOCATION
());
//4.添加用户权限
UserRole
userRole
=
new
UserRole
(
user
.
getBusinessId
(),
"bbbbbbbb"
);
...
...
src/main/java/org/rcisoft/core/result/ResultServiceEnums.java
View file @
944c288c
...
...
@@ -198,7 +198,9 @@ public enum ResultServiceEnums {
ROOM_BUILDINGNO_TOO_LONG
(
105
,
"教室号长度过长"
),
ROOM_SEAT_TOO_MANY
(
106
,
"人数过多"
)
ROOM_SEAT_TOO_MANY
(
106
,
"人数过多"
),
COPY_FILES_ERROR
(
107
,
"复制课程相关资料失败"
)
;
private
Integer
code
;
...
...
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