Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hg-smart
Overview
Overview
Details
Activity
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
platform
hg-smart
Commits
00eb6d24
Commit
00eb6d24
authored
Oct 23, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.优化文件预览,采用前端加载文件地址的方式
parent
8df11b52
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
601 additions
and
63 deletions
+601
-63
OSConstant.java
...main/java/com/baosight/hggp/core/constant/OSConstant.java
+15
-3
Iplat4jTools.java
src/main/java/com/baosight/hggp/core/tools/Iplat4jTools.java
+27
-2
Iplat4jUtils.java
src/main/java/com/baosight/hggp/core/utils/Iplat4jUtils.java
+63
-3
S3Utils.java
src/main/java/com/baosight/hggp/core/utils/S3Utils.java
+22
-1
ServiceHGWD001B.java
...java/com/baosight/hggp/hg/wd/service/ServiceHGWD001B.java
+15
-10
ServiceHGWD002.java
.../java/com/baosight/hggp/hg/wd/service/ServiceHGWD002.java
+0
-1
HGWDTools.java
src/main/java/com/baosight/hggp/hg/wd/tools/HGWDTools.java
+3
-3
FileUtils.java
src/main/java/com/baosight/hggp/util/FileUtils.java
+53
-2
EUDM02.xml
src/main/java/com/baosight/iplat4j/eu/dm/sql/EUDM02.xml
+249
-0
EUDM05.xml
src/main/java/com/baosight/iplat4j/eu/dm/sql/EUDM05.xml
+103
-0
HGWD002A1.js
src/main/webapp/HG/WD/HGWD002A1.js
+25
-25
HGWD099A.jsp
src/main/webapp/HG/WD/HGWD099A.jsp
+1
-1
common.js
src/main/webapp/common/js/common.js
+25
-12
No files found.
src/main/java/com/baosight/hggp/core/constant/OSConstant.java
View file @
00eb6d24
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
package
com
.
baosight
.
hggp
.
core
.
constant
;
package
com
.
baosight
.
hggp
.
core
.
constant
;
import
com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext
;
/**
/**
* 与操作系统 有关的一些常量.
* 与操作系统 有关的一些常量.
*
*
...
@@ -17,6 +19,11 @@ package com.baosight.hggp.core.constant;
...
@@ -17,6 +19,11 @@ package com.baosight.hggp.core.constant;
public
class
OSConstant
{
public
class
OSConstant
{
/**
/**
* docRootDir
*/
public
static
String
DOC_ROOT_DIR
=
PlatApplicationContext
.
getProperty
(
"docRootDir"
);
/**
* 文件夹分隔符,不同OS下分隔符不同
* 文件夹分隔符,不同OS下分隔符不同
*/
*/
public
final
static
String
SEPARATOR
=
System
.
getProperty
(
"file.separator"
);
public
final
static
String
SEPARATOR
=
System
.
getProperty
(
"file.separator"
);
...
@@ -34,16 +41,21 @@ public class OSConstant {
...
@@ -34,16 +41,21 @@ public class OSConstant {
/**
/**
* 程序运行目录
* 程序运行目录
*/
*/
public
final
static
String
DOWN_DIR
=
USER_DIR
+
SEPARATOR
+
"file"
+
SEPARATOR
+
"download"
;
public
final
static
String
DOWN_DIR
=
DOC_ROOT_DIR
+
SEPARATOR
+
"download"
;
/**
/**
* 二维码目录
* 二维码目录
*/
*/
public
final
static
String
QRCODE_DIR
=
USER_DIR
+
SEPARATOR
+
"file"
+
SEPARATOR
+
"qrcode"
;
public
final
static
String
QRCODE_DIR
=
DOC_ROOT_DIR
+
SEPARATOR
+
"qrcode"
;
/**
/**
* 压缩包目录
* 压缩包目录
*/
*/
public
final
static
String
ZIP_DIR
=
USER_DIR
+
SEPARATOR
+
"file"
+
SEPARATOR
+
"zip"
;
public
final
static
String
ZIP_DIR
=
DOC_ROOT_DIR
+
SEPARATOR
+
"zip"
;
/**
* 文件下载上下文
*/
public
final
static
String
FILE_DOWNLOAD
=
"file-download"
;
}
}
src/main/java/com/baosight/hggp/core/tools/Iplat4jTools.java
View file @
00eb6d24
...
@@ -3,7 +3,6 @@ package com.baosight.hggp.core.tools;
...
@@ -3,7 +3,6 @@ package com.baosight.hggp.core.tools;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.iplat4j.common.ed.domain.TEDFA00
;
import
com.baosight.iplat4j.common.ed.domain.TEDFA00
;
import
com.baosight.iplat4j.common.eu.domain.Teudm03
;
import
com.baosight.iplat4j.common.eu.domain.Teudm05
;
import
com.baosight.iplat4j.common.eu.domain.Teudm05
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
...
@@ -80,7 +79,7 @@ public class Iplat4jTools {
...
@@ -80,7 +79,7 @@ public class Iplat4jTools {
public
static
class
EuDm02
{
public
static
class
EuDm02
{
/**
/**
* 查询
页面信息
* 查询
*
*
* @param docId
* @param docId
* @return
* @return
...
@@ -92,6 +91,19 @@ public class Iplat4jTools {
...
@@ -92,6 +91,19 @@ public class Iplat4jTools {
List
<
Map
>
results
=
DaoBase
.
getInstance
().
query
(
"EUDM02.queryDocById"
,
paramMap
);
List
<
Map
>
results
=
DaoBase
.
getInstance
().
query
(
"EUDM02.queryDocById"
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
.
get
(
0
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
.
get
(
0
);
}
}
/**
* 查询
*
* @param docIds
* @return
*/
public
static
List
<
Map
>
listByDocId
(
List
<
String
>
docIds
)
{
AssertUtils
.
isEmpty
(
docIds
,
"文件ID不能为空!"
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
"docIds"
,
docIds
);
return
DaoBase
.
getInstance
().
query
(
"EUDM02.queryDocById"
,
paramMap
);
}
}
}
/**
/**
...
@@ -115,5 +127,18 @@ public class Iplat4jTools {
...
@@ -115,5 +127,18 @@ public class Iplat4jTools {
List
<
Teudm05
>
results
=
DaoBase
.
getInstance
().
query
(
"EUDM05.getDocByDocId"
,
paramMap
);
List
<
Teudm05
>
results
=
DaoBase
.
getInstance
().
query
(
"EUDM05.getDocByDocId"
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
.
get
(
0
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
.
get
(
0
);
}
}
/**
* 查询页面信息
*
* @param docIds
* @return
*/
public
static
List
<
Teudm05
>
listByDocId
(
List
<
String
>
docIds
)
{
AssertUtils
.
isEmpty
(
docIds
,
"文件ID不能为空!"
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
"resIds"
,
docIds
);
return
DaoBase
.
getInstance
().
query
(
"EUDM05.getDocByDocId"
,
paramMap
);
}
}
}
}
}
src/main/java/com/baosight/hggp/core/utils/Iplat4jUtils.java
View file @
00eb6d24
...
@@ -12,7 +12,9 @@ import com.baosight.iplat4j.common.eu.domain.Teudm05;
...
@@ -12,7 +12,9 @@ import com.baosight.iplat4j.common.eu.domain.Teudm05;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext
;
import
com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext
;
import
com.baosight.iplat4j.eu.dm.util.PlatFileUploader
;
import
com.baosight.iplat4j.eu.dm.util.PlatFileUploader
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -33,8 +35,7 @@ public class Iplat4jUtils {
...
@@ -33,8 +35,7 @@ public class Iplat4jUtils {
*/
*/
public
static
boolean
deleteFileByDocId
(
String
docId
)
{
public
static
boolean
deleteFileByDocId
(
String
docId
)
{
// 判断文件上传的地址
// 判断文件上传的地址
String
fileLocation
=
S3Constant
.
FILE_LOCATION
;
if
(
"s3"
.
equalsIgnoreCase
(
S3Constant
.
FILE_LOCATION
))
{
if
(
"s3"
.
equalsIgnoreCase
(
fileLocation
))
{
Teudm05
dbDm05
=
Iplat4jTools
.
EuDm05
.
getByDocId
(
docId
);
Teudm05
dbDm05
=
Iplat4jTools
.
EuDm05
.
getByDocId
(
docId
);
if
(
dbDm05
==
null
)
{
if
(
dbDm05
==
null
)
{
throw
new
PlatException
(
"文件在服务器中不存在"
);
throw
new
PlatException
(
"文件在服务器中不存在"
);
...
@@ -78,6 +79,65 @@ public class Iplat4jUtils {
...
@@ -78,6 +79,65 @@ public class Iplat4jUtils {
}
}
/**
/**
* 获取文件HTTP URL
*
* @param docIds
* @return
*/
public
static
Map
<
String
,
String
>
buildDocUrl
(
List
<
String
>
docIds
)
throws
Exception
{
if
(
CollectionUtils
.
isEmpty
(
docIds
))
{
return
null
;
}
Map
<
String
,
String
>
resultMap
=
new
HashMap
<>();
if
(
"s3"
.
equalsIgnoreCase
(
S3Constant
.
FILE_LOCATION
))
{
List
<
Teudm05
>
dbDm05s
=
Iplat4jTools
.
EuDm05
.
listByDocId
(
docIds
);
if
(
CollectionUtils
.
isEmpty
(
dbDm05s
))
{
return
null
;
}
for
(
Teudm05
dbDm05
:
dbDm05s
)
{
resultMap
.
put
(
dbDm05
.
getResId
(),
S3Utils
.
buildUrl
(
dbDm05
));
}
}
else
{
List
<
Map
>
dbDm02Maps
=
Iplat4jTools
.
EuDm02
.
listByDocId
(
docIds
);
if
(
CollectionUtils
.
isEmpty
(
dbDm02Maps
))
{
return
null
;
}
for
(
Map
dbDm02Map
:
dbDm02Maps
)
{
String
docId
=
dbDm02Map
.
get
(
"docId"
).
toString
();
String
chgName
=
dbDm02Map
.
get
(
"chgName"
).
toString
();
String
realPath
=
dbDm02Map
.
get
(
"realPath"
).
toString
();
resultMap
.
put
(
docId
,
S3Constant
.
RESOURCE
+
OSConstant
.
SEPARATOR
+
realPath
+
OSConstant
.
SEPARATOR
+
chgName
);
}
}
return
resultMap
;
}
/**
* 构建文件HTTP地址
*
* @param docId
* @return
* @throws Exception
*/
public
static
String
buildDocUrl
(
String
docId
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
docId
))
{
return
null
;
}
if
(
"s3"
.
equalsIgnoreCase
(
S3Constant
.
FILE_LOCATION
))
{
return
S3Utils
.
buildUrl
(
docId
).
getUrl
();
}
else
{
Map
dbDm02Map
=
Iplat4jTools
.
EuDm02
.
getByDocId
(
docId
);
if
(
MapUtils
.
isEmpty
(
dbDm02Map
))
{
return
null
;
}
String
chgName
=
dbDm02Map
.
get
(
"chgName"
).
toString
();
String
realPath
=
dbDm02Map
.
get
(
"realPath"
).
toString
();
return
S3Constant
.
RESOURCE
+
"/"
+
OSConstant
.
FILE_DOWNLOAD
+
"/"
+
realPath
+
chgName
;
}
}
/**
* 压缩文件
* 压缩文件
*
*
* @param docIds
* @param docIds
...
@@ -111,7 +171,7 @@ public class Iplat4jUtils {
...
@@ -111,7 +171,7 @@ public class Iplat4jUtils {
// 压缩完删除本地文件
// 压缩完删除本地文件
FileUtils
.
deleteFiles
(
zipFolderPath
);
FileUtils
.
deleteFiles
(
zipFolderPath
);
// 替换成HTTP地址
// 替换成HTTP地址
return
S3Constant
.
RESOURCE
+
zipFilePath
.
replace
(
OSConstant
.
USER
_DIR
,
""
)
return
S3Constant
.
RESOURCE
+
"/"
+
OSConstant
.
FILE_DOWNLOAD
+
zipFilePath
.
replace
(
OSConstant
.
DOC_ROOT
_DIR
,
""
)
.
replace
(
OSConstant
.
SEPARATOR
,
"/"
);
.
replace
(
OSConstant
.
SEPARATOR
,
"/"
);
}
}
...
...
src/main/java/com/baosight/hggp/core/utils/S3Utils.java
View file @
00eb6d24
...
@@ -4,6 +4,7 @@ import com.amazonaws.services.s3.AmazonS3;
...
@@ -4,6 +4,7 @@ import com.amazonaws.services.s3.AmazonS3;
import
com.baosight.hggp.core.constant.S3Constant
;
import
com.baosight.hggp.core.constant.S3Constant
;
import
com.baosight.hggp.core.tools.Iplat4jTools
;
import
com.baosight.hggp.core.tools.Iplat4jTools
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.FileUtils
;
import
com.baosight.hggp.util.StringUtils
;
import
com.baosight.hggp.util.StringUtils
;
import
com.baosight.iplat4j.common.eu.domain.Teudm05
;
import
com.baosight.iplat4j.common.eu.domain.Teudm05
;
import
com.baosight.iplat4j.eu.dm.document.bos.s3.api.signed.SignedBosHelp
;
import
com.baosight.iplat4j.eu.dm.document.bos.s3.api.signed.SignedBosHelp
;
...
@@ -28,17 +29,37 @@ public class S3Utils {
...
@@ -28,17 +29,37 @@ public class S3Utils {
*/
*/
public
static
Teudm05
buildUrl
(
String
docId
)
throws
Exception
{
public
static
Teudm05
buildUrl
(
String
docId
)
throws
Exception
{
Teudm05
dbDm05
=
Iplat4jTools
.
EuDm05
.
getByDocId
(
docId
);
Teudm05
dbDm05
=
Iplat4jTools
.
EuDm05
.
getByDocId
(
docId
);
AssertUtils
.
isNull
(
dbDm05
,
String
.
format
(
"文件【%s】不存在"
,
docId
));
String
s3UrlPrefix
=
dbDm05
.
getUrl
();
String
s3UrlPrefix
=
dbDm05
.
getUrl
();
String
fileName
=
dbDm05
.
getResCname
();
String
fileName
=
dbDm05
.
getResCname
();
String
returnUrlPrefix
=
BosParamHelp
.
disposeUrl
(
s3UrlPrefix
);
String
returnUrlPrefix
=
BosParamHelp
.
disposeUrl
(
s3UrlPrefix
);
URL
s3Url
=
SignedBosHelp
.
getDownloadTempUrl
(
s3UrlPrefix
,
fileName
,
null
);
URL
s3Url
=
SignedBosHelp
.
getDownloadTempUrl
(
s3UrlPrefix
,
fileName
,
null
);
String
s3UrlParam
=
StringUtils
.
defaultIfEmpty
(
s3Url
.
getQuery
(),
""
);
String
s3UrlParam
=
StringUtils
.
defaultIfEmpty
(
s3Url
.
getQuery
(),
""
);
String
returnUrl
=
returnUrlPrefix
+
"?"
+
s3UrlParam
;
String
returnUrl
=
returnUrlPrefix
+
"?"
+
s3UrlParam
;
dbDm05
.
setUrl
(
com
.
baosight
.
iplat4j
.
eu
.
dm
.
util
.
FileUtils
.
returnDocUrlByEncodeFileName
(
returnUrl
));
dbDm05
.
setUrl
(
FileUtils
.
returnDocUrlByEncodeFileName
(
returnUrl
));
return
dbDm05
;
return
dbDm05
;
}
}
/**
/**
* 根据docId换取临时下载地址
*
* @param dm05
* @return
*/
public
static
String
buildUrl
(
Teudm05
dm05
)
throws
Exception
{
if
(
dm05
==
null
)
{
return
null
;
}
String
s3UrlPrefix
=
dm05
.
getUrl
();
String
fileName
=
dm05
.
getResCname
();
String
returnUrlPrefix
=
BosParamHelp
.
disposeUrl
(
s3UrlPrefix
);
URL
s3Url
=
SignedBosHelp
.
getDownloadTempUrl
(
s3UrlPrefix
,
fileName
,
null
);
String
s3UrlParam
=
StringUtils
.
defaultIfEmpty
(
s3Url
.
getQuery
(),
""
);
String
returnUrl
=
returnUrlPrefix
+
"?"
+
s3UrlParam
;
return
FileUtils
.
returnDocUrlByEncodeFileName
(
returnUrl
);
}
/**
* 上传文件
* 上传文件
*
*
* @param key 默认不指定key的情况下,以文件内容的hash值作为文件名
* @param key 默认不指定key的情况下,以文件内容的hash值作为文件名
...
...
src/main/java/com/baosight/hggp/hg/wd/service/ServiceHGWD001B.java
View file @
00eb6d24
...
@@ -3,9 +3,10 @@ package com.baosight.hggp.hg.wd.service;
...
@@ -3,9 +3,10 @@ package com.baosight.hggp.hg.wd.service;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.enums.DeleteFlagEnum
;
import
com.baosight.hggp.core.enums.DeleteFlagEnum
;
import
com.baosight.hggp.
hg.cw.tools.HGCWToo
ls
;
import
com.baosight.hggp.
core.utils.Iplat4jUti
ls
;
import
com.baosight.hggp.hg.wd.domain.HGWD001B
;
import
com.baosight.hggp.hg.wd.domain.HGWD001B
;
import
com.baosight.hggp.hg.wd.domain.HGWD002
;
import
com.baosight.hggp.hg.wd.domain.HGWD002
;
import
com.baosight.hggp.hg.wd.domain.HGWD099
;
import
com.baosight.hggp.hg.wd.tools.HGWDTools
;
import
com.baosight.hggp.hg.wd.tools.HGWDTools
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.EiInfoUtils
;
import
com.baosight.hggp.util.EiInfoUtils
;
...
@@ -17,7 +18,6 @@ import com.baosight.iplat4j.core.ei.EiConstant;
...
@@ -17,7 +18,6 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -91,15 +91,20 @@ public class ServiceHGWD001B extends ServiceBase {
...
@@ -91,15 +91,20 @@ public class ServiceHGWD001B extends ServiceBase {
*/
*/
public
EiInfo
add
(
EiInfo
inInfo
)
{
public
EiInfo
add
(
EiInfo
inInfo
)
{
try
{
try
{
List
<
HGWD001B
>
fWd001bs
=
MapUtils
.
toDaoEPBases
(
inInfo
,
HGWD001B
.
class
);
HGWD001B
fWd001b
=
MapUtils
.
toDaoEPBase
(
inInfo
,
HGWD001B
.
class
);
for
(
HGWD001B
fWd001b
:
fWd001bs
)
{
// AssertUtils.isEmpty(fWd001b.getFileId(), "文件ID不能为空");
// AssertUtils.isEmpty(fWd001b.getFileId(), "文件ID不能为空");
// 预览记录+1
HGWD099
dbWd099
=
HGWDTools
.
HgWd099
.
getByDocId
(
fWd001b
.
getDocId
());
HGWDTools
.
HgWd099
.
previewIncr
(
fWd001b
.
getDocId
());
AssertUtils
.
isNull
(
dbWd099
,
"文件不存在"
);
// 新增
// 预览次数+1
fWd001b
.
setDeleteFlag
(
DeleteFlagEnum
.
UN_REMOVE
.
getCode
());
HGWDTools
.
HgWd099
.
previewIncr
(
fWd001b
.
getDocId
());
DaoUtils
.
insert
(
HGWD001B
.
INSERT
,
fWd001b
);
// 新增记录
}
fWd001b
.
setDeleteFlag
(
DeleteFlagEnum
.
UN_REMOVE
.
getCode
());
DaoUtils
.
insert
(
HGWD001B
.
INSERT
,
fWd001b
);
// 构建文件HTTP地址
String
url
=
Iplat4jUtils
.
buildDocUrl
(
fWd001b
.
getDocId
());
AssertUtils
.
isEmpty
(
url
,
"文件地址异常,请联系管理人员!"
);
inInfo
.
set
(
"url"
,
url
);
inInfo
.
set
(
"docType"
,
dbWd099
.
getDocType
());
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsg
(
"操作成功"
);
inInfo
.
setMsg
(
"操作成功"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/baosight/hggp/hg/wd/service/ServiceHGWD002.java
View file @
00eb6d24
...
@@ -78,7 +78,6 @@ public class ServiceHGWD002 extends ServiceBase {
...
@@ -78,7 +78,6 @@ public class ServiceHGWD002 extends ServiceBase {
return
inInfo
;
return
inInfo
;
}
}
public
void
builder
(
EiInfo
eiInfo
)
{
public
void
builder
(
EiInfo
eiInfo
)
{
String
[]
orderBy
=
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getString
(
"orderBy"
).
split
(
","
);
String
[]
orderBy
=
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getString
(
"orderBy"
).
split
(
","
);
if
(
orderBy
.
length
>
0
)
{
if
(
orderBy
.
length
>
0
)
{
...
...
src/main/java/com/baosight/hggp/hg/wd/tools/HGWDTools.java
View file @
00eb6d24
...
@@ -366,12 +366,12 @@ public class HGWDTools {
...
@@ -366,12 +366,12 @@ public class HGWDTools {
public
static
class
HgWd099
{
public
static
class
HgWd099
{
public
static
List
<
HGWD099
>
getByDocId
(
String
bizType
,
String
docId
)
{
public
static
HGWD099
getByDocId
(
String
docId
)
{
AssertUtils
.
isEmpty
(
docId
,
"文件ID不能为空"
);
AssertUtils
.
isEmpty
(
docId
,
"文件ID不能为空"
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
HGWD099
.
FIELD_BIZ_TYPE
,
bizType
);
paramMap
.
put
(
HGWD099
.
FIELD_DOC_ID
,
docId
);
paramMap
.
put
(
HGWD099
.
FIELD_DOC_ID
,
docId
);
return
DaoBase
.
getInstance
().
query
(
HGWD099
.
QUERY
,
paramMap
);
List
<
HGWD099
>
results
=
DaoBase
.
getInstance
().
query
(
HGWD099
.
QUERY
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
.
get
(
0
);
}
}
/**
/**
...
...
src/main/java/com/baosight/hggp/util/FileUtils.java
View file @
00eb6d24
...
@@ -2,8 +2,6 @@ package com.baosight.hggp.util;
...
@@ -2,8 +2,6 @@ package com.baosight.hggp.util;
import
com.baosight.hggp.core.constant.OSConstant
;
import
com.baosight.hggp.core.constant.OSConstant
;
import
org.apache.poi.util.IOUtils
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.BufferedOutputStream
;
...
@@ -665,4 +663,57 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
...
@@ -665,4 +663,57 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
throw
e
;
throw
e
;
}
}
}
}
/**
* URL编码
*
* @param url
* @return
*/
public
static
String
returnDocUrlByEncodeFileName
(
String
url
)
{
if
(
url
!=
null
&&
!
url
.
trim
().
isEmpty
())
{
String
startSymbol
=
"/"
;
String
endSymbol
=
"?"
;
int
lastSlashIndex
=
url
.
lastIndexOf
(
startSymbol
);
int
questionMarkIndex
=
url
.
lastIndexOf
(
endSymbol
);
int
startIndex
=
lastSlashIndex
+
1
;
int
endIndex
=
questionMarkIndex
>
startIndex
?
questionMarkIndex
:
url
.
length
();
String
replaceUrlStr
=
url
.
substring
(
startIndex
,
endIndex
);
if
(
containsChinese
(
replaceUrlStr
))
{
try
{
replaceUrlStr
=
getEncodeFileName
(
replaceUrlStr
);
}
catch
(
UnsupportedEncodingException
var9
)
{
UnsupportedEncodingException
e
=
var9
;
throw
new
RuntimeException
(
e
);
}
}
return
url
.
substring
(
0
,
startIndex
)
+
replaceUrlStr
+
url
.
substring
(
endIndex
);
}
else
{
return
url
;
}
}
public
static
boolean
containsChinese
(
String
str
)
{
if
(
str
!=
null
&&
!
str
.
trim
().
isEmpty
())
{
char
[]
var1
=
str
.
toCharArray
();
int
var2
=
var1
.
length
;
for
(
int
var3
=
0
;
var3
<
var2
;
++
var3
)
{
char
c
=
var1
[
var3
];
if
(
c
>=
19968
&&
c
<=
'龥'
)
{
return
true
;
}
}
return
false
;
}
else
{
return
false
;
}
}
public
static
String
getEncodeFileName
(
String
fileName
)
throws
UnsupportedEncodingException
{
String
downloadFileName
=
URLEncoder
.
encode
(
fileName
,
"UTF-8"
);
return
downloadFileName
.
replaceAll
(
"\\+"
,
"%20"
);
}
}
}
src/main/java/com/baosight/iplat4j/eu/dm/sql/EUDM02.xml
0 → 100644
View file @
00eb6d24
This diff is collapsed.
Click to expand it.
src/main/java/com/baosight/iplat4j/eu/dm/sql/EUDM05.xml
0 → 100644
View file @
00eb6d24
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap
namespace=
"EUDM05"
>
<select
id=
"getDocByDocId"
parameterClass=
"java.util.HashMap"
resultClass=
"com.baosight.iplat4j.common.eu.domain.Teudm05"
>
SELECT
RES_ID as "resId",
<!-- 资源ID -->
PROJECT_ENAME as "projectEname",
<!-- 项目英文名 -->
APP_ID as "appId",
<!-- 应用标识 -->
RES_TYPE as "resType",
<!-- 资源类型 -->
RES_ENAME as "resEname",
<!-- 资源英文名 -->
RES_CNAME as "resCname",
<!-- 资源中文名 -->
IS_AUTH as "isAuth",
<!-- 是否授权 -->
GROUP_ID as "groupId",
<!-- 文件组名 -->
STORAGE_TYPE as "storageType",
<!-- 存储类型 -->
BUCKET_NAME as "bucketName",
<!-- 桶名 -->
FILE_EXTENSION as "fileExtension",
<!-- 文件后缀名 -->
FILE_SIZE as "fileSize",
<!-- 文件大小 -->
FILE_HASH_VALUE as "fileHashValue",
<!-- 文件HASH值 -->
URL as "url",
<!-- 永久链接 -->
PREVIEW_URL as "previewUrl",
<!-- 预览链接 -->
SORT as "sort",
<!-- 排序 -->
UPLOAD_TYPE as "uploadType",
<!-- 上传类型 -->
ENCRYPTION_LEVEL as "encryptionLevel",
<!-- 加密级别 -->
DEVICE_ID as "deviceId",
<!-- 设备ID -->
DOC_TYPE_ENAME as "docTypeEname",
<!-- 文档类型 -->
FILE_TYPE as "fileType",
<!-- 文件业务类型 -->
ORG_CODE as "orgCode",
<!-- 组织机构编码 -->
ORG_NAME as "orgName",
<!-- 组织机构名称 -->
FILE_STATUS as "fileStatus",
<!-- 预留字段1 -->
RESERVED_FIELD2 as "reservedField2",
<!-- 预留字段2 -->
RESERVED_FIELD3 as "reservedField3",
<!-- 预留字段3 -->
RESERVED_FIELD4 as "reservedField4",
<!-- 预留字段4 -->
RESERVED_FIELD5 as "reservedField5",
<!-- 预留字段5 -->
REC_CREATOR as "recCreator",
<!-- 创建者 -->
REC_CREATE_TIME as "recCreateTime",
<!-- 记录创建时间 -->
REC_REVISOR as "recRevisor",
<!-- 修改者 -->
REC_REVISE_TIME as "recReviseTime",
<!-- 记录修改时间 -->
ARCHIVE_FLAG as "archiveFlag",
<!-- 归档标记 -->
TENANT_ID as "tenantId",
<!-- 租户标识 -->
FILE_ID as "fileId",
PLATFORM_CODE as "platformCode",
DOC_TYPE as "docType",
CUSTOM_FOLDER as "customFolder",
CLIENT_ID as "clientId",
<!-- 客服端标识 -->
CONFIG_PATH_DEFINE as "configPathDefine",
SHARED_DOC_TYPE as "sharedDocType"
FROM ${platSchema}.TEUDM05 WHERE 1=1
<isNotEmpty
prepend=
" AND "
property=
"resId"
>
RES_ID = #resId#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"resIds"
>
RES_ID IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"resIds"
>
#resIds[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"projectEname"
>
PROJECT_ENAME = #projectEname#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"groupId"
>
GROUP_ID = #groupId#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"appId"
>
APP_ID = #appId#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"fileStatus"
>
FILE_STATUS = #fileStatus#
</isNotEmpty>
<dynamic
prepend=
"ORDER BY"
>
<isNotEmpty
property=
"orderBy"
>
$orderBy$
</isNotEmpty>
<isEmpty
property=
"orderBy"
>
SORT desc
</isEmpty>
</dynamic>
</select>
<update
id=
"updateToDocMap"
>
UPDATE ${platSchema}.TEUDM05
SET
RES_TYPE = #resType#,
<!-- 资源类型 -->
FILE_SIZE = #fileSize:NUMERIC#,
<!-- 文件大小 -->
FILE_HASH_VALUE = #fileHashValue#,
<!-- 文件HASH值 -->
FILE_STATUS = #fileStatus#,
<!-- 状态 -->
REC_REVISOR = #recRevisor#,
<!-- 修改者 -->
REC_REVISE_TIME = #recReviseTime#
<!-- 记录修改时间 -->
WHERE
RES_ID = #resId#
</update>
<update
id=
"updateShareDocType"
>
UPDATE ${platSchema}.TEUDM05
SET
REC_REVISOR = #recRevisor#,
<!-- 修改者 -->
REC_REVISE_TIME = #recReviseTime#,
<!-- 记录修改时间 -->
SHARED_DOC_TYPE = #sharedDocType#
WHERE
RES_ID = #resId#
</update>
</sqlMap>
\ No newline at end of file
src/main/webapp/HG/WD/HGWD002A1.js
View file @
00eb6d24
...
@@ -34,7 +34,9 @@ function addRecord(fileId, docId, docType, docName) {
...
@@ -34,7 +34,9 @@ function addRecord(fileId, docId, docType, docName) {
onSuccess
:
function
(
res
)
{
onSuccess
:
function
(
res
)
{
if
(
res
.
getStatus
()
>=
0
)
{
if
(
res
.
getStatus
()
>=
0
)
{
try
{
try
{
previewFile
(
docId
,
docType
,
docName
);
let
url
=
res
.
extAttr
.
url
;
let
docType
=
res
.
extAttr
.
docType
;
previewFile
(
url
,
docType
);
}
catch
(
e
)
{
}
catch
(
e
)
{
}
}
}
else
{
}
else
{
...
@@ -52,27 +54,26 @@ function addRecord(fileId, docId, docType, docName) {
...
@@ -52,27 +54,26 @@ function addRecord(fileId, docId, docType, docName) {
/**
/**
* 新增记录后回调
* 新增记录后回调
*
*
* @param
docId
* @param
url
* @param docType
* @param docType
* @param docName
*/
*/
function
previewFile
(
docId
,
docType
,
docNam
e
)
{
function
previewFile
(
url
,
docTyp
e
)
{
// 隐藏文本描述
// 隐藏文本描述
$
(
"#descDiv"
).
css
(
'display'
,
'none'
);
$
(
"#descDiv"
).
css
(
'display'
,
'none'
);
if
(
isXml
(
docType
))
{
if
(
isXml
(
docType
))
{
previewXml
(
docId
);
previewXml
(
url
);
}
else
if
(
isExcel
(
docType
))
{
}
else
if
(
isExcel
(
docType
))
{
previewExcel
(
docId
);
previewExcel
(
url
);
}
else
if
(
isWord
(
docType
))
{
previewDocx
(
url
);
}
else
if
(
true
)
{
}
else
if
(
true
)
{
previewOnline
(
docId
,
docName
);
previewOnline
(
url
);
}
else
if
(
isText
(
docType
))
{
}
else
if
(
isText
(
docType
))
{
previewText
(
docId
);
previewText
(
url
);
}
else
if
(
isWord
(
docType
))
{
previewDocx
(
docId
);
}
else
if
(
isImage
(
docType
))
{
}
else
if
(
isImage
(
docType
))
{
previewImage
(
docId
);
previewImage
(
url
);
}
else
if
(
isFrame
(
docType
))
{
}
else
if
(
isFrame
(
docType
))
{
previewFrame
(
docId
);
previewFrame
(
url
);
}
else
{
}
else
{
otherDownload
(
false
,
docId
);
otherDownload
(
false
,
docId
);
}
}
...
@@ -145,10 +146,10 @@ function isXml(docType) {
...
@@ -145,10 +146,10 @@ function isXml(docType) {
/**
/**
* xml文件预览
* xml文件预览
*
*
* @param
docId
* @param
url
*/
*/
function
previewXml
(
docId
)
{
function
previewXml
(
url
)
{
fetch
(
downloadHref
(
docId
,
true
)
).
then
(
res
=>
{
fetch
(
url
).
then
(
res
=>
{
return
res
.
text
();
return
res
.
text
();
}).
then
(
data
=>
{
}).
then
(
data
=>
{
let
container
=
document
.
getElementById
(
"textContainer"
);
let
container
=
document
.
getElementById
(
"textContainer"
);
...
@@ -174,10 +175,10 @@ function isExcel(docType) {
...
@@ -174,10 +175,10 @@ function isExcel(docType) {
/**
/**
* 文件预览
* 文件预览
*
*
* @param
docId
* @param
url
*/
*/
function
previewExcel
(
docId
)
{
function
previewExcel
(
url
)
{
fetch
(
downloadHref
(
docId
,
true
)
).
then
(
res
=>
{
fetch
(
url
).
then
(
res
=>
{
return
res
.
blob
();
return
res
.
blob
();
}).
then
(
blob
=>
{
}).
then
(
blob
=>
{
let
container
=
document
.
getElementById
(
"textContainer"
);
let
container
=
document
.
getElementById
(
"textContainer"
);
...
@@ -223,10 +224,10 @@ function isWord(docType) {
...
@@ -223,10 +224,10 @@ function isWord(docType) {
/**
/**
* docx预览
* docx预览
*
*
* @param
docId
* @param
url
*/
*/
function
previewDocx
(
docId
)
{
function
previewDocx
(
url
)
{
fetch
(
downloadHref
(
docId
,
true
)
).
then
(
res
=>
{
fetch
(
url
).
then
(
res
=>
{
return
res
.
arrayBuffer
();
return
res
.
arrayBuffer
();
}).
then
(
arrayBuffer
=>
{
}).
then
(
arrayBuffer
=>
{
let
container
=
document
.
getElementById
(
"docxContainer"
);
let
container
=
document
.
getElementById
(
"docxContainer"
);
...
@@ -288,12 +289,11 @@ function previewFrame(docId) {
...
@@ -288,12 +289,11 @@ function previewFrame(docId) {
/**
/**
* 在线预览
* 在线预览
*
*
* @param docId
* @param url
* @param fileName
*/
*/
function
previewOnline
(
docId
,
fileName
)
{
function
previewOnline
(
url
)
{
$
(
"#previewFrame"
).
css
(
'display'
,
''
);
$
(
"#previewFrame"
).
css
(
'display'
,
''
);
$
(
"#previewFrame"
).
attr
(
"src"
,
CommonUtils
.
previewFile
(
docId
,
fileName
));
$
(
"#previewFrame"
).
attr
(
"src"
,
CommonUtils
.
previewFile
(
url
));
}
}
/**
/**
...
...
src/main/webapp/HG/WD/HGWD099A.jsp
View file @
00eb6d24
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
<EF:EFInput cname="操作类型" ename="operType" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="操作类型" ename="operType" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFRegion id="result">
<EF:EFRegion id="result">
<EF:EFUpload blockId="result" ename="uploadFile" docTag="wd_file" path="
WD
"/>
<EF:EFUpload blockId="result" ename="uploadFile" docTag="wd_file" path="
upload
"/>
</EF:EFRegion>
</EF:EFRegion>
<EF:EFInput ename="fileDocId" cname="" hidden="true"/>
<EF:EFInput ename="fileDocId" cname="" hidden="true"/>
</EF:EFPage>
</EF:EFPage>
...
...
src/main/webapp/common/js/common.js
View file @
00eb6d24
...
@@ -668,25 +668,24 @@ function loadChange(grid,e,field) {
...
@@ -668,25 +668,24 @@ function loadChange(grid,e,field) {
/**
/**
* 预览
* 预览
*
*
* @param docId 文件ID
* @param url 文件URL
* @param docName 文件名称必须带后缀
*/
*/
let
previewFile
=
function
(
docId
,
docName
)
{
let
previewFile
=
function
(
url
)
{
let
hostname
=
window
.
location
.
hostname
;
//
let hostname = window.location.hostname;
let
domain
=
hostname
===
"localhost"
?
"http://129.211.46.84:8085"
:
window
.
location
.
origin
;
//
let domain = hostname === "localhost" ? "http://129.211.46.84:8085" : window.location.origin;
let
url
=
domain
+
IPLATUI
.
CONTEXT_PATH
+
'/file/download/preview/'
+
docId
//
let url = domain + IPLATUI.CONTEXT_PATH + '/file/download/preview/' + docId
+
"?fullfilename="
;
//
+ "?fullfilename=";
// Base64转码
// Base64转码
let
urlEncode
;
let
urlEncode
;
try
{
try
{
docName
=
encodeURIComponent
(
docName
);
urlEncode
=
encodeURIComponent
(
btoa
(
url
));
urlEncode
=
encodeURIComponent
(
btoa
(
url
+
docName
));
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
"encodeURIComponent fail:"
,
e
)
console
.
error
(
"encodeURIComponent fail:"
,
e
)
let
newDocName
=
docId
+
docName
.
substring
(
docName
.
lastIndexOf
(
"."
))
message
(
"预览失败,文件地址存在非法字符!"
);
urlEncode
=
encodeURIComponent
(
btoa
(
url
+
newDocName
))
;
return
;
}
}
if
(
urlEncode
===
""
)
{
if
(
isBlank
(
urlEncode
))
{
message
(
"预览失败,文件地址为空!"
);
return
;
return
;
}
}
if
(
PROJECT_ENV
===
"run"
||
PROJECT_ENV
===
"RUN"
)
{
if
(
PROJECT_ENV
===
"run"
||
PROJECT_ENV
===
"RUN"
)
{
...
@@ -694,6 +693,19 @@ function loadChange(grid,e,field) {
...
@@ -694,6 +693,19 @@ function loadChange(grid,e,field) {
}
else
{
}
else
{
return
"http://139.224.202.156:8012/preview/onlinePreview?url="
+
urlEncode
;
return
"http://139.224.202.156:8012/preview/onlinePreview?url="
+
urlEncode
;
}
}
// 本地调试使用
// return "http://localhost:8012/preview/onlinePreview?url=" + urlEncode;
}
/**
* 判断是否为null
*
* @param value
* @returns {boolean}
*/
function
isBlank
(
data
)
{
return
data
==
null
||
data
===
undefined
||
data
===
'null'
||
$
.
trim
(
data
)
===
''
||
data
===
'undefined'
||
data
===
'unknown'
;
}
}
// export 到全局作用域 window对象
// export 到全局作用域 window对象
...
@@ -702,6 +714,7 @@ function loadChange(grid,e,field) {
...
@@ -702,6 +714,7 @@ function loadChange(grid,e,field) {
uploadFile
:
uploadFile
,
uploadFile
:
uploadFile
,
downloadFile
:
downloadFile
,
downloadFile
:
downloadFile
,
previewFile
:
previewFile
,
previewFile
:
previewFile
,
isBlank
:
isBlank
}
}
});
});
})(
window
.
jQuery
);
})(
window
.
jQuery
);
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