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
b663b718
Commit
b663b718
authored
Oct 24, 2019
by
王淑君
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/meiteng' into meiteng
parents
695278da
bd0ceaed
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
252 additions
and
123 deletions
+252
-123
pom.xml
pom.xml
+1
-1
BChapterController.java
...soft/business/bchapter/controller/BChapterController.java
+4
-37
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+15
-20
BCourseServiceImpl.java
...oft/business/bcourse/service/impl/BCourseServiceImpl.java
+8
-8
BFileRepository.java
.../java/org/rcisoft/business/bfile/dao/BFileRepository.java
+9
-1
BTrainFileRepository.java
.../org/rcisoft/business/bfile/dao/BTrainFileRepository.java
+1
-1
BLessonController.java
...cisoft/business/blesson/controller/BLessonController.java
+15
-4
BLessonPersonRepository.java
...rcisoft/business/blesson/dao/BLessonPersonRepository.java
+20
-1
BLessonRepository.java
...a/org/rcisoft/business/blesson/dao/BLessonRepository.java
+12
-2
BViewrangeRepository.java
...rg/rcisoft/business/blesson/dao/BViewrangeRepository.java
+1
-1
AddLessonDTO.java
...n/java/org/rcisoft/business/blesson/dto/AddLessonDTO.java
+3
-1
BLesson.java
...ain/java/org/rcisoft/business/blesson/entity/BLesson.java
+12
-2
BLessonPerson.java
...va/org/rcisoft/business/blesson/entity/BLessonPerson.java
+5
-1
BViewrange.java
.../java/org/rcisoft/business/blesson/entity/BViewrange.java
+0
-1
BLessonService.java
.../org/rcisoft/business/blesson/service/BLessonService.java
+9
-0
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+71
-14
BMaterialRepository.java
...g/rcisoft/business/bmaterial/dao/BMaterialRepository.java
+13
-2
OfficeToPdf.java
src/main/java/org/rcisoft/core/util/OfficeToPdf.java
+11
-0
SysRoleRepository.java
...main/java/org/rcisoft/sys/role/dao/SysRoleRepository.java
+1
-1
SysUserController.java
...va/org/rcisoft/sys/user/controller/SysUserController.java
+5
-4
SysUserServiceImpl.java
...org/rcisoft/sys/user/service/impl/SysUserServiceImpl.java
+35
-21
BLessonPersonMapper.xml
...es/mapper/business/blesson/mapper/BLessonPersonMapper.xml
+1
-0
No files found.
pom.xml
View file @
b663b718
...
...
@@ -376,7 +376,7 @@
<dependency>
<groupId>
com.artofsolving
</groupId>
<artifactId>
jodconverter
</artifactId>
<version>
2.2.
1
</version>
<version>
2.2.
2
</version>
</dependency>
<dependency>
...
...
src/main/java/org/rcisoft/business/bchapter/controller/BChapterController.java
View file @
b663b718
...
...
@@ -116,44 +116,11 @@ public class BChapterController extends PaginationController<BChapter> {
}
@ApiOperation
(
value
=
"206 流 输出ppt转为pdf"
,
notes
=
"流 输出ppt转为pdf"
,
response
=
QueryChapterListResDTO
.
class
)
@ApiOperation
(
value
=
"206 流 输出ppt转为pdf"
,
notes
=
"流 输出ppt转为pdf"
)
@GetMapping
(
"/getFile"
)
public
Result
getFile
(
CurUser
curUser
,
@
RequestParam
String
chapterId
,
BindingResult
br
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
public
Result
getFile
(
CurUser
curUser
,
@
Valid
String
chapterId
,
BindingResult
br
)
throws
IOException
{
String
newFileUrl
=
bChapterService
.
changeFileToPdf
(
chapterId
);
//读取路径下面的文件
// if (StringUtils.isNotEmpty(newFileUrl)){
// File file = new File(newFileUrl);
// File picFile = null;
//// for(File f : file.listFiles()){
//// if(f.getName().contains("zkz-pdf.pdf")){
// //根据路径获取文件
// picFile = new File(file.getPath());
// //获取文件后缀名格式
// String ext = picFile.getName().substring(picFile.getName().indexOf("."));
// //判断图片格式,设置相应的输出文件格式
// if(ext.equals("pdf")){
// response.setContentType("pdf");
// }
//// }
//// }
// //读取指定路径下面的文件
// InputStream in = new FileInputStream(picFile);
// OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
// //创建存放文件内容的数组
// byte[] buff =new byte[1024];
// //所读取的内容使用n来接收
// int n;
// //当没有读取完时,继续读取,循环
// while((n=in.read(buff))!=-1){
// //将字节数组的数据全部写入到输出流中
// outputStream.write(buff,0,n);
// }
// //强制将缓存区的数据进行输出
// outputStream.flush();
// //关流
// outputStream.close();
// in.close();
// }
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
...
...
@@ -161,9 +128,9 @@ public class BChapterController extends PaginationController<BChapter> {
}
@ApiOperation
(
value
=
"207 预览文件"
,
notes
=
"(预览时传)"
,
response
=
QueryChapterListResDTO
.
class
)
@ApiOperation
(
value
=
"207 预览文件"
,
notes
=
"(预览时传)"
)
@GetMapping
(
"/getFileAtView"
)
public
Result
getFileAtView
(
CurUser
curUser
,
@
RequestParam
BFile
file
,
BindingResult
br
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
public
Result
getFileAtView
(
CurUser
curUser
,
@
Valid
BFile
file
,
BindingResult
br
)
throws
IOException
{
String
newFileUrl
=
bChapterService
.
changeFileToPdfAtView
(
file
);
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
...
...
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
b663b718
...
...
@@ -5,6 +5,8 @@ import cn.hutool.core.util.StrUtil;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.rcisoft.business.bchapter.dao.BChapterRepository
;
import
org.rcisoft.business.bchapter.dto.*
;
import
org.rcisoft.business.bchapter.entity.BChapter
;
...
...
@@ -51,10 +53,7 @@ import java.nio.file.Files;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
/**
...
...
@@ -184,10 +183,6 @@ public class BChapterServiceImpl implements BChapterService {
model
.
setChapterLevel
(
chapterDTO
.
getChapterLevel
());
model
.
setIsTest
(
chapterDTO
.
getIsTest
());
// if ("2".equals(dto.getType())||"4".equals(dto.getType())){
// mtCotactApiRequestClient.fileChange(dto);
// }
bFile
.
setFileName
(
dto
.
getFileName
());
bFile
.
setVideoUrl
(
dto
.
getVideoUrl
());
bFile
.
setType
(
dto
.
getType
());
...
...
@@ -243,12 +238,13 @@ public class BChapterServiceImpl implements BChapterService {
UserUtil
.
setCurrentMergeOperation
(
model
);
bFile
.
setChapterId
(
model
.
getBusinessId
());
UserUtil
.
setCurrentMergeOperation
(
bFile
);
UserUtil
.
setCurrentMergeOperation
(
bFile
);
model
.
setCourseTime
(
dto
.
getFileTime
());
model
.
setIsTest
(
dto
.
getType
());
if
(
StringUtils
.
isNotEmpty
(
dto
.
getFileTime
())
&&
dto
.
getFileTime
().
contains
(
"."
))
{
model
.
setCourseTime
(
dto
.
getFileTime
().
substring
(
0
,
dto
.
getFileTime
().
lastIndexOf
(
"."
)));
bFile
.
setFileTime
(
dto
.
getFileTime
().
substring
(
0
,
dto
.
getFileTime
().
lastIndexOf
(
"."
)));
}
//先判断该课程的第一章的第一节是否是本节 更新blesson表中course_time字段
String
cid
=
bChapterRepository
.
getFirstChapter
(
model
.
getLessonId
());
...
...
@@ -258,14 +254,14 @@ public class BChapterServiceImpl implements BChapterService {
line
=
bChapterRepository
.
updateByPrimaryKeySelective
(
model
);
int
x
=
bFileRepository
.
update
ByPrimaryKeySelectiv
e
(
bFile
);
int
x
=
bFileRepository
.
update
UploadFil
e
(
bFile
);
}
//不是为添加章时插入资料表
if
(
StringUtils
.
isNotEmpty
(
model
.
getIsTest
()))
{
BMaterial
bMaterial
=
new
BMaterial
();
UserUtil
.
setCurrentPersistOperation
(
bMaterial
);
bMaterial
.
setLessonId
(
model
.
getLessonId
());
bMaterial
.
setLessonId
(
chapterDTO
.
getLessonId
());
bMaterial
.
setChapterId
(
model
.
getBusinessId
());
bMaterial
.
setFileName
(
dto
.
getFileName
());
...
...
@@ -273,11 +269,8 @@ public class BChapterServiceImpl implements BChapterService {
bMaterial
.
setFileTime
(
dto
.
getFileTime
().
substring
(
0
,
dto
.
getFileTime
().
lastIndexOf
(
"."
)));
}
if
(
Integer
.
parseInt
(
model
.
getIsTest
())
<
4
)
{
bMaterial
.
setFileUrl
(
model
.
getVideoUrl
());
}
else
if
(
Integer
.
parseInt
(
model
.
getIsTest
())
>=
4
)
{
bMaterial
.
setFileUrl
(
model
.
getFileUrl
());
}
bMaterial
.
setFileUrl
(
dto
.
getVideoUrl
());
bMaterial
.
setType
(
model
.
getIsTest
());
bMaterial
.
setUploadType
(
"1"
);
bMaterial
.
setFileSize
(
dto
.
getFileSize
());
...
...
@@ -324,9 +317,8 @@ public class BChapterServiceImpl implements BChapterService {
public
String
changeFile
(
BFile
bFile
)
{
log
.
debug
(
"****************request + begin***********"
+
DateFormatUtils
.
format
(
new
Date
(),
"HH:mm:ss"
));
String
name
=
bFile
.
getVideoUrl
().
substring
(
bFile
.
getVideoUrl
().
lastIndexOf
(
"/"
)
+
1
);
String
filePath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()
+
global
.
getCOURSE_LOCATION
()
+
File
.
separator
+
bFile
.
getLessonId
();
String
returnBasePath
=
global
.
getRETURN_UPLOAD_SERVER_LOCATION
()
+
global
.
getCOURSE_LOCATION
()
+
File
.
separator
+
bFile
.
getLessonId
();
File
file
=
new
File
(
filePath
);
...
...
@@ -363,7 +355,6 @@ public class BChapterServiceImpl implements BChapterService {
String
downLoadFileUrl
=
downLoadFile
(
bFile
,
file
,
filePath
);
log
.
debug
(
"------------------z12-----------------------------downLoadFileUrl:"
+
filePath
+
File
.
separator
+
downLoadFileUrl
);
log
.
debug
(
"------------------z12-----------------------------filePath:"
+
filePath
+
File
.
separator
+
newName
);
int
result
=
officeToPdf
.
transformToPdf
(
filePath
+
File
.
separator
+
downLoadFileUrl
,
filePath
+
File
.
separator
+
newName
);
log
.
debug
(
"------------------z13-----------------------------"
);
if
(
result
<
1
)
{
...
...
@@ -378,6 +369,8 @@ public class BChapterServiceImpl implements BChapterService {
bFileRepository
.
updateByPrimaryKeySelective
(
bFile
);
}
log
.
debug
(
"------------------z16-----------------------------"
);
log
.
debug
(
"****************request + end***********"
+
DateFormatUtils
.
format
(
new
Date
(),
"HH:mm:ss"
));
return
returnBasePath
+
File
.
separator
+
newName
;
}
}
else
{
...
...
@@ -388,6 +381,7 @@ public class BChapterServiceImpl implements BChapterService {
//下载
public
String
downLoadFile
(
BFile
bFile
,
File
file
,
String
filePath
)
{
log
.
debug
(
"****************download + begin***********"
+
DateFormatUtils
.
format
(
new
Date
(),
"HH:mm:ss"
));
String
name
=
bFile
.
getVideoUrl
().
substring
(
bFile
.
getVideoUrl
().
lastIndexOf
(
"/"
)
+
1
);
log
.
debug
(
"------------------D1-----------------------------"
+
filePath
);
...
...
@@ -431,7 +425,7 @@ public class BChapterServiceImpl implements BChapterService {
log
.
debug
(
"------------------D10-----------------------------"
);
BufferedOutputStream
bos
=
new
BufferedOutputStream
(
fileOut
);
log
.
debug
(
"------------------D11-----------------------------"
);
byte
[]
buf
=
new
byte
[
4096
];
byte
[]
buf
=
new
byte
[
1024
*
512
];
int
length
=
bis
.
read
(
buf
);
//保存文件
while
(
length
!=
-
1
)
{
...
...
@@ -442,6 +436,7 @@ public class BChapterServiceImpl implements BChapterService {
bis
.
close
();
conn
.
disconnect
();
log
.
debug
(
"------------------D12-----------------------------"
);
log
.
debug
(
"****************download + end***********"
+
DateFormatUtils
.
format
(
new
Date
(),
"HH:mm:ss"
));
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
()
+
"下载文件异常"
);
throw
new
ServiceException
(
ResultServiceEnums
.
DOWNLOAD_ERROR
);
...
...
src/main/java/org/rcisoft/business/bcourse/service/impl/BCourseServiceImpl.java
View file @
b663b718
...
...
@@ -58,10 +58,10 @@ public class BCourseServiceImpl implements BCourseService {
if
(
bCourse
.
getCName
()
==
null
||
bCourse
.
getCName
().
equals
(
""
))
{
throw
new
ServiceException
(
ResultServiceEnums
.
NAME_IS_NULL
);
}
List
<
BCourse
>
list
=
bCourseRepository
.
selectOneByName
(
bCourse
.
getCName
(),
bCourse
.
getCorpId
());
if
(
list
.
size
()
>
0
)
{
throw
new
ServiceException
(
ResultServiceEnums
.
NAME_IS_EXISTS
);
}
//
List<BCourse> list = bCourseRepository.selectOneByName(bCourse.getCName(), bCourse.getCorpId());
//
if (list.size() > 0) {
//
throw new ServiceException(ResultServiceEnums.NAME_IS_EXISTS);
//
}
if
(
bCourse
.
getPid
()
==
null
||
""
.
equals
(
bCourse
.
getPid
()))
{
bCourse
.
setPid
(
"00000000"
);
...
...
@@ -108,10 +108,10 @@ public class BCourseServiceImpl implements BCourseService {
@Override
public
PersistModel
updateCourse
(
BCourse
bCourse
)
{
List
<
BCourse
>
list
=
bCourseRepository
.
selectOneByName
(
bCourse
.
getCName
(),
bCourse
.
getCorpId
());
if
(
list
.
size
()
>
0
)
{
throw
new
ServiceException
(
ResultServiceEnums
.
NAME_IS_EXISTS
);
}
//
List<BCourse> list = bCourseRepository.selectOneByName(bCourse.getCName(), bCourse.getCorpId());
//
if (list.size() > 0) {
//
throw new ServiceException(ResultServiceEnums.NAME_IS_EXISTS);
//
}
UserUtil
.
setCurrentMergeOperation
(
bCourse
);
return
new
PersistModel
(
bCourseRepository
.
updateCourse
(
bCourse
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
}
...
...
src/main/java/org/rcisoft/business/bfile/dao/BFileRepository.java
View file @
b663b718
...
...
@@ -51,7 +51,15 @@ public interface BFileRepository extends BaseMapper<BFile> {
"VALUES (#{businessId}, #{lessonId}, #{chapterId}, #{fileName}, #{videoUrl}, #{fileUrl}, #{type}, #{flag}, #{delFlag}, #{remarks}, #{createBy}, #{updateBy}, #{updateDate}, #{createDate},#{fileSize},#{fileTime})"
)
int
insertUploadFile
(
BFile
bFile
);
@Update
(
"update b_file set file_name = #{fileName} , video_url = #{videoUrl} , type = #{type} ,file_size = #{fileSize},file_time = #{fileTime}"
+
@Update
(
"update b_file set "
+
"file_name = #{fileName} , "
+
"video_url = #{videoUrl} ,"
+
"file_url = #{fileUrl} ,"
+
"type = #{type} ,"
+
"file_size = #{fileSize},"
+
"file_time = #{fileTime},"
+
"update_by = #{updateBy},"
+
"update_date = #{updateDate}"
+
"where chapter_id =#{chapterId}"
)
int
updateUploadFile
(
BFile
bFile
);
...
...
src/main/java/org/rcisoft/business/bfile/dao/BTrainFileRepository.java
View file @
b663b718
...
...
@@ -40,7 +40,7 @@ public interface BTrainFileRepository extends BaseMapper<BTrainFile> {
@Insert
(
"<script>INSERT INTO b_train_file "
+
"(create_date,create_by,update_date,update_by,"
+
"del_flag,flag,business_id,remarks"
+
"del_flag,flag,business_id,remarks
,
"
+
"lesson_id,file_name,video_url,file_url,file_size,type)VALUES"
+
"<foreach collection=\"param\" item=\"item\" separator=\",\">"
+
"(#{item.createDate},#{item.createBy},#{item.updateDate},#{item.updateBy},"
+
...
...
src/main/java/org/rcisoft/business/blesson/controller/BLessonController.java
View file @
b663b718
...
...
@@ -524,7 +524,7 @@ public class BLessonController extends PaginationController<BLesson> {
* @param
* @return
*/
@ApiOperation
(
value
=
"630 培训学员
总数"
,
notes
=
"培训学员总数(已报名 已到场 未到场)
"
)
@ApiOperation
(
value
=
"630 培训学员
"
,
notes
=
"培训学员
"
)
@GetMapping
(
value
=
"/trainPersons"
)
public
Result
trainPersons
(
CurUser
curUser
,
@Valid
FindTrainPersonDTO
param
,
BindingResult
bindingResult
)
{
...
...
@@ -554,14 +554,14 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiImplicitParam
(
name
=
"lessonId"
,
value
=
"培训课id"
,
required
=
true
,
dataType
=
"varchar"
)
@GetMapping
(
value
=
"/toTraining"
)
public
Result
toTraining
(
CurUser
curUser
,
String
lessonId
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
return
Result
.
builder
(
new
PersistModel
(
bLessonService
.
toTraining
(
curUser
,
lessonId
)
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
bLessonService
.
toTraining
(
curUser
,
lessonId
)
);
lessonId
);
}
@ApiOperation
(
value
=
"632 单一查询我参加培训的信息"
,
notes
=
"单一查询我参加培训的信息"
,
response
=
BLesson
.
class
)
@ApiImplicitParam
(
name
=
"
lesson
Id"
,
value
=
"培训课id"
,
required
=
true
,
dataType
=
"varchar"
)
@ApiImplicitParam
(
name
=
"
business
Id"
,
value
=
"培训课id"
,
required
=
true
,
dataType
=
"varchar"
)
@GetMapping
(
value
=
"/findOneMyTrain"
)
public
Result
findOneMyTrain
(
CurUser
curUser
,
String
businessId
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
...
...
@@ -570,4 +570,15 @@ public class BLessonController extends PaginationController<BLesson> {
bLessonService
.
findOneMyTrain
(
curUser
,
businessId
));
}
@ApiOperation
(
value
=
"633 单一查询我主讲培训的信息"
,
notes
=
"单一查询我主讲培训的信息"
,
response
=
BLesson
.
class
)
@ApiImplicitParam
(
name
=
"lessonId"
,
value
=
"培训课id"
,
required
=
true
,
dataType
=
"varchar"
)
@GetMapping
(
value
=
"/findOneMyTeachTrain"
)
public
Result
findOneMyTeachTrain
(
CurUser
curUser
,
String
lessonId
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
bLessonService
.
findOneMyTeachTrain
(
curUser
,
lessonId
));
}
}
src/main/java/org/rcisoft/business/blesson/dao/BLessonPersonRepository.java
View file @
b663b718
...
...
@@ -247,7 +247,14 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@ResultMap
(
value
=
"BaseResultMap"
)
BLessonPerson
selectById
(
String
businessId
);
@Select
(
"select * from b_lesson_person where lesson_id = #{lessonId} and person_id = #{personId}"
)
/**
* 查询该用户在此培训中不删除的状态
* @param lessonId
* @param personId
* @return
*/
@Select
(
"select * from b_lesson_person where lesson_id = #{lessonId} and person_id = #{personId} and del_flag != 1 "
)
@ResultMap
(
value
=
"BaseResultMap"
)
BLessonPerson
getAppointInTraining
(
@Param
(
"lessonId"
)
String
lessonId
,
@Param
(
"personId"
)
String
personId
);
...
...
@@ -262,4 +269,16 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BLessonPerson
>
trainPersons
(
@Param
(
"param"
)
FindTrainPersonDTO
param
);
/**
* 用户在表中有未删除的数据且未报名
* 更新 报名状态、报名时间、培训状态
* @return
*/
@Update
(
"update b_lesson_person set apply_date=#{applyDate},is_apply =#{isApply},train_is_sign = #{trainIsSign} "
+
"where lesson_id= #{lessonId} and person_id=#{personId} and del_flag != 1 "
)
int
updateLessonPersonByUserId
(
BLessonPerson
lessonPerson
);
// @Insert("")
// int insertLessonPerson(BLessonPerson lessonPerson);
}
src/main/java/org/rcisoft/business/blesson/dao/BLessonRepository.java
View file @
b663b718
...
...
@@ -86,7 +86,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" where bl.del_flag != 1 and bl.flag = 1 "
+
" and bl.business_id = #{businessId} "
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
@ResultMap
(
value
=
"
Train
BaseResultMap"
)
BLesson
selectInfoById
(
String
businessId
);
...
...
@@ -934,7 +934,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"and les.del_flag != 1 and les.flag = 1 "
+
"AND les.corp_id = #{corpId}"
+
"<if test='!isAdmin'>"
+
"AND les.
lecturer_id
IN"
+
"AND les.
create_by
IN"
+
"<foreach item='item' index='index' collection='CurUserSet' open='(' close=')' separator=','> "
+
"#{item} "
+
"</foreach>"
+
...
...
@@ -967,6 +967,16 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@ResultMap
(
value
=
"TrainBaseResultMap"
)
BLesson
findOneMyTrain
(
@Param
(
"curUser"
)
CurUser
curUser
,
@Param
(
"businessId"
)
String
businessId
);
@Select
(
"<script>select bl.*, "
+
" su.name lecturerName "
+
" from b_lesson bl "
+
" left join s_user su on bl.lecturer_id = su.business_id "
+
" where 1=1 "
+
"and bl.del_flag = 0 and bl.flag = 1 "
+
"and bl.business_id = #{lessonId} </script>"
)
@ResultMap
(
value
=
"TrainBaseResultMap"
)
BLesson
findOneMyTeachTrain
(
@Param
(
"curUser"
)
CurUser
curUser
,
@Param
(
"lessonId"
)
String
lessonId
);
@Select
(
"<script>"
+
" select count(1) from b_lesson_person "
+
...
...
src/main/java/org/rcisoft/business/blesson/dao/BViewrangeRepository.java
View file @
b663b718
...
...
@@ -37,7 +37,7 @@ public interface BViewrangeRepository extends BaseMapper<BViewrange> {
" <if test='remarks != null'>remarks=#{remarks},</if> "
,
" <if test='lessonId != null'>lesson_id=#{lessonId},</if> "
,
" <if test='type != null'>type=#{type},</if> "
,
" <if test='corp_id != null'>corp_id=#{corp
_i
d},</if> "
,
" <if test='corp_id != null'>corp_id=#{corp
I
d},</if> "
,
" </set>"
,
"where lesson_id=#{lessonId}"
,
"</script>"
})
...
...
src/main/java/org/rcisoft/business/blesson/dto/AddLessonDTO.java
View file @
b663b718
...
...
@@ -27,9 +27,11 @@ public class AddLessonDTO {
private
String
defaultUrl
;
@ApiModelProperty
(
value
=
"课程分类"
,
required
=
true
)
@NotBlank
private
String
courseId
;
@ApiModelProperty
(
value
=
"讲师id"
)
private
String
lecturerId
;
@ApiModelProperty
(
value
=
"课程描述"
)
private
String
courseDescription
;
...
...
src/main/java/org/rcisoft/business/blesson/entity/BLesson.java
View file @
b663b718
package
org
.
rcisoft
.
business
.
blesson
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
...
...
@@ -12,6 +13,7 @@ import org.rcisoft.common.component.Global;
import
org.rcisoft.core.entity.IdEntity
;
import
org.rcisoft.core.util.UserUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
...
...
@@ -109,15 +111,23 @@ public class BLesson extends IdEntity<BLesson> {
private
String
value
;
//---------------培训------------------
@DateTimeFormat
(
pattern
=
"yyyy/MM/dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy/MM/dd HH:mm:ss"
)
@ApiModelProperty
(
value
=
"报名开始时间"
)
private
Date
applyStartDate
;
@DateTimeFormat
(
pattern
=
"yyyy/MM/dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy/MM/dd HH:mm:ss"
)
@ApiModelProperty
(
value
=
"报名结束时间"
)
private
Date
applyOverDate
;
@DateTimeFormat
(
pattern
=
"yyyy/MM/dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy/MM/dd HH:mm:ss"
)
@ApiModelProperty
(
value
=
"培训开始时间"
)
private
Date
trainStartDate
;
@DateTimeFormat
(
pattern
=
"yyyy/MM/dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy/MM/dd HH:mm:ss"
)
@ApiModelProperty
(
value
=
"培训结束时间"
)
private
Date
trainOverDate
;
...
...
@@ -128,6 +138,8 @@ public class BLesson extends IdEntity<BLesson> {
@Length
(
min
=
1
,
max
=
255
,
message
=
"长度最小为1,最大为255"
)
private
String
trainAddress
;
@DateTimeFormat
(
pattern
=
"yyyy/MM/dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy/MM/dd HH:mm:ss"
)
@ApiModelProperty
(
value
=
"培训签到时间(培训开始前 分钟数)"
)
@Length
(
min
=
1
,
max
=
15
,
message
=
"长度最小为1,最大为15"
)
private
String
trainSignTime
;
...
...
@@ -235,8 +247,6 @@ public class BLesson extends IdEntity<BLesson> {
UserUtil
.
setCurrentPersistOperation
(
this
);
//设置状态为待发布
this
.
setReleaseState
(
"0"
);
// //设置讲师为登录人
// this.setLecturerId(this.getCreateBy());
//设置初始报名人数为0
this
.
setPersonNumber
(
"0"
);
//设置初始评论人数为0
...
...
src/main/java/org/rcisoft/business/blesson/entity/BLessonPerson.java
View file @
b663b718
...
...
@@ -14,6 +14,7 @@ import javax.persistence.Entity;
import
javax.persistence.Table
;
import
javax.persistence.Transient
;
import
javax.validation.constraints.NotBlank
;
import
java.util.Date
;
@Entity
@Table
(
name
=
"b_lesson_person"
)
...
...
@@ -69,8 +70,11 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
@Length
(
min
=
1
,
max
=
1
,
message
=
"长度最小为1,最大为1"
)
private
String
trainIsSign
;
@ApiModelProperty
(
value
=
"报名日期"
)
private
Date
applyDate
;
@ApiModelProperty
(
value
=
"签到日期"
)
private
String
signDate
;
private
Date
signDate
;
//-----------------------------
@ApiModelProperty
(
value
=
"课程名称"
)
...
...
src/main/java/org/rcisoft/business/blesson/entity/BViewrange.java
View file @
b663b718
...
...
@@ -21,6 +21,5 @@ public class BViewrange extends IdEntity<BViewrange> {
private
String
type
;
}
src/main/java/org/rcisoft/business/blesson/service/BLessonService.java
View file @
b663b718
...
...
@@ -244,4 +244,13 @@ public interface BLessonService{
*/
BLesson
findOneMyTrain
(
CurUser
curUser
,
String
businessId
);
/**
* 单一查询我参加培训的信息
* @param curUser
* @param lessonId
* @return
*/
BLesson
findOneMyTeachTrain
(
CurUser
curUser
,
String
lessonId
);
}
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
b663b718
package
org
.
rcisoft
.
business
.
blesson
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
net.sf.json.JSONArray
;
...
...
@@ -14,6 +15,7 @@ import org.rcisoft.business.blesson.entity.*;
import
org.rcisoft.business.blesson.service.BLessonService
;
import
org.rcisoft.business.blesson.util.recursion
;
import
org.rcisoft.business.blesson.dao.BViewrangeRepository
;
import
org.rcisoft.business.bmaterial.dao.BMaterialRepository
;
import
org.rcisoft.business.bmaterial.entity.BMaterial
;
import
org.rcisoft.common.util.feignDto.*
;
import
org.rcisoft.common.util.outClient.MTCotactApiRequestClient
;
...
...
@@ -75,6 +77,9 @@ public class BLessonServiceImpl implements BLessonService {
@Autowired
private
BTrainFileRepository
bTrainFileRepository
;
@Autowired
private
BMaterialRepository
bMaterialRepository
;
@Autowired
MTCotactApiRequestClient
cotactApiRequestClient
;
...
...
@@ -222,6 +227,8 @@ public class BLessonServiceImpl implements BLessonService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
PersistModel
persist
(
AddLessonDTO
addLessonDTO
)
{
BLesson
model
=
new
BLesson
();
//取出文件集合
List
<
BTrainFile
>
trainFileList
=
addLessonDTO
.
getTrainFileList
();
BeanUtils
.
copyProperties
(
addLessonDTO
,
model
);
int
line
=
0
;
...
...
@@ -306,22 +313,23 @@ public class BLessonServiceImpl implements BLessonService {
//删除原有文件
bTrainFileRepository
.
deleteByLessonId
(
model
.
getBusinessId
());
//获取b_material中已有的URL
List
<
String
>
urls
=
bMaterialRepository
.
materialHaveUrl
(
trainFileList
);
//移除已有URL
// urls.forEach(url->{
//
// });
}
//转换json
if
(
StringUtils
.
isNotEmpty
(
addLessonDTO
.
getTrainFileJson
())){
ObjectMapper
mapper
=
new
ObjectMapper
();
try
{
List
<
BTrainFile
>
bTrainFiles
=
Arrays
.
asList
(
mapper
.
readValue
(
addLessonDTO
.
getTrainFileJson
(),
BTrainFile
[].
class
));
addLessonDTO
.
setTrainFileList
(
bTrainFiles
);
}
catch
(
IOException
e
)
{
log
.
error
(
"JSON格式不正确"
+
e
.
getMessage
());
throw
new
ServiceException
(
ResultServiceEnums
.
JSON_ERROR
);
}
List
<
BTrainFile
>
bTrainFiles
=
JSONObject
.
parseArray
(
addLessonDTO
.
getTrainFileJson
(),
BTrainFile
.
class
);
addLessonDTO
.
setTrainFileList
(
bTrainFiles
);
}
List
<
BMaterial
>
bMaterialList
=
new
ArrayList
<>();
//插入b_train_file表
if
(
addLessonDTO
.
getTrainFileList
()
!=
null
&&
addLessonDTO
.
getTrainFileList
()
.
size
()
>
0
)
{
List
<
BTrainFile
>
trainFileList
=
addLessonDTO
.
getTrainFileList
();
if
(
trainFileList
!=
null
&&
trainFileList
.
size
()
>
0
)
{
for
(
BTrainFile
bTrainFile
:
trainFileList
)
{
bTrainFile
.
setLessonId
(
model
.
getBusinessId
());
UserUtil
.
setCurrentPersistOperation
(
bTrainFile
);
...
...
@@ -338,8 +346,24 @@ public class BLessonServiceImpl implements BLessonService {
bMaterialList
.
add
(
bMaterial
);
}
bTrainFileRepository
.
insertTrainFileList
(
trainFileList
);
//插入资料表
//插入资料表
// BMaterial bMaterial = new BMaterial();
// UserUtil.setCurrentPersistOperation(bMaterial);
// bMaterial.setLessonId(model.getBusinessId());
// bMaterial.setFileName(dto.getFileName());
//
// if (StringUtils.isNotEmpty(dto.getFileTime()) && dto.getFileTime().contains(".")) {
// bMaterial.setFileTime(dto.getFileTime().substring(0, dto.getFileTime().lastIndexOf(".")));
// }
//
// bMaterial.setFileUrl(dto.getVideoUrl());
//
// bMaterial.setType(model.getIsTest());
// bMaterial.setUploadType("1");
// bMaterial.setFileSize(dto.getFileSize());
// bMaterialRepository.insertMaterial(bMaterial);
//
}
return
new
PersistModel
(
line
,
model
);
...
...
@@ -603,11 +627,13 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
ILessonCountDTO
trainPersonCount
(
String
lessonId
)
{
return
bLessonRepository
.
trainPersonCount
(
lessonId
);
}
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
List
<
BLessonPerson
>
trainPersons
(
FindTrainPersonDTO
param
)
{
List
<
BLessonPerson
>
bLessonPersonList
=
bLessonPersonRepository
.
trainPersons
(
param
);
if
(
bLessonPersonList
!=
null
&&
bLessonPersonList
.
size
()>
0
){
...
...
@@ -736,6 +762,7 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
PersistModel
deleteRecommend
(
String
lessonId
)
{
List
<
String
>
recommendIds
=
bRecommendRepository
.
selectIdByLessonId
(
lessonId
);
...
...
@@ -754,6 +781,7 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
PersistModel
setTrainIsSign
(
SetTrainIsSignDTO
setTrainIsSignDTO
)
{
BLessonPerson
bLessonPerson
=
new
BLessonPerson
();
bLessonPerson
.
setBusinessId
(
setTrainIsSignDTO
.
getBusinessId
());
...
...
@@ -764,6 +792,7 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
PersistModel
addCollect
(
CurUser
curUser
,
String
lessonId
)
{
AddMyLearnLessonDTO
param
=
new
AddMyLearnLessonDTO
(
lessonId
,
curUser
.
getCorpId
(),
curUser
.
getUserId
());
List
<
BCollect
>
bLessonPersons
=
bCollectRepository
.
selectByPersonAndLesson
(
param
);
...
...
@@ -784,6 +813,7 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
int
toTraining
(
CurUser
curUser
,
String
lessonId
)
{
BLessonPerson
person
=
new
BLessonPerson
();
BLessonPerson
bLessonPerson
=
new
BLessonPerson
();
...
...
@@ -795,22 +825,49 @@ public class BLessonServiceImpl implements BLessonService {
log
.
info
(
"-----------该培训已报名-------------"
);
return
1
;
}
UserUtil
.
setCurrentMergeOperation
(
person
);
person
.
setTrainIsSign
(
"0"
);
person
.
setApplyDate
(
new
Date
());
person
.
setIsApply
(
"1"
);
return
bLessonPersonRepository
.
update
ByPrimaryKey
(
person
);
return
bLessonPersonRepository
.
update
LessonPersonByUserId
(
person
);
}
else
{
UserUtil
.
setCurrentPersistOperation
(
bLessonPerson
);
bLessonPerson
.
setPersonId
(
curUser
.
getUserId
());
bLessonPerson
.
setLessonId
(
lessonId
);
bLessonPerson
.
setIsAppoint
(
"0"
);
bLessonPerson
.
setIsApply
(
"1"
);
return
bLessonPersonRepository
.
insertSelective
(
bLessonPerson
);
bLessonPerson
.
setTrainIsSign
(
"0"
);
bLessonPerson
.
setApplyDate
(
new
Date
());
bLessonPerson
.
setRemarks
(
""
);
//插入 用户id 、培训id、指派状态、报名状态、培训状态、报名时间 、通用字段
return
bLessonPersonRepository
.
insert
(
bLessonPerson
);
}
}
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
BLesson
findOneMyTrain
(
CurUser
curUser
,
String
businessId
)
{
BLesson
bLesson
=
bLessonRepository
.
findOneMyTrain
(
curUser
,
businessId
);
if
(
bLesson
==
null
){
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_NOT_EXISTA
);
}
int
trainApplyCount
=
bLessonRepository
.
trainApplyCount
(
bLesson
.
getBusinessId
());
if
(
StringUtils
.
isNotEmpty
(
bLesson
.
getMaxApplyPerson
())
&&
trainApplyCount
>=
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())){
bLesson
.
setApplyIsFull
(
"1"
);
}
else
{
bLesson
.
setApplyIsFull
(
"0"
);
}
return
bLesson
;
}
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
BLesson
findOneMyTeachTrain
(
CurUser
curUser
,
String
lessonId
)
{
BLesson
bLesson
=
bLessonRepository
.
findOneMyTeachTrain
(
curUser
,
lessonId
);
if
(
bLesson
==
null
){
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_NOT_EXISTA
);
}
int
trainApplyCount
=
bLessonRepository
.
trainApplyCount
(
bLesson
.
getBusinessId
());
if
(
StringUtils
.
isNotEmpty
(
bLesson
.
getMaxApplyPerson
())
&&
trainApplyCount
>=
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())){
bLesson
.
setApplyIsFull
(
"1"
);
...
...
src/main/java/org/rcisoft/business/bmaterial/dao/BMaterialRepository.java
View file @
b663b718
package
org
.
rcisoft
.
business
.
bmaterial
.
dao
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Param
;
import
org.rcisoft.business.bfile.entity.BTrainFile
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.rcisoft.business.bmaterial.entity.BMaterial
;
import
org.apache.ibatis.annotations.ResultMap
;
...
...
@@ -33,10 +35,10 @@ public interface BMaterialRepository extends BaseMapper<BMaterial> {
@Insert
(
"<script>insert into b_material "
+
" (business_id,chapter_id,file_name,file_url, "
+
" type,upload_type,file_size,flag,del_flag, "
+
" remarks,create_by,update_by,update_date,create_date,file_time) "
+
" remarks,create_by,update_by,update_date,create_date,file_time
,lesson_id
) "
+
" values(#{businessId},#{chapterId},#{fileName},#{fileUrl}, "
+
" #{type},#{uploadType},#{fileSize},#{flag},#{delFlag}, "
+
" #{remarks},#{createBy},#{updateBy},#{updateDate},#{createDate},#{fileTime}) "
+
" #{remarks},#{createBy},#{updateBy},#{updateDate},#{createDate},#{fileTime}
,#{lessonId}
) "
+
"</script>"
)
int
insertMaterial
(
BMaterial
bMaterial
);
...
...
@@ -52,5 +54,14 @@ public interface BMaterialRepository extends BaseMapper<BMaterial> {
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BMaterial
>
queryMyBMaterialByPagination
(
CurUser
curUser
);
@Select
(
"<script>select file_url from b_material "
+
" where 1=1 "
+
" and del_flag != 1 and flag = 1 "
+
" and file_url in "
+
"<foreach item='item' index='index' collection='trainFileList' open='(' separator=',' close=')'> #{item.videoUrl} </foreach> "
+
"</script>"
)
List
<
String
>
materialHaveUrl
(
@Param
(
"trainFileList"
)
List
<
BTrainFile
>
trainFileList
);
}
src/main/java/org/rcisoft/core/util/OfficeToPdf.java
View file @
b663b718
...
...
@@ -8,6 +8,7 @@ import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
import
com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection
;
import
com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.rcisoft.common.component.Global
;
import
org.rcisoft.core.exception.ServiceException
;
import
org.rcisoft.core.result.ResultServiceEnums
;
...
...
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Component;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.ConnectException
;
import
java.util.Date
;
/**
* Created by Administrator on 2018/1/19.
...
...
@@ -84,6 +86,8 @@ public class OfficeToPdf {
* @return 1 成功 0 失败 -1 错误
*/
public
synchronized
int
transformToPdf
(
String
sourceFile
,
String
destFile
){
log
.
debug
(
"****************transform + begin***********"
+
DateFormatUtils
.
format
(
new
Date
(),
"HH:mm:ss"
));
OpenOfficeConnection
connection
=
null
;
try
{
File
inputFile
=
new
File
(
sourceFile
);
...
...
@@ -100,7 +104,12 @@ public class OfficeToPdf {
// connect to an OpenOffice.org instance running on port 8100
connection
=
new
SocketOpenOfficeConnection
(
global
.
getLibreofficeIp
(),
global
.
getLibreofficePort
());
log
.
debug
(
"****************connect + begin***********"
+
DateFormatUtils
.
format
(
new
Date
(),
"HH:mm:ss"
));
connection
.
connect
();
log
.
debug
(
"****************connect + end***********"
+
DateFormatUtils
.
format
(
new
Date
(),
"HH:mm:ss"
));
// convert
log
.
debug
(
"----------ZH------------"
);
DocumentConverter
converter
=
new
OpenOfficeDocumentConverter
(
...
...
@@ -114,6 +123,8 @@ public class OfficeToPdf {
log
.
info
(
"开始转换--> "
+
sourceFile
);
converter
.
convert
(
inputFile
,
inputDocumentFormat
,
outputFile
,
outputDocumentFormat
);
log
.
info
(
"转换完毕--> "
+
destFile
);
log
.
debug
(
"****************transform + end***********"
+
DateFormatUtils
.
format
(
new
Date
(),
"HH:mm:ss"
));
// close the connection
}
catch
(
ConnectException
e
)
{
e
.
printStackTrace
();
...
...
src/main/java/org/rcisoft/sys/role/dao/SysRoleRepository.java
View file @
b663b718
...
...
@@ -29,7 +29,7 @@ public interface SysRoleRepository extends BaseMapper<SysRole> {
*/
@Select
(
"<script>select * from tm_admin_role "
+
"where r_status = 1 "
+
"and r_name not in ('
主管理员','子
管理员') "
+
"and r_name not in ('
超级
管理员') "
+
"and corp_id = #{corpId} "
+
" order by r_name desc </script>"
)
@ResultMap
(
value
=
"SelectAllAndUserNum"
)
...
...
src/main/java/org/rcisoft/sys/user/controller/SysUserController.java
View file @
b663b718
...
...
@@ -38,9 +38,7 @@ import java.time.Instant;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.*
;
/**
* Created by Andrew on 2017/7/6.
...
...
@@ -96,10 +94,13 @@ public class SysUserController extends PaginationController<SysUser> {
@PostMapping
(
value
=
"/AssignRoles"
)
public
Result
AssignRoles
(
CurUser
curUser
,
@Valid
String
id
,
BindingResult
br
,
String
roleId
)
{
int
line
=
userServiceImpl
.
AssignRoles
(
id
,
roleId
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"roleIds"
,
roleId
);
map
.
put
(
"userIds"
,
id
);
return
Result
.
builder
(
new
PersistModel
(
line
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
id
);
map
);
}
// @ApiOperation(value = "703 删除用户", notes = "删除用户")
...
...
src/main/java/org/rcisoft/sys/user/service/impl/SysUserServiceImpl.java
View file @
b663b718
...
...
@@ -58,6 +58,17 @@ public class SysUserServiceImpl implements SysUserService {
@Override
public
List
<
SysUser
>
queryUsersByPagination
(
PageUtil
pageUtil
,
QuerySysUserDTO
dto
)
{
List
<
SysUser
>
users
=
this
.
qusers
(
dto
);
return
users
;
}
/**
* 添加用户对应的 部门和岗位
* @param dto
* @return
*/
public
List
<
SysUser
>
qusers
(
QuerySysUserDTO
dto
){
List
<
SysUser
>
users
=
sysUserMapper
.
queryUsers
(
dto
);
List
<
String
>
list
=
new
ArrayList
<>();
for
(
SysUser
user
:
users
)
{
...
...
@@ -89,7 +100,7 @@ public class SysUserServiceImpl implements SysUserService {
}
}
//部门不为空时 部门条件过滤
if
(
dto
.
getDept
()
!=
null
)
{
if
(
dto
.
getDept
()
!=
null
)
{
List
<
SysUser
>
usersForDept
=
new
ArrayList
<>();
for
(
SysUser
user
:
users
)
{
if
(
user
.
getDepart
().
equals
(
dto
.
getDept
()))
{
...
...
@@ -99,8 +110,7 @@ public class SysUserServiceImpl implements SysUserService {
return
usersForDept
;
}
return
users
;
return
users
;
}
@Override
...
...
@@ -114,31 +124,35 @@ public class SysUserServiceImpl implements SysUserService {
@Override
public
int
AssignRoles
(
String
userId
,
String
roleId
)
{
List
<
String
>
adminRoleName
=
asList
(
"主管理员"
,
"子管理员"
);
List
<
String
>
adminRoleName
=
asList
(
"超级管理员"
);
//查询超级管理员角色的userid
List
<
String
>
adminIds
=
sysUserMapper
.
adminId
(
adminRoleName
);
//将超级管理员人员userid 从String[]中剔除
if
(
adminIds
.
size
()
!=
0
)
{
for
(
int
i
=
0
;
i
<
adminIds
.
size
();
i
++)
{
userId
=
userId
.
replace
(
adminIds
.
get
(
i
),
""
);
}
List
<
String
>
userIds
=
asList
(
StringUtils
.
split
(
userId
,
","
));
List
<
String
>
roleIds
=
asList
(
StringUtils
.
split
(
roleId
,
","
));
List
<
UserRole
>
userRoles
=
new
ArrayList
<>();
sysUserMapper
.
delUserRoleById
(
userIds
);
int
result
=
0
;
for
(
int
i
=
0
;
i
<
roleIds
.
size
();
i
++)
{
for
(
int
j
=
0
;
j
<
userIds
.
size
();
j
++)
{
UserRole
userRole
=
new
UserRole
();
userRole
.
setUserId
(
userIds
.
get
(
j
));
userRole
.
setRoleId
(
roleIds
.
get
(
i
));
UserUtil
.
setCurrentPersistOperation
(
userRole
);
userRoles
.
add
(
userRole
);
}
}
List
<
String
>
userIds
=
asList
(
StringUtils
.
split
(
userId
,
","
));
List
<
String
>
roleIds
=
asList
(
StringUtils
.
split
(
roleId
,
","
));
List
<
UserRole
>
userRoles
=
new
ArrayList
<>();
//清空userrole中关于ids的所有数据
sysUserMapper
.
delUserRoleById
(
userIds
);
int
result
=
0
;
for
(
int
i
=
0
;
i
<
roleIds
.
size
();
i
++)
{
for
(
int
j
=
0
;
j
<
userIds
.
size
();
j
++)
{
UserRole
userRole
=
new
UserRole
();
userRole
.
setUserId
(
userIds
.
get
(
j
));
userRole
.
setRoleId
(
roleIds
.
get
(
i
));
UserUtil
.
setCurrentPersistOperation
(
userRole
);
userRoles
.
add
(
userRole
);
}
result
=
sysUserMapper
.
insertUserRoleById
(
userRoles
);
return
result
;
}
return
0
;
result
=
sysUserMapper
.
insertUserRoleById
(
userRoles
);
return
result
;
}
@Override
...
...
src/main/resources/mapper/business/blesson/mapper/BLessonPersonMapper.xml
View file @
b663b718
...
...
@@ -40,6 +40,7 @@
<result
column=
"is_apply"
jdbcType=
"VARCHAR"
property=
"isApply"
/>
<result
column=
"train_is_sign"
jdbcType=
"VARCHAR"
property=
"trainIsSign"
/>
<result
column=
"apply_date"
jdbcType=
"VARCHAR"
property=
"applyDate"
/>
<result
column=
"sign_date"
jdbcType=
"VARCHAR"
property=
"signDate"
/>
</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