Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
ab59950c
提交
ab59950c
authored
3月 14, 2024
作者:
chenshiqiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
run
上级
28ea39b6
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
7 行增加
和
372 行删除
+7
-372
EventCategoryMapper.java
src/main/java/com/zzsn/event/mapper/EventCategoryMapper.java
+3
-4
EventMapper.java
src/main/java/com/zzsn/event/mapper/EventMapper.java
+3
-4
DefaultFileUtility.java
...ain/java/com/zzsn/event/util/file/DefaultFileUtility.java
+0
-211
FileUtility.java
src/main/java/com/zzsn/event/util/file/FileUtility.java
+0
-42
Md5Utils.java
src/main/java/com/zzsn/event/util/file/Md5Utils.java
+0
-74
application.yml
src/main/resources/application.yml
+1
-37
没有找到文件。
src/main/java/com/zzsn/event/mapper/EventCategoryMapper.java
浏览文件 @
ab59950c
package
com
.
zzsn
.
event
.
mapper
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
import
com.zzsn.event.entity.EventCategory
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zzsn.event.entity.EventCategory
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @Description: 事件分类
...
...
@@ -12,6 +10,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @Date: 2024-03-14
* @Version: V1.0
*/
@Mapper
public
interface
EventCategoryMapper
extends
BaseMapper
<
EventCategory
>
{
}
src/main/java/com/zzsn/event/mapper/EventMapper.java
浏览文件 @
ab59950c
package
com
.
zzsn
.
event
.
mapper
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
import
com.zzsn.event.entity.Event
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zzsn.event.entity.Event
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @Description: 事件
...
...
@@ -12,6 +10,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @Date: 2024-03-14
* @Version: V1.0
*/
@Mapper
public
interface
EventMapper
extends
BaseMapper
<
Event
>
{
}
src/main/java/com/zzsn/event/util/file/DefaultFileUtility.java
deleted
100644 → 0
浏览文件 @
28ea39b6
/**
*
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
com
.
zzsn
.
event
.
util
.
file
;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.constant.DocumentType
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
@Component
@Qualifier
(
"default"
)
public
class
DefaultFileUtility
implements
FileUtility
{
@Value
(
"${filesize-max}"
)
private
String
filesizeMax
;
@Value
(
"${files.docservice.viewed-docs}"
)
private
String
docserviceViewedDocs
;
@Value
(
"${files.docservice.edited-docs}"
)
private
String
docserviceEditedDocs
;
@Value
(
"${files.docservice.convert-docs}"
)
private
String
docserviceConvertDocs
;
@Value
(
"${files.docservice.fillforms-docs}"
)
private
String
docserviceFillDocs
;
// document extensions
private
List
<
String
>
extsDocument
=
Arrays
.
asList
(
".doc"
,
".docx"
,
".docm"
,
".dot"
,
".dotx"
,
".dotm"
,
".odt"
,
".fodt"
,
".ott"
,
".rtf"
,
".txt"
,
".html"
,
".htm"
,
".mht"
,
".xml"
,
".pdf"
,
".djvu"
,
".fb2"
,
".epub"
,
".xps"
,
".oform"
);
// spreadsheet extensions
private
List
<
String
>
extsSpreadsheet
=
Arrays
.
asList
(
".xls"
,
".xlsx"
,
".xlsm"
,
".xlsb"
,
".xlt"
,
".xltx"
,
".xltm"
,
".ods"
,
".fods"
,
".ots"
,
".csv"
);
// presentation extensions
private
List
<
String
>
extsPresentation
=
Arrays
.
asList
(
".pps"
,
".ppsx"
,
".ppsm"
,
".ppt"
,
".pptx"
,
".pptm"
,
".pot"
,
".potx"
,
".potm"
,
".odp"
,
".fodp"
,
".otp"
);
// get the document type
public
DocumentType
getDocumentType
(
final
String
fileName
)
{
String
ext
=
getFileExtension
(
fileName
).
toLowerCase
();
// get file extension from its name
// word type for document extensions
if
(
extsDocument
.
contains
(
ext
))
{
return
DocumentType
.
word
;
}
// cell type for spreadsheet extensions
if
(
extsSpreadsheet
.
contains
(
ext
))
{
return
DocumentType
.
cell
;
}
// slide type for presentation extensions
if
(
extsPresentation
.
contains
(
ext
))
{
return
DocumentType
.
slide
;
}
// default file type is word
return
DocumentType
.
word
;
}
// get file name from its URL
public
String
getFileName
(
final
String
url
)
{
if
(
url
==
null
)
{
return
""
;
}
// get file name from the last part of URL
String
fileName
=
url
.
substring
(
url
.
lastIndexOf
(
'/'
)
+
1
);
fileName
=
fileName
.
split
(
"\\?"
)[
0
];
return
fileName
;
}
// get file name without extension
public
String
getFileNameWithoutExtension
(
final
String
url
)
{
String
fileName
=
getFileName
(
url
);
if
(
fileName
==
null
)
{
return
null
;
}
String
fileNameWithoutExt
=
fileName
.
substring
(
0
,
fileName
.
lastIndexOf
(
'.'
));
return
fileNameWithoutExt
;
}
// get file extension from URL
public
String
getFileExtension
(
final
String
url
)
{
String
fileName
=
getFileName
(
url
);
if
(
fileName
==
null
)
{
return
null
;
}
String
fileExt
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
));
return
fileExt
.
toLowerCase
();
}
//get file type from URL
public
String
getFileType
(
final
String
url
)
{
String
fileName
=
getFileName
(
url
);
if
(
fileName
==
null
)
{
return
null
;
}
String
fileExt
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
));
return
fileExt
.
toLowerCase
();
}
// get an editor internal extension
public
String
getInternalExtension
(
final
DocumentType
type
)
{
// .docx for word file type
if
(
type
.
equals
(
DocumentType
.
word
))
{
return
".docx"
;
}
// .xlsx for cell file type
if
(
type
.
equals
(
DocumentType
.
cell
))
{
return
".xlsx"
;
}
// .pptx for slide file type
if
(
type
.
equals
(
DocumentType
.
slide
))
{
return
".pptx"
;
}
// the default file type is .docx
return
".docx"
;
}
public
List
<
String
>
getFillExts
()
{
return
Arrays
.
asList
(
docserviceFillDocs
.
split
(
"\\|"
));
}
// get file extensions that can be viewed
public
List
<
String
>
getViewedExts
()
{
return
Arrays
.
asList
(
docserviceViewedDocs
.
split
(
"\\|"
));
}
// get file extensions that can be edited
public
List
<
String
>
getEditedExts
()
{
return
Arrays
.
asList
(
docserviceEditedDocs
.
split
(
"\\|"
));
}
// get file extensions that can be converted
public
List
<
String
>
getConvertExts
()
{
return
Arrays
.
asList
(
docserviceConvertDocs
.
split
(
"\\|"
));
}
// get all the supported file extensions
public
List
<
String
>
getFileExts
()
{
List
<
String
>
res
=
new
ArrayList
<>();
res
.
addAll
(
getViewedExts
());
res
.
addAll
(
getEditedExts
());
res
.
addAll
(
getConvertExts
());
res
.
addAll
(
getFillExts
());
return
res
;
}
// generate the file path from file directory and name
public
Path
generateFilepath
(
final
String
directory
,
final
String
fullFileName
)
{
String
fileName
=
getFileNameWithoutExtension
(
fullFileName
);
// get file name without extension
String
fileExtension
=
getFileExtension
(
fullFileName
);
// get file extension
Path
path
=
Paths
.
get
(
directory
+
fullFileName
);
// get the path to the files with the specified name
for
(
int
i
=
1
;
Files
.
exists
(
path
);
i
++)
{
// run through all the files with the specified name
// get a name of each file without extension and add an index to it
fileName
=
getFileNameWithoutExtension
(
fullFileName
)
+
"("
+
i
+
")"
;
// create a new path for this file with the correct name and extension
path
=
Paths
.
get
(
directory
+
fileName
+
fileExtension
);
}
path
=
Paths
.
get
(
directory
+
fileName
+
fileExtension
);
return
path
;
}
// get maximum file size
public
long
getMaxFileSize
()
{
long
size
=
Long
.
parseLong
(
filesizeMax
);
return
size
>
0
?
size
:
Constants
.
MAX_FILE_SIZE
;
}
}
src/main/java/com/zzsn/event/util/file/FileUtility.java
deleted
100644 → 0
浏览文件 @
28ea39b6
/**
*
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
com
.
zzsn
.
event
.
util
.
file
;
import
com.zzsn.event.constant.DocumentType
;
import
java.nio.file.Path
;
import
java.util.List
;
// specify the file utility functions
public
interface
FileUtility
{
DocumentType
getDocumentType
(
String
fileName
);
// get the document type
String
getFileName
(
String
url
);
// get file name from its URL
String
getFileNameWithoutExtension
(
String
url
);
// get file name without extension
String
getFileExtension
(
String
url
);
// get file extension from URL
String
getFileType
(
String
url
);
// get file type from URL
String
getInternalExtension
(
DocumentType
type
);
// get an editor internal extension
List
<
String
>
getFileExts
();
// get all the supported file extensions
List
<
String
>
getFillExts
();
// get file extensions that can be filled
List
<
String
>
getViewedExts
();
// get file extensions that can be viewed
List
<
String
>
getEditedExts
();
// get file extensions that can be edited
List
<
String
>
getConvertExts
();
// get file extensions that can be converted
Path
generateFilepath
(
String
directory
,
String
fullFileName
);
/* generate the file path
from file directory and name */
long
getMaxFileSize
();
// get maximum file size
}
src/main/java/com/zzsn/event/util/file/Md5Utils.java
deleted
100644 → 0
浏览文件 @
28ea39b6
package
com
.
zzsn
.
event
.
util
.
file
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.binary.Hex
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
/**
* Md5 工具类
* need commons-codec-1.6.jar +
* @author zhangcx
* @date 2019-7-23
*/
@Slf4j
public
class
Md5Utils
{
private
static
MessageDigest
MD5
=
null
;
static
{
try
{
MD5
=
MessageDigest
.
getInstance
(
"MD5"
);
}
catch
(
NoSuchAlgorithmException
ne
)
{
ne
.
printStackTrace
();
}
}
public
static
String
getFileMd5
(
String
filePath
)
{
if
(
StringUtils
.
isBlank
(
filePath
))
{
return
null
;
}
return
getFileMd5
(
new
File
(
filePath
));
}
/**
* 对一个文件获取md5值
*/
public
static
String
getFileMd5
(
File
file
)
{
FileInputStream
fileInputStream
=
null
;
try
{
fileInputStream
=
new
FileInputStream
(
file
);
byte
[]
buffer
=
new
byte
[
8192
];
int
length
;
while
((
length
=
fileInputStream
.
read
(
buffer
))
!=
-
1
)
{
MD5
.
update
(
buffer
,
0
,
length
);
}
return
new
String
(
Hex
.
encodeHex
(
MD5
.
digest
()));
}
catch
(
IOException
e
)
{
log
.
error
(
"$$$ 获取文件md5失败!"
,
e
);
return
null
;
}
finally
{
try
{
if
(
fileInputStream
!=
null
)
{
fileInputStream
.
close
();
}
}
catch
(
IOException
e
)
{
log
.
error
(
"关闭文件流出错!"
,
e
);
}
}
}
/**
* 计算字符串的md5值
* @param target 字符串
* @return md5 value
*/
public
static
String
md5
(
final
String
target
)
{
return
DigestUtils
.
md5Hex
(
target
);
}
}
src/main/resources/application.yml
浏览文件 @
ab59950c
...
...
@@ -7,7 +7,7 @@ spring:
max-request-size
:
1024MB
max-file-size
:
100MB
datasource
:
url
:
jdbc:mysql://114.116.44.11:3306/
knowledge
?useUnicode=true&characterEncoding=utf-8&AllowPublicKeyRetrieval=True&serverTimezone=Asia/Shanghai&autoReconnect=true&rewriteBatchedStatements=true
url
:
jdbc:mysql://114.116.44.11:3306/
clb_project
?useUnicode=true&characterEncoding=utf-8&AllowPublicKeyRetrieval=True&serverTimezone=Asia/Shanghai&autoReconnect=true&rewriteBatchedStatements=true
username
:
ciglobal
password
:
qwer@9988&zzsn
elasticsearch
:
...
...
@@ -39,42 +39,6 @@ spring:
prefix
:
classpath:/templates
mybatis-plus
:
mapper-locations
:
classpath*:com/zzsn/knowbase/mapper/xml/*Mapper.xml
configuration
:
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case
:
true
python
:
intelligentQaUrl
:
http://116.63.179.212:7862/platform/chat
searchUrl
:
http://116.63.179.212:7862/platform/searchInfo
deleteUrl
:
http://114.115.172.99:10013/platform/delete
know
:
thirdpartyurl
:
# checkuserurl: https://clb.ciglobal.cn/clb-api/sys/checkToken
# getusersurl: https://clb.ciglobal.cn/clb-api/sys/user/thirdparty
checkuserurl
:
http://192.168.0.124:9988/sys/checkToken
getusersurl
:
http://192.168.0.124:9988/sys/user/thirdparty
document
:
server
:
host
:
http://114.116.116.241:9088
# host: http://192.168.1.71:9088
files
:
storage
:
/storage/know/
# storage: C:/know/
docservice
:
url
:
site
:
http://114.116.116.241:80/
# site: http://192.168.1.216:80/
converter
:
ConvertService.ashx
command
:
coauthoring/CommandService.ashx
api
:
web-apps/apps/api/documents/api.js
preloader
:
web-apps/apps/api/documents/cache-scripts.html
fillforms-docs
:
.docx|.oform
viewed-docs
:
.djvu|.oxps|.pdf|.xps
edited-docs
:
.csv|.docm|.docx|.docxf|.dotm|.dotx|.epub|.fb2|.html|.odp|.ods|.odt|.otp|.ots|.ott|.potm|.potx|.ppsm|.ppsx|.pptm|.pptx|.rtf|.txt|.xlsm|.xlsx|.xltm|.xltx
convert-docs
:
.doc|.dot|.dps|.dpt|.epub|.et|.ett|.fb2|.fodp|.fods|.fodt|.htm|.html|.mht|.mhtml|.odp|.ods|.odt|.otp|.ots|.ott|.pot|.pps|.ppt|.rtf|.stw|.sxc|.sxi|.sxw|.wps|.wpt|.xls|.xlsb|.xlt|.xml
timeout
:
120000
history
:
postfix
:
-hist
filesize-max
:
52428800
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论