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
9a1d1453
Commit
9a1d1453
authored
Sep 20, 2019
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复端口异常
parent
c3941d9a
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
192 additions
and
29 deletions
+192
-29
BFileServiceImpl.java
...rcisoft/business/bfile/service/impl/BFileServiceImpl.java
+1
-1
BLessonController.java
...cisoft/business/blesson/controller/BLessonController.java
+13
-12
BLesson.java
...ain/java/org/rcisoft/business/blesson/entity/BLesson.java
+6
-6
BLessonPersonController.java
...ess/blessonperson/controller/BLessonPersonController.java
+7
-3
SlTask.java
src/main/java/org/rcisoft/business/bsl/task/SlTask.java
+7
-0
UserController.java
...in/java/org/rcisoft/common/controller/UserController.java
+25
-7
MessageConstant.java
src/main/java/org/rcisoft/core/constant/MessageConstant.java
+3
-0
OfficeToPdf.java
src/main/java/org/rcisoft/core/util/OfficeToPdf.java
+130
-0
No files found.
src/main/java/org/rcisoft/business/bfile/service/impl/BFileServiceImpl.java
View file @
9a1d1453
This diff is collapsed.
Click to expand it.
src/main/java/org/rcisoft/business/blesson/controller/BLessonController.java
View file @
9a1d1453
...
...
@@ -157,22 +157,23 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiImplicitParam
(
name
=
"classHour"
,
value
=
"课时"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"credits"
,
value
=
"学分"
,
required
=
false
,
dataType
=
"varchar"
)})
@GetMapping
(
value
=
"/queryBLessonsByPagination"
)
// public GridModel queryBLessonsByPagination(BLesson param,String userId) {
public
GridModel
queryBLessonsByPagination
(
BLesson
param
,
String
uid
)
{
// param.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
// param.setCreateBy(userId);
public
Result
queryBLessonsByPagination
(
BLesson
param
,
String
uid
)
{
bLessonService
.
queryBLessonsByPagination
(
getPaginationUtility
(),
param
,
uid
);
GridModel
gridModel
=
getGridModelResponse
();
return
gridModel
;
// return gridModel;
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
gridModel
);
}
@GetMapping
(
value
=
"/queryLearnBLessonsByPagination"
)
public
GridModel
queryLearnBLessonsByPagination
(
BLesson
param
,
String
userId
)
{
// param.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
bLessonService
.
queryLearnBLessonsByPagination
(
getPaginationUtility
(),
param
,
userId
);
GridModel
gridModel
=
getGridModelResponse
();
return
gridModel
;
}
//
@GetMapping(value = "/queryLearnBLessonsByPagination")
//
public GridModel queryLearnBLessonsByPagination(BLesson param,String userId) {
//
//
param.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
//
bLessonService.queryLearnBLessonsByPagination(getPaginationUtility(),param,userId);
//
GridModel gridModel = getGridModelResponse();
//
return gridModel;
//
}
@ApiOperation
(
value
=
"根据条件查询"
,
notes
=
"根据URL中的参数查询全部"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
),
...
...
src/main/java/org/rcisoft/business/blesson/entity/BLesson.java
View file @
9a1d1453
...
...
@@ -65,17 +65,17 @@ public class BLesson extends IdEntity<BLesson> {
private
Date
releaseDate
;
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
lessonType
;
//
可见范围
private
String
lessonType
;
//
课程类型(0:课程 1:培训)
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
discussNumber
;
//
可见范围
private
String
discussNumber
;
//
评论数
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
recommend
;
//
可见范围
private
String
recommend
;
//
推荐(0:不推荐 1:推荐)
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
collectNumber
;
//
可见范围
private
String
collectNumber
;
//
关注数
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
hotNumber
;
//
可见范围
private
String
hotNumber
;
//
热度
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
value
;
//
可见范围
private
String
value
;
//
价值
@Transient
...
...
src/main/java/org/rcisoft/business/blessonperson/controller/BLessonPersonController.java
View file @
9a1d1453
...
...
@@ -38,18 +38,22 @@ public class BLessonPersonController extends PaginationController<BLesson> {
}
//-------
@ApiOperation
(
value
=
"
退出课程"
,
notes
=
"根据ID停用一条记录
"
)
@ApiOperation
(
value
=
"
分页查询听课"
,
notes
=
"
"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"code"
,
value
=
"课程编号"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"condition"
,
value
=
"模糊查询条件"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"classHour"
,
value
=
"课时"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"credits"
,
value
=
"学分"
,
required
=
false
,
dataType
=
"varchar"
)})
@GetMapping
(
value
=
"/queryLearnBLessonsByPagination"
)
public
GridModel
queryLearnBLessonsByPagination
(
BLessonPerson
param
,
String
uid
)
{
public
Result
queryLearnBLessonsByPagination
(
BLessonPerson
param
,
String
uid
)
{
// param.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
bLessonPersonService
.
queryLearnBLessonsByPagination
(
getPaginationUtility
(),
param
,
uid
);
GridModel
gridModel
=
getGridModelResponse
();
return
gridModel
;
// return gridModel;
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
gridModel
);
}
}
src/main/java/org/rcisoft/business/bsl/task/SlTask.java
View file @
9a1d1453
...
...
@@ -4,6 +4,7 @@ import com.itextpdf.text.pdf.PdfReader;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.common.component.Global
;
import
org.rcisoft.core.util.CutPdfUtil
;
import
org.rcisoft.core.util.OfficeToPdf
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
...
...
@@ -17,6 +18,8 @@ import java.io.File;
@Slf4j
public
class
SlTask
{
@Autowired
private
OfficeToPdf
officeToPdf
;
@Autowired
private
CutPdfUtil
cutPdfUtil
;
...
...
@@ -24,6 +27,10 @@ public class SlTask {
@Autowired
private
Global
global
;
@Async
public
void
officeToPdf
(
String
sourceFile
,
String
destFile
){
officeToPdf
.
transformToPdf
(
sourceFile
,
destFile
);
}
@Async
...
...
src/main/java/org/rcisoft/common/controller/UserController.java
View file @
9a1d1453
...
...
@@ -5,12 +5,14 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.base.Ret
;
import
org.rcisoft.common.util.feignDto.*
;
import
org.rcisoft.common.util.outClient.MTCotactApiRequestClient
;
import
org.rcisoft.common.util.outClient.MTMessageApiRequestClient
;
import
org.rcisoft.common.util.outClient.MTNotificationApiRequestClient
;
import
org.rcisoft.common.util.outClient.MTOauthApiRequestClient
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.result.Result
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -45,7 +47,7 @@ public class UserController {
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"code"
,
value
=
"用户code"
,
required
=
true
)
})
public
Ret
loginByCode
(
String
code
)
{
public
Re
sul
t
loginByCode
(
String
code
)
{
MTMyInfoRspDTO
mtMyInfoRspDTO
;
try
{
Map
<
String
,
String
>
tokens
=
mtOauthApiRequestClient
.
getTokenByCode
(
code
);
...
...
@@ -54,11 +56,19 @@ public class UserController {
mtMyInfoRspDTO
=
mtCotactApiRequestClient
.
userGetByToken
(
token
);
mtMyInfoRspDTO
.
setAccess_token
(
token
);
mtMyInfoRspDTO
.
setRefresh_token
(
refreshToken
);
return
Ret
.
ok
().
setData
(
mtMyInfoRspDTO
);
// return Ret.ok().setData(mtMyInfoRspDTO);
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_FREE_ACCESS_ERROR
,
mtMyInfoRspDTO
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
());
}
return
Ret
.
error
().
setMsg
(
"免登失败"
);
// return Ret.error().setMsg("免登失败");
return
Result
.
builder
(
new
PersistModel
(
0
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_FREE_ACCESS_ERROR
,
""
);
}
@GetMapping
(
"/refreshToken"
)
...
...
@@ -66,14 +76,22 @@ public class UserController {
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"refreshToken"
,
value
=
"刷新token"
,
required
=
true
)
})
public
Ret
refreshToken
(
String
refreshToken
)
{
public
Re
sul
t
refreshToken
(
String
refreshToken
)
{
try
{
RefreshDTO
refreshDTO
=
mtCotactApiRequestClient
.
refreshToken
(
refreshToken
);
return
Ret
.
ok
().
setData
(
refreshDTO
);
// return Ret.ok().setData(refreshDTO);
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_FREE_ACCESS_ERROR
,
refreshDTO
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
Ret
.
error
().
setMsg
(
"免登失败"
);
// return Ret.error().setMsg("免登失败");
return
Result
.
builder
(
new
PersistModel
(
0
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_FREE_ACCESS_ERROR
,
""
);
}
}
src/main/java/org/rcisoft/core/constant/MessageConstant.java
View file @
9a1d1453
...
...
@@ -11,4 +11,7 @@ public class MessageConstant {
public
static
final
String
MESSAGE_ALERT_ERROR
=
"操作失败"
;
//信息非法
public
static
final
String
MESSAGE_ALERT_INFO_INVALID
=
"信息不合法"
;
//免登失败
public
static
final
String
MESSAGE_FREE_ACCESS_ERROR
=
"免登失败"
;
}
src/main/java/org/rcisoft/core/util/OfficeToPdf.java
0 → 100644
View file @
9a1d1453
package
org
.
rcisoft
.
core
.
util
;
import
com.artofsolving.jodconverter.BasicDocumentFormatRegistry
;
import
com.artofsolving.jodconverter.DocumentConverter
;
import
com.artofsolving.jodconverter.DocumentFormat
;
import
com.artofsolving.jodconverter.DocumentFormatRegistry
;
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.rcisoft.common.component.Global
;
import
org.rcisoft.core.exception.ServiceException
;
import
org.rcisoft.core.result.ResultServiceEnums
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.ConnectException
;
/**
* Created by Administrator on 2018/1/19.
*/
@Component
@Slf4j
public
class
OfficeToPdf
{
@Autowired
private
Global
global
;
/*
private static OfficeManager officeManager;
private static int port[] = { 8100 };
public void pptToPdf(String inputFile, String outputFile) throws FileNotFoundException {
startService();
System.out.println("进行文档转换转换:" + inputFile + " --> " + outputFile);
OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager);
converter.convert(new File(inputFile), new File(outputFile));
stopService();
}
// 打开服务器
public void startService() {
DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
try {
System.out.println("准备启动服务....");
configuration.setOfficeHome(global.getOPEN_OFFICE_HOME());// 设置OpenOffice.org安装目录
configuration.setPortNumbers(port); // 设置转换端口,默认为8100
configuration.setTaskExecutionTimeout(1000 * 60 * 5L);// 设置任务执行超时为5分钟
configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);// 设置任务队列超时为24小时
officeManager = configuration.buildOfficeManager();
officeManager.start(); // 启动服务
System.out.println("office转换服务启动成功!");
} catch (Exception ce) {
System.out.println("office转换服务启动失败!详细信息:" + ce);
}
}
// 关闭服务器
public static void stopService() {
System.out.println("关闭office转换服务....");
if (officeManager != null) {
officeManager.stop();
}
System.out.println("关闭office转换成功!");
}*/
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
path
=
"C:/Users/Administrator/Desktop/"
;
OfficeToPdf
opc
=
new
OfficeToPdf
();
opc
.
transformToPdf
(
path
+
"abc.pptx"
,
path
+
"1.pdf"
);
}
/**
* 转换pdf
* @param sourceFile
* @param destFile
* @return 1 成功 0 失败 -1 错误
*/
public
synchronized
int
transformToPdf
(
String
sourceFile
,
String
destFile
){
OpenOfficeConnection
connection
=
null
;
try
{
File
inputFile
=
new
File
(
sourceFile
);
if
(!
inputFile
.
exists
())
{
return
-
1
;
// 找不到源文件, 则返回-1
}
// 如果目标路径不存在, 则新建该路径
File
outputFile
=
new
File
(
destFile
);
if
(!
outputFile
.
getParentFile
().
exists
())
{
outputFile
.
getParentFile
().
mkdirs
();
}
// connect to an OpenOffice.org instance running on port 8100
connection
=
new
SocketOpenOfficeConnection
(
global
.
getLibreofficeIp
(),
global
.
getLibreofficePort
());
connection
.
connect
();
// convert
DocumentConverter
converter
=
new
OpenOfficeDocumentConverter
(
connection
);
DocumentFormatRegistry
factory
=
new
BasicDocumentFormatRegistry
();
DocumentFormat
inputDocumentFormat
=
factory
.
getFormatByFileExtension
(
FileUtil
.
getFilePostfix
(
sourceFile
));
DocumentFormat
outputDocumentFormat
=
factory
.
getFormatByFileExtension
(
FileUtil
.
getFilePostfix
(
destFile
));
log
.
info
(
"开始转换--> "
+
sourceFile
);
converter
.
convert
(
inputFile
,
inputDocumentFormat
,
outputFile
,
outputDocumentFormat
);
log
.
info
(
"转换完毕--> "
+
destFile
);
// close the connection
}
catch
(
ConnectException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
0
;
}
finally
{
if
(
connection
!=
null
)
{
connection
.
disconnect
();
}
else
{
throw
new
ServiceException
(
ResultServiceEnums
.
UPLOAD_ERROR
);
}
}
return
1
;
}
}
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