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
ab5397c2
Commit
ab5397c2
authored
Apr 25, 2018
by
YangZhaoJun1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导入排课
parent
1f94dd34
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
245 additions
and
25 deletions
+245
-25
BArrangeController.java
...soft/business/barrange/controller/BArrangeController.java
+15
-0
BArrangeRepository.java
...org/rcisoft/business/barrange/dao/BArrangeRepository.java
+4
-0
BArrange.java
...n/java/org/rcisoft/business/barrange/entity/BArrange.java
+1
-2
ScheduleDto.java
...ava/org/rcisoft/business/barrange/entity/ScheduleDto.java
+44
-0
BArrangeService.java
...rg/rcisoft/business/barrange/service/BArrangeService.java
+2
-2
BArrangeServiceImpl.java
...t/business/barrange/service/impl/BArrangeServiceImpl.java
+144
-0
BClass.java
src/main/java/org/rcisoft/business/bclass/entity/BClass.java
+0
-1
BClassServiceImpl.java
...isoft/business/bclass/service/impl/BClassServiceImpl.java
+1
-1
BEduClassController.java
...ft/business/beduclass/controller/BEduClassController.java
+2
-2
BEduClass.java
...java/org/rcisoft/business/beduclass/entity/BEduClass.java
+1
-1
BEduClassServiceImpl.java
...business/beduclass/service/impl/BEduClassServiceImpl.java
+2
-2
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+1
-1
BRClassStudentServiceImpl.java
...rclassstudent/service/impl/BRClassStudentServiceImpl.java
+1
-1
BRooms.java
src/main/java/org/rcisoft/business/brooms/entity/BRooms.java
+5
-1
BRSlStudentServiceImpl.java
...ness/brslstudent/service/impl/BRSlStudentServiceImpl.java
+1
-1
BSlServiceImpl.java
...org/rcisoft/business/bsl/service/impl/BSlServiceImpl.java
+1
-1
BStudentServiceImpl.java
...t/business/bstudent/service/impl/BStudentServiceImpl.java
+1
-1
BTeacherServiceImpl.java
...t/business/bteacher/service/impl/BTeacherServiceImpl.java
+1
-1
ExcelUtil.java
src/main/java/org/rcisoft/core/util/ExcelUtil.java
+17
-6
BEduClassMapper.xml
...rces/mapper/business/beduclass/mapper/BEduClassMapper.xml
+1
-1
No files found.
src/main/java/org/rcisoft/business/barrange/controller/BArrangeController.java
View file @
ab5397c2
...
@@ -5,6 +5,8 @@ package org.rcisoft.business.barrange.controller;
...
@@ -5,6 +5,8 @@ package org.rcisoft.business.barrange.controller;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.rcisoft.core.converter.MultipartFile2HSSFWorkbookConverter
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -22,6 +24,7 @@ import javax.validation.Valid;
...
@@ -22,6 +24,7 @@ import javax.validation.Valid;
import
org.rcisoft.business.barrange.entity.BArrange
;
import
org.rcisoft.business.barrange.entity.BArrange
;
import
org.rcisoft.business.barrange.service.BArrangeService
;
import
org.rcisoft.business.barrange.service.BArrangeService
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
import
java.util.List
;
...
@@ -57,4 +60,16 @@ public class BArrangeController extends PaginationController<BArrange> {
...
@@ -57,4 +60,16 @@ public class BArrangeController extends PaginationController<BArrange> {
MessageConstant
.
MESSAGE_ALERT_ERROR
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
bArrangeServiceImpl
.
findAll
());
bArrangeServiceImpl
.
findAll
());
}
}
@ApiOperation
(
value
=
"excel导入"
,
notes
=
"excel导入排课信息"
)
@ApiImplicitParam
(
name
=
"importFile"
,
value
=
"excel文件"
,
required
=
true
,
dataType
=
"MultipartFile"
)
@PreAuthorize
(
"hasRole('ROLE_1001')"
)
@PostMapping
(
value
=
"excelImport"
)
public
Result
excelImport
(
MultipartFile
importFile
)
throws
Exception
{
PersistModel
data
=
bArrangeServiceImpl
.
importExcel
(
MultipartFile2HSSFWorkbookConverter
.
convert
(
importFile
),
getToken
());
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
data
.
getInfluenceReason
());
}
}
}
src/main/java/org/rcisoft/business/barrange/dao/BArrangeRepository.java
View file @
ab5397c2
package
org
.
rcisoft
.
business
.
barrange
.
dao
;
package
org
.
rcisoft
.
business
.
barrange
.
dao
;
import
org.rcisoft.business.barrange.entity.ScheduleDto
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.rcisoft.business.barrange.entity.BArrange
;
import
org.rcisoft.business.barrange.entity.BArrange
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.ResultMap
;
...
@@ -7,6 +8,7 @@ import org.apache.ibatis.annotations.Select;
...
@@ -7,6 +8,7 @@ import org.apache.ibatis.annotations.Select;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -39,5 +41,7 @@ public interface BArrangeRepository extends BaseMapper<BArrange> {
...
@@ -39,5 +41,7 @@ public interface BArrangeRepository extends BaseMapper<BArrange> {
+
"</script>"
)
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap4"
)
@ResultMap
(
value
=
"BaseResultMap4"
)
List
<
BArrange
>
queryBArranges2
(
String
gradeCode
);
List
<
BArrange
>
queryBArranges2
(
String
gradeCode
);
int
insertList
(
ArrayList
<
ScheduleDto
>
scheduleDtos
);
}
}
src/main/java/org/rcisoft/business/barrange/entity/BArrange.java
View file @
ab5397c2
...
@@ -20,8 +20,7 @@ import java.util.List;
...
@@ -20,8 +20,7 @@ import java.util.List;
@Table
(
name
=
"b_arrange"
)
@Table
(
name
=
"b_arrange"
)
public
class
BArrange
extends
IdEntity
<
BArrange
>
{
public
class
BArrange
extends
IdEntity
<
BArrange
>
{
private
static
final
long
serialVersionUID
=
-
5524520301999990921L
;
private
String
termCode
;
private
String
termCode
;
private
String
desc
;
private
String
desc
;
...
...
src/main/java/org/rcisoft/business/barrange/entity/ScheduleDto.java
0 → 100644
View file @
ab5397c2
package
org
.
rcisoft
.
business
.
barrange
.
entity
;
import
lombok.Data
;
/**
* Created by Administrator on 2018/4/23.
*/
@Data
public
class
ScheduleDto
{
private
String
lessonCode
;
private
String
lessonName
;
private
String
teacherCode
;
private
String
teacherName
;
private
String
classCode
;
private
String
className
;
private
String
week
;
private
String
classHour
;
private
String
monday
;
private
String
tuesday
;
private
String
wednesday
;
private
String
thursday
;
private
String
friday
;
private
String
saturday
;
private
String
roomCode
;
private
String
roomName
;
}
src/main/java/org/rcisoft/business/barrange/service/BArrangeService.java
View file @
ab5397c2
package
org
.
rcisoft
.
business
.
barrange
.
service
;
package
org
.
rcisoft
.
business
.
barrange
.
service
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.rcisoft.business.barrange.entity.BArrange
;
import
org.rcisoft.business.barrange.entity.BArrange
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.aop.PageUtil
;
...
@@ -27,6 +28,5 @@ public interface BArrangeService {
...
@@ -27,6 +28,5 @@ public interface BArrangeService {
List
<
BArrange
>
findAll
();
List
<
BArrange
>
findAll
();
PersistModel
importExcel
(
HSSFWorkbook
convert
,
String
token
);
}
}
src/main/java/org/rcisoft/business/barrange/service/impl/BArrangeServiceImpl.java
View file @
ab5397c2
package
org
.
rcisoft
.
business
.
barrange
.
service
.
impl
;
package
org
.
rcisoft
.
business
.
barrange
.
service
.
impl
;
import
com.alibaba.druid.util.StringUtils
;
import
com.alibaba.fastjson.JSON
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.rcisoft.business.barrange.entity.ScheduleDto
;
import
org.rcisoft.business.bclass.dao.BClassRepository
;
import
org.rcisoft.business.bclass.entity.BClass
;
import
org.rcisoft.business.blesson.dao.BLessonRepository
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.brooms.dao.BRoomsRepository
;
import
org.rcisoft.business.brooms.entity.BRooms
;
import
org.rcisoft.core.exception.ServiceException
;
import
org.rcisoft.core.result.ResultServiceEnums
;
import
org.rcisoft.core.util.ExcelUtil
;
import
org.rcisoft.core.util.RegexValidateUtil
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.model.PersistModel
;
...
@@ -8,6 +22,8 @@ import org.rcisoft.business.barrange.entity.BArrange;
...
@@ -8,6 +22,8 @@ import org.rcisoft.business.barrange.entity.BArrange;
import
org.rcisoft.business.barrange.service.BArrangeService
;
import
org.rcisoft.business.barrange.service.BArrangeService
;
import
org.rcisoft.sys.user.dao.SysUserMapper
;
import
org.rcisoft.sys.user.entity.SysUser
;
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.Isolation
;
import
org.springframework.transaction.annotation.Isolation
;
...
@@ -15,8 +31,10 @@ import org.springframework.transaction.annotation.Propagation;
...
@@ -15,8 +31,10 @@ import org.springframework.transaction.annotation.Propagation;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
sun.reflect.generics.repository.ClassRepository
;
/**
/**
* Created by on 2018-4-19 10:28:59.
* Created by on 2018-4-19 10:28:59.
...
@@ -29,6 +47,18 @@ public class BArrangeServiceImpl implements BArrangeService {
...
@@ -29,6 +47,18 @@ public class BArrangeServiceImpl implements BArrangeService {
@Autowired
@Autowired
private
BArrangeRepository
bArrangeRepository
;
private
BArrangeRepository
bArrangeRepository
;
@Autowired
private
BLessonRepository
bLessonRepository
;
@Autowired
private
SysUserMapper
sysUserMapper
;
@Autowired
private
BClassRepository
bClassRepository
;
@Autowired
private
BRoomsRepository
bRoomsRepository
;
/**
/**
* 保存 bArrange
* 保存 bArrange
...
@@ -58,4 +88,118 @@ public class BArrangeServiceImpl implements BArrangeService {
...
@@ -58,4 +88,118 @@ public class BArrangeServiceImpl implements BArrangeService {
return
list
;
return
list
;
}
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
public
PersistModel
importExcel
(
HSSFWorkbook
hwb
,
String
token
)
{
ArrayList
<
ScheduleDto
>
scheduleDtos
=
new
ArrayList
<
ScheduleDto
>();
String
[]
headers
=
{
"课程编号"
,
"教师编号"
,
"班级编号"
,
"教室编号"
,
"周次"
,
"周学时"
,
"周一"
,
"周二"
,
"周三"
,
"周四"
,
"周五"
,
"周六"
};
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
,
true
);
//获取excel数据
if
(
values
.
size
()<=
0
){
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
}
List
<
String
>
lessonCodes
=
new
ArrayList
<>();
List
<
String
>
teacherCodes
=
new
ArrayList
<>();
List
<
String
>
classCodes
=
new
ArrayList
<>();
List
<
String
>
roomCodes
=
new
ArrayList
<>();
String
[]
wholeValue
=
new
String
[
11
];
for
(
String
[]
value
:
values
)
{
ScheduleDto
scheduleDto
=
new
ScheduleDto
();
//每一次遇到完整数据时将完整数据存放起来
if
(!
value
[
0
].
equals
(
""
)&&!
value
[
1
].
equals
(
""
)&&!
value
[
2
].
equals
(
""
)&&!
value
[
3
].
equals
(
""
)){
wholeValue
=
value
;
}
//判断1:根据课程编号查询是否有此门课程;
if
(
value
[
0
].
equals
(
""
)){
value
[
0
]
=
wholeValue
[
0
];
}
if
(
bLessonRepository
.
selectOne
(
new
BLesson
(
value
[
0
]))==
null
){
lessonCodes
.
add
(
value
[
0
]);
continue
;
}
//判断2:根据教师编号查询是否有此教师;
if
(
value
[
1
].
equals
(
""
)){
value
[
1
]
=
wholeValue
[
1
];
}
SysUser
user1
=
new
SysUser
();
user1
.
setLoginName
(
value
[
1
]);
user1
.
setDelFlag
(
"0"
);
user1
.
setFlag
(
"1"
);
if
(
sysUserMapper
.
selectOne
(
user1
)
==
null
)
{
teacherCodes
.
add
(
value
[
1
]);
continue
;
}
//判断3:根据班级编号查询是否有此班级;
if
(
value
[
2
].
equals
(
""
)){
value
[
2
]
=
wholeValue
[
2
];
}
for
(
String
classCode
:
value
[
2
].
split
(
","
)){
if
(
bClassRepository
.
selectOne
(
new
BClass
(
classCode
))==
null
){
classCodes
.
add
(
classCode
);
continue
;
}
}
//判断4:根据教室编号查询是否有此教室;
if
(
value
[
3
].
equals
(
""
)){
value
[
3
]
=
wholeValue
[
3
];
}
if
(
bRoomsRepository
.
selectOne
(
new
BRooms
(
value
[
3
]))==
null
){
roomCodes
.
add
(
value
[
3
]);
continue
;
}
//合法:通过了四次判断,证明可建立该排课
scheduleDto
.
setLessonCode
(
value
[
0
]);
scheduleDto
.
setTeacherCode
(
value
[
1
]);
scheduleDto
.
setClassCode
(
value
[
2
]);
scheduleDto
.
setRoomCode
(
value
[
3
]);
scheduleDto
.
setWeek
(
value
[
4
]);
scheduleDto
.
setClassHour
(
value
[
5
]);
scheduleDto
.
setMonday
(
value
[
6
]);
scheduleDto
.
setTuesday
(
value
[
7
]);
scheduleDto
.
setWednesday
(
value
[
8
]);
scheduleDto
.
setThursday
(
value
[
9
]);
scheduleDto
.
setFriday
(
value
[
10
]);
scheduleDto
.
setSaturday
(
value
[
11
]);
scheduleDtos
.
add
(
scheduleDto
);
}
String
result
=
""
;
if
(
scheduleDtos
.
size
()>
0
){
int
line1
=
bArrangeRepository
.
insertList
(
scheduleDtos
);
if
(
line1
<
1
)
{
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DB_INSERT_ERROR
);
}
else
{
result
+=
"成功导入"
+
scheduleDtos
.
size
()+
"条数据。"
;
}
}
if
(
lessonCodes
.
size
()>
0
){
result
+=
"以下课程编号不存在:"
+
JSON
.
toJSONString
(
lessonCodes
)+
"。"
;
}
if
(
teacherCodes
.
size
()>
0
){
result
+=
"以下教师编号不存在:"
+
JSON
.
toJSONString
(
teacherCodes
)+
"。"
;
}
if
(
classCodes
.
size
()>
0
){
result
+=
"以下班级编号不存在:"
+
JSON
.
toJSONString
(
classCodes
)+
"。"
;
}
if
(
roomCodes
.
size
()>
0
){
result
+=
"以下教室编号不存在:"
+
JSON
.
toJSONString
(
roomCodes
)+
"。"
;
}
return
new
PersistModel
(
1
,
result
);
}
}
}
src/main/java/org/rcisoft/business/bclass/entity/BClass.java
View file @
ab5397c2
...
@@ -35,7 +35,6 @@ public class BClass extends IdEntity<BClass> {
...
@@ -35,7 +35,6 @@ public class BClass extends IdEntity<BClass> {
/*学生数量,默认为0*/
/*学生数量,默认为0*/
@Length
(
min
=
1
,
max
=
3
,
message
=
"长度最小为1,最大为3"
)
@Length
(
min
=
1
,
max
=
3
,
message
=
"长度最小为1,最大为3"
)
@NotBlank
private
String
studentNum
;
private
String
studentNum
;
/*班级类型*/
/*班级类型*/
...
...
src/main/java/org/rcisoft/business/bclass/service/impl/BClassServiceImpl.java
View file @
ab5397c2
...
@@ -85,7 +85,7 @@ public class BClassServiceImpl implements BClassService {
...
@@ -85,7 +85,7 @@ public class BClassServiceImpl implements BClassService {
ArrayList
<
String
>
repeatCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
repeatCode
=
new
ArrayList
<
String
>();
String
[]
headers
=
{
"班级编号"
,
"班级名称"
};
String
[]
headers
=
{
"班级编号"
,
"班级名称"
};
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
);
//获取excel数据
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
,
false
);
//获取excel数据
if
(
values
.
size
()<=
0
){
if
(
values
.
size
()<=
0
){
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
...
...
src/main/java/org/rcisoft/business/beduclass/controller/BEduClassController.java
View file @
ab5397c2
...
@@ -42,7 +42,7 @@ public class BEduClassController extends PaginationController<BEduClass> {
...
@@ -42,7 +42,7 @@ public class BEduClassController extends PaginationController<BEduClass> {
@ApiImplicitParam
(
name
=
"className"
,
value
=
"教学班名 length(1~150)"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"className"
,
value
=
"教学班名 length(1~150)"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"agencyId"
,
value
=
"企业ID"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"agencyId"
,
value
=
"企业ID"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"班级类型"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"班级类型"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"classes
Code
"
,
value
=
"教学班code串"
,
required
=
false
,
dataType
=
"varchar"
)})
@ApiImplicitParam
(
name
=
"classes
Id
"
,
value
=
"教学班code串"
,
required
=
false
,
dataType
=
"varchar"
)})
@PostMapping
(
value
=
"/add"
)
@PostMapping
(
value
=
"/add"
)
@PreAuthorize
(
"hasRole('ROLE_1001')"
)
@PreAuthorize
(
"hasRole('ROLE_1001')"
)
public
Result
add
(
BEduClass
bEduClass
)
{
public
Result
add
(
BEduClass
bEduClass
)
{
...
@@ -75,7 +75,7 @@ public class BEduClassController extends PaginationController<BEduClass> {
...
@@ -75,7 +75,7 @@ public class BEduClassController extends PaginationController<BEduClass> {
@ApiImplicitParam
(
name
=
"className"
,
value
=
"教学班名 length(1~150)"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"className"
,
value
=
"教学班名 length(1~150)"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"agencyId"
,
value
=
"企业ID"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"agencyId"
,
value
=
"企业ID"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"班级类型 length(1)"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"班级类型 length(1)"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"classe
dCode
"
,
value
=
"教学班code串 length(1~150)"
,
required
=
false
,
dataType
=
"varchar"
)})
@ApiImplicitParam
(
name
=
"classe
sId
"
,
value
=
"教学班code串 length(1~150)"
,
required
=
false
,
dataType
=
"varchar"
)})
@PostMapping
(
"/update"
)
@PostMapping
(
"/update"
)
@PreAuthorize
(
"hasRole('ROLE_1001')"
)
@PreAuthorize
(
"hasRole('ROLE_1001')"
)
public
Result
update
(
BEduClass
bEduClass
)
{
public
Result
update
(
BEduClass
bEduClass
)
{
...
...
src/main/java/org/rcisoft/business/beduclass/entity/BEduClass.java
View file @
ab5397c2
...
@@ -41,7 +41,7 @@ public class BEduClass extends IdEntity<BEduClass> {
...
@@ -41,7 +41,7 @@ public class BEduClass extends IdEntity<BEduClass> {
private
String
type
;
private
String
type
;
/*子班级ID串*/
/*子班级ID串*/
private
String
classes
Code
;
private
String
classes
Id
;
/*学年ID*/
/*学年ID*/
private
String
gradeId
;
private
String
gradeId
;
...
...
src/main/java/org/rcisoft/business/beduclass/service/impl/BEduClassServiceImpl.java
View file @
ab5397c2
...
@@ -89,7 +89,7 @@ public class BEduClassServiceImpl implements BEduClassService {
...
@@ -89,7 +89,7 @@ public class BEduClassServiceImpl implements BEduClassService {
*/
*/
public
BEduClass
findById
(
String
id
){
public
BEduClass
findById
(
String
id
){
BEduClass
eduClass
=
bEduClassRepository
.
selectDetalInfo
(
id
);
BEduClass
eduClass
=
bEduClassRepository
.
selectDetalInfo
(
id
);
String
classNames
=
this
.
getclassNames
(
eduClass
.
getClasses
Code
());
String
classNames
=
this
.
getclassNames
(
eduClass
.
getClasses
Id
());
if
(
classNames
.
length
()>
0
){
if
(
classNames
.
length
()>
0
){
eduClass
.
setClassNames
(
classNames
.
substring
(
0
,
classNames
.
length
()-
1
));
eduClass
.
setClassNames
(
classNames
.
substring
(
0
,
classNames
.
length
()-
1
));
}
else
{
}
else
{
...
@@ -109,7 +109,7 @@ public class BEduClassServiceImpl implements BEduClassService {
...
@@ -109,7 +109,7 @@ public class BEduClassServiceImpl implements BEduClassService {
bEduClass
.
setNotDeleted
();
bEduClass
.
setNotDeleted
();
List
<
BEduClass
>
eduClasses
=
bEduClassRepository
.
queryBEduClasss
(
bEduClass
);
List
<
BEduClass
>
eduClasses
=
bEduClassRepository
.
queryBEduClasss
(
bEduClass
);
for
(
BEduClass
eduClass
:
eduClasses
){
for
(
BEduClass
eduClass
:
eduClasses
){
String
name
=
this
.
getclassNames
(
eduClass
.
getClasses
Code
());
String
name
=
this
.
getclassNames
(
eduClass
.
getClasses
Id
());
if
(
name
.
length
()>
0
){
if
(
name
.
length
()>
0
){
eduClass
.
setClassNames
(
name
.
substring
(
0
,
name
.
length
()-
1
));
eduClass
.
setClassNames
(
name
.
substring
(
0
,
name
.
length
()-
1
));
}
else
{
}
else
{
...
...
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
ab5397c2
...
@@ -114,7 +114,7 @@ public class BLessonServiceImpl implements BLessonService {
...
@@ -114,7 +114,7 @@ public class BLessonServiceImpl implements BLessonService {
ArrayList
<
String
>
direction
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
direction
=
new
ArrayList
<
String
>();
String
[]
headers
=
{
"课程编号"
,
"课程名称"
,
"课程方向编号"
,
"学时"
,
"学分"
};
String
[]
headers
=
{
"课程编号"
,
"课程名称"
,
"课程方向编号"
,
"学时"
,
"学分"
};
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
);
//获取excel数据
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
,
false
);
//获取excel数据
if
(
values
.
size
()<
1
){
if
(
values
.
size
()<
1
){
...
...
src/main/java/org/rcisoft/business/brclassstudent/service/impl/BRClassStudentServiceImpl.java
View file @
ab5397c2
...
@@ -83,7 +83,7 @@ public class BRClassStudentServiceImpl implements BRClassStudentService {
...
@@ -83,7 +83,7 @@ public class BRClassStudentServiceImpl implements BRClassStudentService {
ArrayList
<
String
>
repeatCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
repeatCode
=
new
ArrayList
<
String
>();
String
[]
headers
=
{
"班级编号"
,
"学号"
};
String
[]
headers
=
{
"班级编号"
,
"学号"
};
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
);
//获取excel数据
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
,
false
);
//获取excel数据
if
(
values
.
size
()<=
0
){
if
(
values
.
size
()<=
0
){
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
...
...
src/main/java/org/rcisoft/business/brooms/entity/BRooms.java
View file @
ab5397c2
...
@@ -67,7 +67,11 @@ public class BRooms extends IdEntity<BRooms> {
...
@@ -67,7 +67,11 @@ public class BRooms extends IdEntity<BRooms> {
@Transient
@Transient
private
String
transitCategory
;
private
String
transitCategory
;
public
String
getTransitCampus
(){
public
BRooms
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getTransitCampus
(){
if
(
this
.
transitCampus
!=
null
&&
!
this
.
transitCampus
.
equals
(
""
)){
if
(
this
.
transitCampus
!=
null
&&
!
this
.
transitCampus
.
equals
(
""
)){
switch
(
this
.
transitCampus
)
{
switch
(
this
.
transitCampus
)
{
case
"0"
:
case
"0"
:
...
...
src/main/java/org/rcisoft/business/brslstudent/service/impl/BRSlStudentServiceImpl.java
View file @
ab5397c2
...
@@ -89,7 +89,7 @@ public class BRSlStudentServiceImpl implements BRSlStudentService {
...
@@ -89,7 +89,7 @@ public class BRSlStudentServiceImpl implements BRSlStudentService {
ArrayList<String> gitlabUser = new ArrayList<String>();*/
ArrayList<String> gitlabUser = new ArrayList<String>();*/
String
[]
headers
=
{
"课序号"
,
"学号"
};
String
[]
headers
=
{
"课序号"
,
"学号"
};
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
);
//获取excel数据
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
,
false
);
//获取excel数据
if
(
values
.
size
()<
1
){
if
(
values
.
size
()<
1
){
...
...
src/main/java/org/rcisoft/business/bsl/service/impl/BSlServiceImpl.java
View file @
ab5397c2
...
@@ -161,7 +161,7 @@ public class BSlServiceImpl implements BSlService {
...
@@ -161,7 +161,7 @@ public class BSlServiceImpl implements BSlService {
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
();
String
[]
headers
=
{
"课序号"
,
"课程编号"
,
"教师工号"
,
"学期编号"
};
String
[]
headers
=
{
"课序号"
,
"课程编号"
,
"教师工号"
,
"学期编号"
};
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
);
//获取excel数据
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
,
false
);
//获取excel数据
if
(
values
.
size
()<=
0
){
if
(
values
.
size
()<=
0
){
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
...
...
src/main/java/org/rcisoft/business/bstudent/service/impl/BStudentServiceImpl.java
View file @
ab5397c2
...
@@ -127,7 +127,7 @@ public class BStudentServiceImpl implements BStudentService {
...
@@ -127,7 +127,7 @@ public class BStudentServiceImpl implements BStudentService {
ArrayList
<
SysUser
>
users
=
new
ArrayList
<
SysUser
>();
ArrayList
<
SysUser
>
users
=
new
ArrayList
<
SysUser
>();
ArrayList
<
UserRole
>
userRoles
=
new
ArrayList
<
UserRole
>();
ArrayList
<
UserRole
>
userRoles
=
new
ArrayList
<
UserRole
>();
String
[]
headers
=
{
"学号"
,
"学生姓名"
,
"性别"
,
"邮箱"
,
"年级"
};
String
[]
headers
=
{
"学号"
,
"学生姓名"
,
"性别"
,
"邮箱"
,
"年级"
};
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
);
//获取excel数据
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
,
false
);
//获取excel数据
if
(
values
.
size
()<=
0
){
if
(
values
.
size
()<=
0
){
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
...
...
src/main/java/org/rcisoft/business/bteacher/service/impl/BTeacherServiceImpl.java
View file @
ab5397c2
...
@@ -83,7 +83,7 @@ public class BTeacherServiceImpl implements BTeacherService {
...
@@ -83,7 +83,7 @@ public class BTeacherServiceImpl implements BTeacherService {
ArrayList
<
UserRole
>
userRoles
=
new
ArrayList
<
UserRole
>();
ArrayList
<
UserRole
>
userRoles
=
new
ArrayList
<
UserRole
>();
String
[]
headers
=
{
"教师工号"
,
"教师姓名"
,
"性别"
,
"邮箱"
};
String
[]
headers
=
{
"教师工号"
,
"教师姓名"
,
"性别"
,
"邮箱"
};
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
);
//获取excel数据
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
,
false
);
//获取excel数据
if
(
values
.
size
()
==
0
){
if
(
values
.
size
()
==
0
){
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
}
}
...
...
src/main/java/org/rcisoft/core/util/ExcelUtil.java
View file @
ab5397c2
...
@@ -23,9 +23,10 @@ public class ExcelUtil {
...
@@ -23,9 +23,10 @@ public class ExcelUtil {
* 获取excel模板信息
* 获取excel模板信息
* @param hwb 源数据
* @param hwb 源数据
* @param headers excel模板头
* @param headers excel模板头
* @param allowEmpty 是否允许单元格有空数据
* @return 整理好的ArrayList<String[]>
* @return 整理好的ArrayList<String[]>
*/
*/
public
static
ArrayList
<
String
[]>
importExcel
(
HSSFWorkbook
hwb
,
String
[]
headers
){
public
static
ArrayList
<
String
[]>
importExcel
(
HSSFWorkbook
hwb
,
String
[]
headers
,
boolean
allowEmpty
){
ArrayList
<
String
[]>
values
=
new
ArrayList
<>();
ArrayList
<
String
[]>
values
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
hwb
.
getNumberOfSheets
();
i
++)
{
for
(
int
i
=
0
;
i
<
hwb
.
getNumberOfSheets
();
i
++)
{
HSSFSheet
hs
=
hwb
.
getSheetAt
(
i
);
HSSFSheet
hs
=
hwb
.
getSheetAt
(
i
);
...
@@ -44,7 +45,7 @@ public class ExcelUtil {
...
@@ -44,7 +45,7 @@ public class ExcelUtil {
int
firstcolumnnum
=
hr
.
getFirstCellNum
();
int
firstcolumnnum
=
hr
.
getFirstCellNum
();
int
lastcolumnnum
=
hr
.
getLastCellNum
();
int
lastcolumnnum
=
hr
.
getLastCellNum
();
String
[]
value
=
new
String
[
lastcolumnnum
];
String
[]
value
=
new
String
[
lastcolumnnum
];
boolean
hasEmpty
=
fals
e
;
boolean
hasEmpty
=
tru
e
;
for
(
int
k
=
firstcolumnnum
;
k
<
lastcolumnnum
;
k
++)
{
for
(
int
k
=
firstcolumnnum
;
k
<
lastcolumnnum
;
k
++)
{
HSSFCell
hc
=
hr
.
getCell
(
k
);
HSSFCell
hc
=
hr
.
getCell
(
k
);
if
(
j
==
firstrownum
+
1
)
{
if
(
j
==
firstrownum
+
1
)
{
...
@@ -56,12 +57,22 @@ public class ExcelUtil {
...
@@ -56,12 +57,22 @@ public class ExcelUtil {
}
}
}
}
else
{
else
{
if
(
parseDB
(
hc
).
trim
().
equals
(
""
)&&
emptyColList
.
get
(
k
)!=-
1
)
{
if
(
allowEmpty
){
//允许单元格为空,但不允许整行为空时
//在第j行第k列有空数据,且该列表头不是空的,则舍弃本行数据。
if
(!
parseDB
(
hc
).
trim
().
equals
(
""
)&&
emptyColList
.
get
(
k
)!=-
1
&&
hasEmpty
)
{
hasEmpty
=
true
;
//只要一行中有一个值不为空,即为正确数据
hasEmpty
=
false
;
break
;
}
}
else
{
//不允许单元格为空,只要一行中有一个值为空,即为错误数据
hasEmpty
=
false
;
if
(
parseDB
(
hc
).
trim
().
equals
(
""
)&&
emptyColList
.
get
(
k
)!=-
1
)
{
//在第j行第k列有空数据,且该列表头不是空的,则舍弃本行数据。
hasEmpty
=
true
;
break
;
}
}
}
}
}
value
[
k
]
=
parseDB
(
hc
);
value
[
k
]
=
parseDB
(
hc
);
...
...
src/main/resources/mapper/business/beduclass/mapper/BEduClassMapper.xml
View file @
ab5397c2
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<result
column=
"class_name"
jdbcType=
"VARCHAR"
property=
"className"
/>
<result
column=
"class_name"
jdbcType=
"VARCHAR"
property=
"className"
/>
<result
column=
"agency_id"
jdbcType=
"VARCHAR"
property=
"agencyId"
/>
<result
column=
"agency_id"
jdbcType=
"VARCHAR"
property=
"agencyId"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"classes_id"
jdbcType=
"VARCHAR"
property=
"classes
Code
"
/>
<result
column=
"classes_id"
jdbcType=
"VARCHAR"
property=
"classes
Id
"
/>
<result
column=
"grade_id"
jdbcType=
"VARCHAR"
property=
"gradeId"
/>
<result
column=
"grade_id"
jdbcType=
"VARCHAR"
property=
"gradeId"
/>
</resultMap>
</resultMap>
...
...
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