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
c42850d4
Commit
c42850d4
authored
Jan 11, 2018
by
YangZhaoJun1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
全部导出文件
parent
0f531bea
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
150 additions
and
25 deletions
+150
-25
BChapterRepository.java
...org/rcisoft/business/bchapter/dao/BChapterRepository.java
+6
-0
BCodeServiceImpl.java
...rcisoft/business/bcode/service/impl/BCodeServiceImpl.java
+92
-18
BDirectionRepository.java
...rcisoft/business/bdirection/dao/BDirectionRepository.java
+5
-0
BDirection.java
...va/org/rcisoft/business/bdirection/entity/BDirection.java
+3
-0
BRSlStudentRepository.java
...isoft/business/brslstudent/dao/BRSlStudentRepository.java
+5
-2
BSlRepository.java
...main/java/org/rcisoft/business/bsl/dao/BSlRepository.java
+7
-1
SlDetailDTO.java
src/main/java/org/rcisoft/business/bsl/dto/SlDetailDTO.java
+1
-0
BSlServiceImpl.java
...org/rcisoft/business/bsl/service/impl/BSlServiceImpl.java
+24
-3
BStudentDto.java
...ava/org/rcisoft/business/bstudent/entity/BStudentDto.java
+6
-0
application-dev.yml
src/main/resources/application-dev.yml
+1
-1
sl.xls
src/main/resources/excel-template/sl.xls
+0
-0
No files found.
src/main/java/org/rcisoft/business/bchapter/dao/BChapterRepository.java
View file @
c42850d4
...
...
@@ -240,5 +240,11 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"where del_flag = 0 and flag = 1 "
+
"and business_id = #{businessId}</script>"
)
String
queryMdFileByChapterId
(
String
businessId
);
@Select
(
"select CONCAT((SELECT sort from b_chapter where business_id = #{pid}),\n"
+
"'.',"
+
"(SELECT sort from b_chapter where business_id = #{businessId})) AS sort \n"
+
"from b_chapter where business_id = #{businessId}"
)
String
querySortByPidAndId
(
@Param
(
"pid"
)
String
pid
,
@Param
(
"businessId"
)
String
businessId
);
}
src/main/java/org/rcisoft/business/bcode/service/impl/BCodeServiceImpl.java
View file @
c42850d4
...
...
@@ -9,6 +9,10 @@ import org.rcisoft.business.bcode.model.CodeType;
import
org.rcisoft.business.bcode.service.BCodeService
;
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.bstudent.entity.BStudent
;
import
org.rcisoft.business.bstudent.entity.BStudentDto
;
import
org.rcisoft.common.component.Global
;
import
org.rcisoft.core.service.RcRedisService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -16,11 +20,12 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.*
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
/**
* Created by lcy on 18/1/3.
...
...
@@ -42,6 +47,9 @@ public class BCodeServiceImpl implements BCodeService {
@Autowired
private
BRSlStudentRepository
brSlStudentRepository
;
@Autowired
private
BSlRepository
bSlRepository
;
/**
* 读文件
* @param slId
...
...
@@ -124,7 +132,7 @@ public class BCodeServiceImpl implements BCodeService {
+
global
.
getCOURSE_LOCATION
()
+
File
.
separator
+
global
.
getSL_LOCATION
()
+
File
.
separator
+
slId
+
File
.
separator
+
chapterId
+
File
.
separator
//
+ chapterId +File.separator
+
global
.
getCOURSE_PROJECT_LOCATION
()
+
File
.
separator
+
userInfo
;
try
{
...
...
@@ -253,12 +261,14 @@ public class BCodeServiceImpl implements BCodeService {
@Override
public
String
exportFiles
(
String
slId
,
String
studentId
,
String
type
,
String
slCode
)
{
if
(
type
.
equals
(
"1"
)){
//全部导出
String
compressPath
=
""
;
String
SlPath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()
+
File
.
separator
+
global
.
getCOURSE_LOCATION
()
+
File
.
separator
+
global
.
getSL_LOCATION
()
+
File
.
separator
+
slId
+
File
.
separator
;
List
<
String
>
students
=
brSlStudentRepository
.
queryStudentBySlCode
(
slCode
);
//得到开课的编号和名称
BSl
sl
=
bSlRepository
.
queryBSlById
(
slId
);
List
<
BStudentDto
>
students
=
brSlStudentRepository
.
queryStudentBySlCode
(
slCode
);
//查询该课程的所有章节
List
<
BChapter
>
chapterList
=
bChapterRepository
.
queryChapterBySlId
(
slId
);
if
(
chapterList
!=
null
){
...
...
@@ -269,38 +279,102 @@ public class BCodeServiceImpl implements BCodeService {
codeType
=
global
.
getCOURSE_PROJECT_LOCATION
()
+
File
.
separator
;
}
//将要导出的文件放入这个文件夹中
//得到节的排序 如 1.1 2.2
String
sort
=
bChapterRepository
.
querySortByPidAndId
(
bChapter
.
getPid
(),
bChapter
.
getBusinessId
());
//将要导出的文件暂存入这个文件夹中
String
copyPath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()
+
File
.
separator
+
global
.
getTEMP_LOCATION
()
+
File
.
separator
+
"studentCode"
+
File
.
separator
+
slId
+
File
.
separator
+
bChapter
.
getBusinessId
()
+
File
.
separator
;
//+ studentId + File.separator;
for
(
String
student
:
students
){
String
finalPath
=
copyPath
+
student
+
File
.
separator
;
+
sl
.
getCode
()+
sl
.
getLessonName
()
+
File
.
separator
+
sort
+
File
.
separator
;
compressPath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()
+
File
.
separator
+
global
.
getTEMP_LOCATION
()
+
File
.
separator
+
"studentCode"
+
File
.
separator
+
sl
.
getCode
()+
sl
.
getLessonName
();
for
(
BStudentDto
student
:
students
){
String
finalPath
=
copyPath
+
student
.
getStudentCode
()
+
"+"
+
student
.
getStudentName
()
+
File
.
separator
;
File
copyFile
=
new
File
(
finalPath
);
if
(!
copyFile
.
exists
()){
copyFile
.
mkdirs
();
}
String
codePath
=
SlPath
+
bChapter
.
getBusinessId
()
+
File
.
separator
+
codeType
+
student
+
File
.
separator
;
+
codeType
+
student
.
getBusinessId
()
+
File
.
separator
;
File
userFile
=
new
File
(
codePath
);
File
javaFile
[]
=
userFile
.
listFiles
();
for
(
File
simpleFile
:
javaFile
){
String
fileName
=
simpleFile
.
getName
();
File
finalFile
=
new
File
(
codePath
+
fileName
);
//将文件复制出去
try
{
int
bytesum
=
0
;
int
byteread
=
0
;
InputStream
inStream
=
new
FileInputStream
(
simpleFile
.
getPath
());
//读入原文件
FileOutputStream
fs
=
new
FileOutputStream
(
finalPath
+
simpleFile
.
getName
());
byte
[]
buffer
=
new
byte
[
102400
];
int
length
;
while
(
(
byteread
=
inStream
.
read
(
buffer
))
!=
-
1
)
{
bytesum
+=
byteread
;
//字节数 文件大小
fs
.
write
(
buffer
,
0
,
byteread
);
}
inStream
.
close
();
fs
.
close
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"复制时出错"
);
e
.
printStackTrace
();
}
}
}
}
}
//将文件打包
try
{
this
.
compressFiles
(
compressPath
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
null
;
}
private
void
compressFiles
(
String
compressPath
)
throws
IOException
{
if
(!
compressPath
.
equals
(
""
))
{
File
file
=
new
File
(
compressPath
);
String
copyPath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()
+
File
.
separator
+
global
.
getTEMP_LOCATION
()
+
File
.
separator
+
"studentCode"
;
ZipOutputStream
zos
=
new
ZipOutputStream
(
new
FileOutputStream
(
copyPath
+
file
.
getName
()));
if
(
file
.
isDirectory
())
{
File
[]
files
=
file
.
listFiles
();
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
BufferedInputStream
bis
=
new
BufferedInputStream
(
new
FileInputStream
(
files
[
i
]));
zos
.
putNextEntry
(
new
ZipEntry
(
file
.
getName
()
+
file
.
separator
+
files
[
i
].
getName
()));
while
(
true
)
{
byte
[]
b
=
new
byte
[
100
];
int
len
=
bis
.
read
(
b
);
if
(
len
==
-
1
)
break
;
zos
.
write
(
b
,
0
,
len
);
}
bis
.
close
();
}
}
return
null
;
zos
.
close
();
}
}
}
src/main/java/org/rcisoft/business/bdirection/dao/BDirectionRepository.java
View file @
c42850d4
package
org
.
rcisoft
.
business
.
bdirection
.
dao
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.bdirection.entity.BDirection
;
import
org.rcisoft.business.blesson.entity.BLessonDirection
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -37,5 +39,8 @@ public interface BDirectionRepository extends BaseMapper<BDirection> {
@Select
(
"<script>select * from b_direction where del_flag != 1 and flag = 1</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BDirection
>
queryDirectionsList
();
@Insert
(
"insert into b_lesson_direction (business_id,direction_id,sl_id) values (#{businessId},#{directionId},#{slId})"
)
int
insertBLessonDirection
(
BLessonDirection
bDirection
);
}
src/main/java/org/rcisoft/business/bdirection/entity/BDirection.java
View file @
c42850d4
...
...
@@ -24,5 +24,8 @@ public class BDirection extends IdEntity<BDirection> {
private
String
code
;
private
String
name
;
public
BDirection
(
String
code
)
{
this
.
code
=
code
;
}
}
src/main/java/org/rcisoft/business/brslstudent/dao/BRSlStudentRepository.java
View file @
c42850d4
...
...
@@ -2,6 +2,8 @@ package org.rcisoft.business.brslstudent.dao;
import
org.apache.ibatis.annotations.*
;
import
org.rcisoft.business.brslstudent.entity.BRSlStudent
;
import
org.rcisoft.business.bstudent.entity.BStudent
;
import
org.rcisoft.business.bstudent.entity.BStudentDto
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -76,9 +78,10 @@ public interface BRSlStudentRepository extends BaseMapper<BRSlStudent> {
"\tb2.business_id = #{stuId}</script>"
)
int
selectSlNumByStuId
(
String
stuId
);
@Select
(
"<script>SELECT t2.business_id FROM b_r_sl_student t1 "
+
@Select
(
"<script>SELECT t2.business_id as businessId t1.student_code as studentCode t2.name as studentName "
+
"FROM b_r_sl_student t1 "
+
"left join s_user t2 on t1.student_code = t2.login_name "
+
"WHERE t1.sl_code = #{slCode}</script>"
)
List
<
String
>
queryStudentBySlCode
(
String
slCode
);
List
<
BStudentDto
>
queryStudentBySlCode
(
String
slCode
);
}
src/main/java/org/rcisoft/business/bsl/dao/BSlRepository.java
View file @
c42850d4
...
...
@@ -137,7 +137,7 @@ public interface BSlRepository extends BaseMapper<BSl> {
* @return
*/
@Select
(
"<script>SELECT t1.business_id as businessId,t1.credits AS credits,t1.class_hour AS classHour,\n"
+
"t1.audit_status AS auditStatus,t8.`name` AS directionName,t9.`name` AS termName,\n"
+
"t1.audit_status AS auditStatus,t8.`name` AS directionName,t
8.`code` AS directionCode,t
9.`name` AS termName,\n"
+
"t1.`code` AS slCode,t1.sl_notes as slNotes,t1.sl_cover_url as coverUrl,\n"
+
"t6.lesson_name as lessonName,t5.head_pic as teaPic,t5.`name` AS teaName,\n"
+
"t5.t_num as teaSlNum,t5.`code` AS teaCode,\n"
+
...
...
@@ -240,5 +240,11 @@ public interface BSlRepository extends BaseMapper<BSl> {
@Select
(
"select audit_status from b_sl where business_id = #{slId}"
)
String
queryStateById
(
@Param
(
"slId"
)
String
slId
);
@Select
(
"select sl.code le.lesson_name as lessonName from b_sl sl "
+
"left join b_lesson le on sl.lesson_code = le.code "
+
"where sl.business_id = #{slId}"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BSl
queryBSlById
(
String
slId
);
}
src/main/java/org/rcisoft/business/bsl/dto/SlDetailDTO.java
View file @
c42850d4
...
...
@@ -26,6 +26,7 @@ public class SlDetailDTO {
private
String
credits
;
private
String
classHour
;
private
String
directionName
;
private
String
directionCode
;
private
String
termName
;
private
String
auditStatus
;
}
src/main/java/org/rcisoft/business/bsl/service/impl/BSlServiceImpl.java
View file @
c42850d4
...
...
@@ -6,6 +6,8 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import
org.rcisoft.business.bchapter.dao.BChapterRepository
;
import
org.rcisoft.business.bchapter.entity.BChapter
;
import
org.rcisoft.business.bchapter.service.BChapterService
;
import
org.rcisoft.business.bdirection.dao.BDirectionRepository
;
import
org.rcisoft.business.bdirection.entity.BDirection
;
import
org.rcisoft.business.blesson.dao.BLessonRepository
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.blesson.entity.BLessonDirection
;
...
...
@@ -61,6 +63,8 @@ public class BSlServiceImpl implements BSlService {
private
BRSlStudentRepository
brSlStudentRepository
;
@Autowired
private
BChapterService
bChapterService
;
@Autowired
private
BDirectionRepository
bDirectionRepository
;
@Autowired
private
BOpinionRepository
bOpinionRepository
;
...
...
@@ -154,10 +158,11 @@ public class BSlServiceImpl implements BSlService {
ArrayList
<
String
>
lessonCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
teacherCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
termCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
direction
=
new
ArrayList
<
String
>();
List
<
BSl
>
repeatSl
=
new
ArrayList
<>();
Map
map
=
new
HashMap
();
String
[]
headers
=
{
"课序号"
,
"课程编号"
,
"教师工号"
,
"学期编号"
,
"课时"
,
"学分"
};
String
[]
headers
=
{
"课序号"
,
"课程编号"
,
"教师工号"
,
"学期编号"
,
"课时"
,
"学分"
,
"课程方向"
};
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
);
//获取excel数据
if
(
values
.
size
()<
0
){
...
...
@@ -165,7 +170,7 @@ public class BSlServiceImpl implements BSlService {
}
for
(
String
[]
value:
values
){
//将数据封装到entity
if
(
value
.
length
>=
6
)
{
if
(
value
.
length
>=
7
)
{
//1. 检查数据正确性
BSl
bSl
=
null
;
BSl
b
=
new
BSl
(
value
[
0
]);
...
...
@@ -175,6 +180,7 @@ public class BSlServiceImpl implements BSlService {
bSl1
.
setLessonCode
(
value
[
1
]);
bSl1
.
setClassHour
(
value
[
4
]);
bSl1
.
setCredits
(
value
[
5
]);
bSl1
.
setDirectionId
(
value
[
6
]);
if
(
StringUtils
.
isAnyEmpty
(
value
[
0
])
||
value
[
1
]
==
null
||
value
[
1
].
equals
(
""
))
{
continue
;
}
...
...
@@ -198,6 +204,11 @@ public class BSlServiceImpl implements BSlService {
termCode
.
add
(
value
[
3
]);
continue
;
}
if
((
bDirectionRepository
.
selectOne
(
new
BDirection
(
value
[
6
])))
==
null
)
{
if
(!
direction
.
contains
(
value
[
6
]))
direction
.
add
(
value
[
6
]);
continue
;
}
if
(
bSlRepository
.
selectOne
(
bSl1
)
!=
null
)
{
repeatSl
.
add
(
bSl1
);
continue
;
...
...
@@ -208,11 +219,18 @@ public class BSlServiceImpl implements BSlService {
bSl
.
setSlCoverUrl
(
bLessonRepository
.
queryBLessonByCode
(
value
[
1
]).
getDefaultUrl
());
UserUtil
.
setCurrentPersistOperation
(
bSl
);
BLessonDirection
bDirection
=
new
BLessonDirection
();
if
(!
bSls
.
contains
(
bSl
))
{
bSls
.
add
(
bSl
);
}
bDirection
.
setDirectionId
(
bDirectionRepository
.
selectOne
(
new
BDirection
(
value
[
6
])).
getBusinessId
());
bDirection
.
setBusinessId
(
IdGen
.
uuid
());
bDirection
.
setSlId
(
bSl
.
getBusinessId
());
bDirectionRepository
.
insertBLessonDirection
(
bDirection
);
map
.
put
(
bSl
.
getLessonCode
(),
bSl
.
getBusinessId
());
}
}
}
String
result
=
""
;
if
(
bSls
.
size
()>
0
){
...
...
@@ -243,6 +261,9 @@ public class BSlServiceImpl implements BSlService {
if
(
termCode
.
size
()>
0
){
nullResult
.
append
(
"以下学期编号不存在:"
).
append
(
JSON
.
toJSONString
(
termCode
)).
append
(
"。 "
);
}
if
(
termCode
.
size
()>
0
){
nullResult
.
append
(
"以下课程方向编号不存在:"
).
append
(
JSON
.
toJSONString
(
direction
)).
append
(
"。 "
);
}
result
+=
nullResult
;
if
(
bSls
.
size
()<
1
){
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DB_INSERT_ERROR
.
getCode
(),
result
);
...
...
src/main/java/org/rcisoft/business/bstudent/entity/BStudentDto.java
View file @
c42850d4
package
org
.
rcisoft
.
business
.
bstudent
.
entity
;
import
lombok.Data
;
/**
* Created by Administrator on 2018/1/11.
*/
@Data
public
class
BStudentDto
{
private
String
businessId
;
private
String
studentName
;
private
String
StudentCode
;
}
src/main/resources/application-dev.yml
View file @
c42850d4
...
...
@@ -13,7 +13,7 @@ server:
druid
:
url
:
jdbc:mysql://127.0.0.1:3306/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
username
:
root
password
:
cy
password
:
root
initial-size
:
1
min-idle
:
1
max-active
:
20
...
...
src/main/resources/excel-template/sl.xls
View file @
c42850d4
No preview for this file type
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