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
a1b3409d
Commit
a1b3409d
authored
Oct 21, 2019
by
zhangqingle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件转换
parent
0cee8cb3
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
384 additions
and
90 deletions
+384
-90
BChapterController.java
...soft/business/bchapter/controller/BChapterController.java
+48
-0
BChapterService.java
...rg/rcisoft/business/bchapter/service/BChapterService.java
+9
-0
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+105
-4
BFileRepository.java
.../java/org/rcisoft/business/bfile/dao/BFileRepository.java
+2
-2
BFile.java
src/main/java/org/rcisoft/business/bfile/entity/BFile.java
+5
-0
BCollectRepository.java
.../org/rcisoft/business/blesson/dao/BCollectRepository.java
+43
-0
BLessonRepository.java
...a/org/rcisoft/business/blesson/dao/BLessonRepository.java
+3
-2
FindLessonRecommendDTO.java
.../rcisoft/business/blesson/dto/FindLessonRecommendDTO.java
+2
-1
BCollect.java
...in/java/org/rcisoft/business/blesson/entity/BCollect.java
+31
-0
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+26
-16
ContactFeignClient.java
...g/rcisoft/common/util/feignClient/ContactFeignClient.java
+1
-1
FindDepartByNameDTO.java
...org/rcisoft/common/util/feignDto/FindDepartByNameDTO.java
+26
-0
MTCotactApiRequestClient.java
...isoft/common/util/outClient/MTCotactApiRequestClient.java
+62
-62
ResultServiceEnums.java
...main/java/org/rcisoft/core/result/ResultServiceEnums.java
+2
-1
application-mt.yml
src/main/resources/application-mt.yml
+1
-1
BCollectMapper.xml
...sources/mapper/business/blesson/mapper/BCollectMapper.xml
+18
-0
No files found.
src/main/java/org/rcisoft/business/bchapter/controller/BChapterController.java
View file @
a1b3409d
...
...
@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiImplicitParams;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.map.HashedMap
;
import
org.apache.commons.lang3.StringUtils
;
import
org.rcisoft.business.bchapter.dto.QueryChapterListDTO
;
import
org.rcisoft.business.bchapter.dto.QueryChapterListResDTO
;
import
org.rcisoft.business.bchapter.dto.QueryScoreListDTO
;
...
...
@@ -37,7 +38,9 @@ import org.springframework.web.bind.annotation.*;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
import
java.io.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -121,6 +124,51 @@ public class BChapterController extends PaginationController<BChapter> {
bChapterService
.
queryBChaptersWithProgress
(
lessonId
,
curUser
));
}
@RequestMapping
(
"/getFile"
)
@ApiOperation
(
value
=
"206 流 输出ppt转为pdf"
,
notes
=
"流 输出ppt转为pdf"
,
response
=
QueryChapterListResDTO
.
class
)
public
Result
getFile
(
CurUser
curUser
,
@RequestParam
String
chapterId
,
BindingResult
br
,
HttpServletRequest
request
,
HttpServletResponse
response
)
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
,
newFileUrl
);
}
// @ApiOperation(value = "206 获取uuid", notes = "获取uuid用于添加章节时使用")
// @PostMapping(value = "/getid")
// public Result getUuid() {
...
...
src/main/java/org/rcisoft/business/bchapter/service/BChapterService.java
View file @
a1b3409d
...
...
@@ -10,6 +10,8 @@ import org.rcisoft.core.aop.PageUtil;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.sys.user.bean.CurUser
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -74,6 +76,13 @@ public interface BChapterService{
*/
PersistModel
removeBChapter
(
String
id
);
/**
* 逻辑删除
* @param chapterId
* @return
*/
String
changeFileToPdf
(
String
chapterId
);
/**
* 打分
* @param scoreInfoDTOS
...
...
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
a1b3409d
...
...
@@ -2,6 +2,7 @@ package org.rcisoft.business.bchapter.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
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.rcisoft.business.bchapter.dao.BChapterRepository
;
...
...
@@ -32,6 +33,7 @@ import org.rcisoft.core.exception.ServiceException;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.result.ResultServiceEnums
;
import
org.rcisoft.core.util.IdGen
;
import
org.rcisoft.core.util.OfficeToPdf
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.sys.user.bean.CurUser
;
import
org.rcisoft.sys.user.dao.SysUserMapper
;
...
...
@@ -40,7 +42,11 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
...
...
@@ -54,6 +60,7 @@ import java.util.Map;
/**
* Created by gwf on 2017-7-21 15:08:47.
*/
@Slf4j
@Service
@Transactional
(
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
class
BChapterServiceImpl
implements
BChapterService
{
...
...
@@ -77,6 +84,8 @@ public class BChapterServiceImpl implements BChapterService {
BLessonPersonRepository
bLessonPersonRepository
;
@Autowired
MTCotactApiRequestClient
mtCotactApiRequestClient
;
@Autowired
OfficeToPdf
officeToPdf
;
@Override
public
BChapter
selectOne
(
String
businessId
)
{
...
...
@@ -164,14 +173,14 @@ public class BChapterServiceImpl implements BChapterService {
public
PersistModel
persist
(
BChapter
model
,
String
corpId
,
uploadDTO
dto
)
{
int
line
=
0
;
BFile
bFile
=
new
BFile
();
if
(
"2"
.
equals
(
dto
.
getType
())||
"4"
.
equals
(
dto
.
getType
())){
mtCotactApiRequestClient
.
fileChange
(
dto
);
}
//
if ("2".equals(dto.getType())||"4".equals(dto.getType())){
//
mtCotactApiRequestClient.fileChange(dto);
//
}
bFile
.
setFileName
(
dto
.
getFileName
());
bFile
.
setVideoUrl
(
dto
.
getVideoUrl
());
//--------------
bFile
.
setType
(
dto
.
getType
());
bFile
.
setFileSize
(
dto
.
getFileSize
());
if
(
model
.
getBusinessId
()
==
null
)
{
UserUtil
.
setCurrentPersistOperation
(
model
);
...
...
@@ -244,6 +253,98 @@ public class BChapterServiceImpl implements BChapterService {
return
new
PersistModel
(
line
);
}
@Override
public
String
changeFileToPdf
(
String
chapterId
)
{
//1. 获取文件信息
BFile
bFile
=
bFileRepository
.
selectInfoByChapterId
(
chapterId
);
String
filePath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()+
"/"
+
global
.
getTEMP_LOCATION
()+
"/"
+
bFile
.
getLessonId
();
File
file
=
new
File
(
filePath
);
//2. pdf 本地是否存在, word ppt 转换后的pdf是否存在
File
fileOld
=
new
File
(
filePath
+
"/"
+
bFile
.
getFileName
());
String
newName
=
bFile
.
getFileName
().
substring
(
0
,
bFile
.
getFileName
().
indexOf
(
"."
))+
"-pdf.pdf"
;
//转换后的路径
File
fileNew
=
new
File
(
filePath
+
"/"
+
newName
);
if
(
"3"
.
equals
(
bFile
.
getType
())){
if
(
fileOld
.
exists
()){
return
filePath
+
"/"
+
bFile
.
getFileName
();
}
else
{
return
downLoadFile
(
bFile
,
file
,
filePath
);
}
}
//3. pdf不存在,下载 , 删除word ppt,重新下载,转换
if
(
"2"
.
equals
(
bFile
.
getType
())
||
"4"
.
equals
(
bFile
.
getType
())){
if
(
fileNew
.
exists
()){
return
filePath
+
"/"
+
newName
;
}
else
{
fileOld
.
delete
();
String
downLoadFileUrl
=
downLoadFile
(
bFile
,
file
,
filePath
);
int
result
=
officeToPdf
.
transformToPdf
(
downLoadFileUrl
,
filePath
+
"/"
+
newName
);
if
(
result
<
1
){
log
.
error
(
"文件转换异常"
);
throw
new
ServiceException
(
ResultServiceEnums
.
CHANGE_FILE_ERROR
);
}
//4. 更新在 bfile 表 , ppt和word 存一下转换之后的url filePath
bFile
.
setFileUrl
(
filePath
+
"/"
+
newName
);
bFileRepository
.
updateByPrimaryKeySelective
(
bFile
);
return
filePath
+
"/"
+
newName
;
}
}
else
{
return
null
;
}
}
//下载
public
String
downLoadFile
(
BFile
bFile
,
File
file
,
String
filePath
){
//判断文件夹是否存在
if
(!
file
.
exists
())
{
//如果文件夹不存在,则创建新的的文件夹
file
.
mkdirs
();
}
FileOutputStream
fileOut
=
null
;
HttpURLConnection
conn
=
null
;
InputStream
inputStream
=
null
;
try
{
// 建立链接
URL
httpUrl
=
new
URL
(
bFile
.
getVideoUrl
());
conn
=(
HttpURLConnection
)
httpUrl
.
openConnection
();
//以Post方式提交表单,默认get方式
conn
.
setRequestMethod
(
"GET"
);
conn
.
setDoInput
(
true
);
conn
.
setDoOutput
(
true
);
// post方式不能使用缓存
conn
.
setUseCaches
(
false
);
//连接指定的资源
conn
.
connect
();
//获取网络输入流
inputStream
=
conn
.
getInputStream
();
BufferedInputStream
bis
=
new
BufferedInputStream
(
inputStream
);
//判断文件的保存路径后面是否以/结尾
if
(!
filePath
.
endsWith
(
"/"
))
{
filePath
+=
"/"
;
}
//写入到文件(注意文件保存路径的后面一定要加上文件的名称)
fileOut
=
new
FileOutputStream
(
filePath
+
bFile
.
getFileName
());
BufferedOutputStream
bos
=
new
BufferedOutputStream
(
fileOut
);
byte
[]
buf
=
new
byte
[
4096
];
int
length
=
bis
.
read
(
buf
);
//保存文件
while
(
length
!=
-
1
)
{
bos
.
write
(
buf
,
0
,
length
);
length
=
bis
.
read
(
buf
);
}
bos
.
close
();
bis
.
close
();
conn
.
disconnect
();
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
()
+
"下载文件异常"
);
throw
new
ServiceException
(
ResultServiceEnums
.
DOWNLOAD_ERROR
);
}
return
filePath
+
bFile
.
getFileName
();
}
@Override
@Transactional
public
void
markScore
(
List
<
ScoreInfoDTO
>
scoreInfoDTOS
)
{
...
...
src/main/java/org/rcisoft/business/bfile/dao/BFileRepository.java
View file @
a1b3409d
...
...
@@ -56,8 +56,8 @@ public interface BFileRepository extends BaseMapper<BFile> {
* @return
*/
@Insert
(
"INSERT INTO `b_file` "
+
"(business_id,lesson_id,chapter_id,file_name,video_url,file_url,type,flag,del_flag,remarks,create_by,update_by,update_date,create_date) "
+
"VALUES (#{businessId}, #{lessonId}, #{chapterId}, #{fileName}, #{videoUrl}, #{fileUrl}, #{type}, #{flag}, #{delFlag}, #{remarks}, #{createBy}, #{updateBy}, #{updateDate}, #{createDate})"
)
"(business_id,lesson_id,chapter_id,file_name,video_url,file_url,type,flag,del_flag,remarks,create_by,update_by,update_date,create_date
,file_size
) "
+
"VALUES (#{businessId}, #{lessonId}, #{chapterId}, #{fileName}, #{videoUrl}, #{fileUrl}, #{type}, #{flag}, #{delFlag}, #{remarks}, #{createBy}, #{updateBy}, #{updateDate}, #{createDate}
,#{fileSize}
)"
)
int
insertUploadFile
(
BFile
bFile
);
...
...
src/main/java/org/rcisoft/business/bfile/entity/BFile.java
View file @
a1b3409d
...
...
@@ -46,5 +46,10 @@ public class BFile extends IdEntity<BFile> {
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
@NotBlank
private
String
chapterId
;
//节ID
//文件大小
@Length
(
min
=
1
,
max
=
15
,
message
=
"长度最小为1,最大为15"
)
private
String
fileSize
;
}
src/main/java/org/rcisoft/business/blesson/dao/BCollectRepository.java
0 → 100644
View file @
a1b3409d
package
org
.
rcisoft
.
business
.
blesson
.
dao
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.blesson.dto.AddMyLearnLessonDTO
;
import
org.rcisoft.business.blesson.entity.BCollect
;
import
org.rcisoft.business.blesson.entity.BLessonPerson
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* Created with on 2019-10-20 22:52:29.
*/
@Repository
public
interface
BCollectRepository
extends
BaseMapper
<
BCollect
>
{
/**
* 分页查询 bCollect
*
*/
@Select
(
"<script>select * from b_collect where 1=1 "
+
"<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+
"<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BCollect
>
queryBCollects
(
BCollect
bCollect
);
/**
* 根据课程id PersonId查询
*/
@Select
(
"<script>select * from b_collect where 1=1 "
+
"and del_flag = 0 and flag = 1 "
+
"AND person_id = #{userId} "
+
"and lesson_id = #{lessonId}</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BCollect
>
selectByPersonAndLesson
(
AddMyLearnLessonDTO
param
);
}
src/main/java/org/rcisoft/business/blesson/dao/BLessonRepository.java
View file @
a1b3409d
...
...
@@ -419,6 +419,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" <set>"
,
" <if test='updateBy != null'>update_by=#{updateBy},</if>"
,
" <if test='updateDate != null'>update_date=#{updateDate},</if>"
,
" <if test='releaseDate != null'>release_date=#{releaseDate},</if>"
,
" release_state = '2'"
,
" </set>"
,
"where business_id=#{businessId}"
,
...
...
@@ -527,9 +528,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
* @return
*/
@Update
(
"<script>update b_lesson set collect_number = "
+
"(select count(1) from b_
lesson_person
where 1=1 "
+
"(select count(1) from b_
collect
where 1=1 "
+
" and del_flag != 1 and flag = 1 "
+
" and is_collect = '1' "
+
//
" and is_collect = '1' " +
" and lesson_id = #{lessonId})"
+
" where business_id = #{lessonId} </script>"
)
int
collectNumberReCount
(
String
lessonId
);
...
...
src/main/java/org/rcisoft/business/blesson/dto/FindLessonRecommendDTO.java
View file @
a1b3409d
...
...
@@ -3,6 +3,7 @@ package org.rcisoft.business.blesson.dto;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.rcisoft.common.util.feignDto.DeptGetRspDTO
;
import
org.rcisoft.common.util.feignDto.FindDepartByNameDTO
;
import
java.util.List
;
...
...
@@ -15,7 +16,7 @@ public class FindLessonRecommendDTO {
@ApiModelProperty
(
value
=
"课程Id"
,
required
=
true
)
private
String
lessonId
;
private
List
<
DeptGetRsp
DTO
>
departs
;
private
List
<
FindDepartByName
DTO
>
departs
;
private
String
userId
;
...
...
src/main/java/org/rcisoft/business/blesson/entity/BCollect.java
0 → 100644
View file @
a1b3409d
package
org
.
rcisoft
.
business
.
blesson
.
entity
;
import
lombok.*
;
import
org.rcisoft.core.entity.IdEntity
;
import
javax.persistence.*
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* Created with on 2019-10-20 22:52:29.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"b_collect"
)
public
class
BCollect
extends
IdEntity
<
BCollect
>
{
private
String
personId
;
private
String
lessonId
;
}
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
a1b3409d
...
...
@@ -10,10 +10,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.common.util.feignDto.DeptGetRspDTO
;
import
org.rcisoft.common.util.feignDto.GetAllRspDTO
;
import
org.rcisoft.common.util.feignDto.MTUserGetsReqDTO
;
import
org.rcisoft.common.util.feignDto.MTUserInfoRspDTO
;
import
org.rcisoft.common.util.feignDto.*
;
import
org.rcisoft.common.util.outClient.MTCotactApiRequestClient
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.constant.MessageConstant
;
...
...
@@ -66,6 +63,9 @@ public class BLessonServiceImpl implements BLessonService {
@Autowired
private
BAppointRepository
bAppointRepository
;
@Autowired
private
BCollectRepository
bCollectRepository
;
@Autowired
MTCotactApiRequestClient
cotactApiRequestClient
;
...
...
@@ -343,6 +343,7 @@ public class BLessonServiceImpl implements BLessonService {
BLesson
bLesson
=
new
BLesson
();
bLesson
.
setBusinessId
(
id
);
bLesson
.
setReleaseDate
(
new
Date
());
UserUtil
.
setCurrentMergeOperation
(
bLesson
);
int
line
=
bLessonRepository
.
releaseLesson
(
bLesson
);
//int line = bLessonRepository.deleteByPrimaryKey(id);
...
...
@@ -411,7 +412,7 @@ public class BLessonServiceImpl implements BLessonService {
// if (StringUtils.isEmpty(param.getViewParam())){
// param.setViewParam("");
// }
List
<
DeptGetRsp
DTO
>
departs
=
cotactApiRequestClient
.
deptListDeptInfoByName
(
param
.
getCorpId
(),
param
.
getViewParam
());
List
<
FindDepartByName
DTO
>
departs
=
cotactApiRequestClient
.
deptListDeptInfoByName
(
param
.
getCorpId
(),
param
.
getViewParam
());
//查询结果放入DTO中
param
.
setDeparts
(
departs
);
//查询该课程推荐的所有人
...
...
@@ -420,7 +421,7 @@ public class BLessonServiceImpl implements BLessonService {
List
<
FindLessonRecommendRspDTO
>
findLessonDepartRecommend
=
bRecommendRepository
.
queryRecommendDepartByLessonId
(
param
);
if
(
departs
!=
null
&&
departs
.
size
()
>
0
&&
findLessonDepartRecommend
!=
null
&&
findLessonDepartRecommend
.
size
()
>
0
){
for
(
DeptGetRsp
DTO
depart
:
departs
)
{
for
(
FindDepartByName
DTO
depart
:
departs
)
{
for
(
FindLessonRecommendRspDTO
findLessonRecommendRspDTO
:
findLessonDepartRecommend
)
{
if
(
depart
.
getId
().
equals
(
findLessonRecommendRspDTO
.
getTargetId
())){
findLessonRecommendRspDTO
.
setTargetName
(
depart
.
getName
());
...
...
@@ -589,16 +590,19 @@ public class BLessonServiceImpl implements BLessonService {
if
(
"1"
.
equals
(
role
.
getType
()))
{
isAdmin
=
true
;
break
;
}
else
if
(
"2"
.
equals
(
role
.
getType
()))
{
}
else
if
(
"2"
.
equals
(
role
.
getType
())
&&
StringUtils
.
isNotEmpty
(
role
.
getDeparts
())
)
{
List
<
String
>
departs
=
asList
(
StringUtils
.
split
(
role
.
getDeparts
(),
","
));
departIds
.
addAll
(
departs
);
// 调用 feign 获取当前部门及子部门 --->所有人
// uids.addAll(Arrays.asList(new CurUser(), new CurUser()));
}
}
List
<
GetAllRspDTO
>
GetAllRspDTOList
=
cotactApiRequestClient
.
getUserByDeptIdSet
(
corpId
,
departIds
);
for
(
GetAllRspDTO
getAllRspDTO
:
GetAllRspDTOList
)
{
uids
.
add
(
getAllRspDTO
.
getId
());
if
(!
GetAllRspDTOList
.
isEmpty
()){
for
(
GetAllRspDTO
getAllRspDTO
:
GetAllRspDTOList
)
{
uids
.
add
(
getAllRspDTO
.
getId
());
}
}
//自己
uids
.
add
(
userId
);
...
...
@@ -628,13 +632,19 @@ public class BLessonServiceImpl implements BLessonService {
@Override
public
PersistModel
addCollect
(
CurUser
curUser
,
String
lessonId
)
{
AddMyLearnLessonDTO
param
=
new
AddMyLearnLessonDTO
(
lessonId
,
curUser
.
getCorpId
(),
curUser
.
getUserId
());
List
<
BLessonPerson
>
bLessonPersons
=
bLessonPersonRepository
.
selectByPersonAndLesson
(
param
);
if
(
bLessonPersons
==
null
||
bLessonPersons
.
size
()<
1
){
throw
new
ServiceException
(
ResultServiceEnums
.
B_R_SL_STUDENT_NOT_EXISTS
);
}
BLessonPerson
bLessonPerson
=
bLessonPersons
.
get
(
0
);
bLessonPerson
.
setIsCollect
(
"1"
);
int
line
=
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
bLessonPerson
);
List
<
BCollect
>
bLessonPersons
=
bCollectRepository
.
selectByPersonAndLesson
(
param
);
// if (bLessonPersons != null && bLessonPersons.size()>0){
// BLessonPerson bLessonPerson = bLessonPersons.get(0);
// bLessonPerson.setIsCollect("1");
// bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
// }
//插入收藏表
BCollect
bCollect
=
new
BCollect
();
UserUtil
.
setCurrentPersistOperation
(
bCollect
);
bCollect
.
setLessonId
(
lessonId
);
bCollect
.
setPersonId
(
curUser
.
getUserId
());
int
line
=
bCollectRepository
.
insertSelective
(
bCollect
);
//重新同级课程收藏数
bLessonRepository
.
collectNumberReCount
(
lessonId
);
return
new
PersistModel
(
line
);
}
...
...
src/main/java/org/rcisoft/common/util/feignClient/ContactFeignClient.java
View file @
a1b3409d
...
...
@@ -198,7 +198,7 @@ public interface ContactFeignClient {
* 通过名称模糊搜索部门列表
*/
@RequestMapping
(
value
=
"/dept/list_dept_info_by_name"
,
method
=
RequestMethod
.
GET
)
Ret
<
List
<
DeptGetRsp
DTO
>>
deptListDeptInfoByName
(
@RequestParam
(
"corpId"
)
String
corpId
,
Ret
<
List
<
FindDepartByName
DTO
>>
deptListDeptInfoByName
(
@RequestParam
(
"corpId"
)
String
corpId
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"zxClientType"
)
String
zxClientType
,
@RequestParam
(
"zxAccountId"
)
Long
zxAccountId
);
...
...
src/main/java/org/rcisoft/common/util/feignDto/FindDepartByNameDTO.java
0 → 100644
View file @
a1b3409d
package
org
.
rcisoft
.
common
.
util
.
feignDto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.core.annotation.Order
;
@Data
public
class
FindDepartByNameDTO
{
@ApiModelProperty
(
value
=
"企业部门id"
,
position
=
0
)
@Order
(
0
)
private
String
id
;
@ApiModelProperty
(
value
=
"名称"
,
position
=
3
)
@Order
(
3
)
private
String
name
;
@ApiModelProperty
(
value
=
"部门人数"
,
position
=
11
)
@Order
(
11
)
private
int
userCnt
;
@ApiModelProperty
(
value
=
"是否有子部门"
,
position
=
36
)
@Order
(
37
)
private
String
flag
;
}
src/main/java/org/rcisoft/common/util/outClient/MTCotactApiRequestClient.java
View file @
a1b3409d
...
...
@@ -460,67 +460,67 @@ public class MTCotactApiRequestClient {
* 文件转换
*/
public
List
<
UserGetPageListByDeptRspDTO
>
fileChange
(
uploadDTO
dto
)
{
if
(
"dev"
.
equalsIgnoreCase
(
serverType
)){
//下载
String
filePath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()+
"/"
+
global
.
getTEMP_LOCATION
();
File
file
=
new
File
(
filePath
);
//判断文件夹是否存在
if
(!
file
.
exists
())
{
//如果文件夹不存在,则创建新的的文件夹
file
.
mkdirs
();
}
FileOutputStream
fileOut
=
null
;
HttpURLConnection
conn
=
null
;
InputStream
inputStream
=
null
;
try
{
// 建立链接
URL
httpUrl
=
new
URL
(
dto
.
getVideoUrl
());
conn
=(
HttpURLConnection
)
httpUrl
.
openConnection
();
//以Post方式提交表单,默认get方式
conn
.
setRequestMethod
(
"GET"
);
conn
.
setDoInput
(
true
);
conn
.
setDoOutput
(
true
);
// post方式不能使用缓存
conn
.
setUseCaches
(
false
);
//连接指定的资源
conn
.
connect
();
//获取网络输入流
inputStream
=
conn
.
getInputStream
();
BufferedInputStream
bis
=
new
BufferedInputStream
(
inputStream
);
//判断文件的保存路径后面是否以/结尾
if
(!
filePath
.
endsWith
(
"/"
))
{
filePath
+=
"/"
;
}
//写入到文件(注意文件保存路径的后面一定要加上文件的名称)
fileOut
=
new
FileOutputStream
(
filePath
+
dto
.
getFileName
());
BufferedOutputStream
bos
=
new
BufferedOutputStream
(
fileOut
);
byte
[]
buf
=
new
byte
[
4096
];
int
length
=
bis
.
read
(
buf
);
//保存文件
while
(
length
!=
-
1
)
{
bos
.
write
(
buf
,
0
,
length
);
length
=
bis
.
read
(
buf
);
}
bos
.
close
();
bis
.
close
();
conn
.
disconnect
();
}
catch
(
Exception
e
)
{
log
.
info
(
"抛出异常"
);
throw
new
ServiceException
(
ResultServiceEnums
.
DOWNLOAD_ERROR
);
}
//------------------文件转换------------------
//----------------------------------------------
//文件上传
// contactFeignClient.userSearchByName
}
//
if("dev".equalsIgnoreCase(serverType)){
//
//下载
//
String filePath = global.getBASE_UPLOAD_SERVER_LOCATION()+"/"+global.getTEMP_LOCATION();
//
File file=new File(filePath);
//
//判断文件夹是否存在
//
if (!file.exists()) {
//
//如果文件夹不存在,则创建新的的文件夹
//
file.mkdirs();
//
}
//
FileOutputStream fileOut = null;
//
HttpURLConnection conn = null;
//
InputStream inputStream = null;
//
try
//
{
//
// 建立链接
//
URL httpUrl=new URL(dto.getVideoUrl());
//
conn=(HttpURLConnection) httpUrl.openConnection();
//
//以Post方式提交表单,默认get方式
//
conn.setRequestMethod("GET");
//
conn.setDoInput(true);
//
conn.setDoOutput(true);
//
// post方式不能使用缓存
//
conn.setUseCaches(false);
//
//连接指定的资源
//
conn.connect();
//
//获取网络输入流
//
inputStream=conn.getInputStream();
//
BufferedInputStream bis = new BufferedInputStream(inputStream);
//
//判断文件的保存路径后面是否以/结尾
//
if (!filePath.endsWith("/")) {
//
filePath += "/";
//
}
//
//写入到文件(注意文件保存路径的后面一定要加上文件的名称)
//
fileOut = new FileOutputStream(filePath+dto.getFileName());
//
BufferedOutputStream bos = new BufferedOutputStream(fileOut);
//
byte[] buf = new byte[4096];
//
int length = bis.read(buf);
//
//保存文件
//
while(length != -1)
//
{
//
bos.write(buf, 0, length);
//
length = bis.read(buf);
//
}
//
bos.close();
//
bis.close();
//
conn.disconnect();
//
} catch (Exception e)
//
{
//
log.info("抛出异常");
//
throw new ServiceException(ResultServiceEnums.DOWNLOAD_ERROR);
//
}
//
//------------------文件转换------------------
//
//
//
//----------------------------------------------
//
//文件上传
//
//
contactFeignClient.userSearchByName
//
//
//
//
}
return
null
;
}
...
...
@@ -575,7 +575,7 @@ public class MTCotactApiRequestClient {
return
contactFeignClient
.
getUserByDeptIds
(
getUserByDeptIdReqDTO
,
zxClientType
,
zxAccountId
).
getData
();
}
public
List
<
DeptGetRsp
DTO
>
deptListDeptInfoByName
(
String
corpId
,
String
name
){
public
List
<
FindDepartByName
DTO
>
deptListDeptInfoByName
(
String
corpId
,
String
name
){
return
contactFeignClient
.
deptListDeptInfoByName
(
corpId
,
name
,
zxClientType
,
zxAccountId
).
getData
();
}
...
...
src/main/java/org/rcisoft/core/result/ResultServiceEnums.java
View file @
a1b3409d
...
...
@@ -217,7 +217,8 @@ public enum ResultServiceEnums {
APPOINT_NOT_CANCEL
(
116
,
"该课程不能取消指派"
),
INVALID_PARAMETER_VALUE
(
117
,
"参数值无效"
),
NOT_RECOMMEND
(
118
,
"该课程未推荐"
),
NO_DATA
(
4011
,
"该数据不存在"
),
NO_DATA
(
119
,
"该数据不存在"
),
CHANGE_FILE_ERROR
(
120
,
"文件转换失败"
),
;
...
...
src/main/resources/application-mt.yml
View file @
a1b3409d
...
...
@@ -89,7 +89,7 @@ global:
cut_pdf_num
:
30
libreoffice
:
ip
:
192.168.1.125
ip
:
mt_office
port
:
10188
mt
:
api
:
http://221.239.114.20:6789/api/
...
...
src/main/resources/mapper/business/blesson/mapper/BCollectMapper.xml
0 → 100644
View file @
a1b3409d
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"org.rcisoft.business.blesson.dao.BCollectRepository"
>
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.blesson.entity.BCollect"
>
<id
column=
"business_id"
jdbcType=
"VARCHAR"
property=
"businessId"
/>
<result
column=
"create_by"
jdbcType=
"VARCHAR"
property=
"createBy"
/>
<result
column=
"create_date"
jdbcType=
"TIMESTAMP"
property=
"createDate"
/>
<result
column=
"update_by"
jdbcType=
"VARCHAR"
property=
"updateBy"
/>
<result
column=
"update_date"
jdbcType=
"TIMESTAMP"
property=
"updateDate"
/>
<result
column=
"del_flag"
jdbcType=
"VARCHAR"
property=
"delFlag"
/>
<result
column=
"flag"
jdbcType=
"VARCHAR"
property=
"flag"
/>
<result
column=
"remarks"
jdbcType=
"VARCHAR"
property=
"remarks"
/>
<result
column=
"person_id"
jdbcType=
"VARCHAR"
property=
"personId"
/>
<result
column=
"lesson_id"
jdbcType=
"VARCHAR"
property=
"lessonId"
/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
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