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
2dc9a6fe
Commit
2dc9a6fe
authored
Oct 24, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://git.pseer.com:8800/platform/hg-smart
into dev-ly
parents
7c8d71cb
f1cd8d97
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
736 additions
and
152 deletions
+736
-152
FileDownloadController.java
.../com/baosight/hggp/controller/FileDownloadController.java
+4
-33
OSConstant.java
...main/java/com/baosight/hggp/core/constant/OSConstant.java
+15
-3
DcContract.java
...m/baosight/hggp/core/extapp/decheng/model/DcContract.java
+6
-0
DcApiUtils.java
...m/baosight/hggp/core/extapp/decheng/utils/DcApiUtils.java
+1
-0
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
ServiceHGSC101.java
.../java/com/baosight/hggp/hg/sc/service/ServiceHGSC101.java
+2
-10
ServiceHGWD001B.java
...java/com/baosight/hggp/hg/wd/service/ServiceHGWD001B.java
+15
-10
ServiceHGWD001C.java
...java/com/baosight/hggp/hg/wd/service/ServiceHGWD001C.java
+10
-6
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
HGSC012.js
src/main/webapp/HG/SC/HGSC012.js
+0
-0
HGSC012.jsp
src/main/webapp/HG/SC/HGSC012.jsp
+104
-14
HGWD001.js
src/main/webapp/HG/WD/HGWD001.js
+3
-23
HGWD001.jsp
src/main/webapp/HG/WD/HGWD001.jsp
+1
-0
HGWD001C1.js
src/main/webapp/HG/WD/HGWD001C1.js
+4
-3
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/controller/FileDownloadController.java
View file @
2dc9a6fe
...
...
@@ -3,6 +3,7 @@ package com.baosight.hggp.controller;
import
com.baosight.hggp.core.constant.S3Constant
;
import
com.baosight.hggp.core.utils.Iplat4jUtils
;
import
com.baosight.hggp.core.utils.S3Utils
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.FileUtils
;
import
com.baosight.hggp.util.LogUtils
;
import
com.baosight.hggp.util.MapUtils
;
...
...
@@ -64,43 +65,13 @@ public class FileDownloadController {
@RequestMapping
({
"/{docId}"
})
public
void
download
(
@PathVariable
String
docId
,
HttpServletResponse
response
)
throws
IOException
{
try
{
if
(
"s3"
.
equalsIgnoreCase
(
S3Constant
.
FILE_LOCATION
))
{
Teudm05
dbDm05
=
S3Utils
.
buildUrl
(
docId
);
// S3地址有公网
response
.
sendRedirect
(
dbDm05
.
getUrl
());
// S3地址无公网
// FileUtils.downloadUrlFile(dbDm05.getUrl(), dbDm05.getResCname(), false, response);
}
else
{
Map
dbDm02
=
Iplat4jUtils
.
getDoc02ById
(
docId
);
String
returnUrl
=
MapUtils
.
getString
(
dbDm02
,
"url"
);
String
fileName
=
MapUtils
.
getString
(
dbDm02
,
"docName"
);
FileUtils
.
downloadFile
(
new
File
(
returnUrl
),
fileName
,
false
,
response
);
}
String
url
=
Iplat4jUtils
.
buildDocUrl
(
docId
);
AssertUtils
.
isEmpty
(
url
,
"文件地址为空"
);
response
.
sendRedirect
(
url
);
}
catch
(
Exception
e
)
{
String
msg
=
String
.
format
(
"下载文件【%s】失败!原因:%s"
,
docId
,
LogUtils
.
getMsg
(
e
));
response
.
getWriter
().
write
(
msg
);
}
}
/**
* 下载本地文件
*
* @param docId
* @param response
* @throws IOException
*/
@RequestMapping
({
"docId/{docId}"
})
public
void
downloadUrls
(
@PathVariable
String
docId
,
HttpServletResponse
response
)
throws
IOException
{
try
{
Map
dbDm02
=
Iplat4jUtils
.
getDoc02ById
(
docId
);
String
url
=
MapUtils
.
getString
(
dbDm02
,
"url"
);
String
fileName
=
MapUtils
.
getString
(
dbDm02
,
"docName"
);
FileUtils
.
downloadFile
(
new
File
(
url
),
fileName
,
false
,
response
);
}
catch
(
Exception
e
)
{
String
msg
=
String
.
format
(
"下载文件【%s】失败!原因:%s"
,
docId
,
LogUtils
.
getMsg
(
e
));
response
.
getWriter
().
write
(
msg
);
}
}
}
src/main/java/com/baosight/hggp/core/constant/OSConstant.java
View file @
2dc9a6fe
...
...
@@ -8,6 +8,8 @@
package
com
.
baosight
.
hggp
.
core
.
constant
;
import
com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext
;
/**
* 与操作系统 有关的一些常量.
*
...
...
@@ -17,6 +19,11 @@ package com.baosight.hggp.core.constant;
public
class
OSConstant
{
/**
* docRootDir
*/
public
static
String
DOC_ROOT_DIR
=
PlatApplicationContext
.
getProperty
(
"docRootDir"
);
/**
* 文件夹分隔符,不同OS下分隔符不同
*/
public
final
static
String
SEPARATOR
=
System
.
getProperty
(
"file.separator"
);
...
...
@@ -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/extapp/decheng/model/DcContract.java
View file @
2dc9a6fe
...
...
@@ -30,4 +30,10 @@ public class DcContract {
* 设计来源
*/
private
String
designSource
;
/**
* 审批状态
*/
private
String
spStatus
;
}
src/main/java/com/baosight/hggp/core/extapp/decheng/utils/DcApiUtils.java
View file @
2dc9a6fe
...
...
@@ -123,6 +123,7 @@ public class DcApiUtils {
dcContract
.
setHtid
(
dataJson
.
getString
(
"Htid"
));
dcContract
.
setTitle
(
dataJson
.
getString
(
"Title"
));
dcContract
.
setDesignSource
(
dataJson
.
getString
(
"!B__SysCusmf_0_11001_507_0"
));
dcContract
.
setSpStatus
(
dataJson
.
getString
(
"SpStatus"
));
return
dcContract
;
}
...
...
src/main/java/com/baosight/hggp/core/tools/Iplat4jTools.java
View file @
2dc9a6fe
...
...
@@ -3,7 +3,6 @@ package com.baosight.hggp.core.tools;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.util.AssertUtils
;
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.core.exception.PlatException
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -80,7 +79,7 @@ public class Iplat4jTools {
public
static
class
EuDm02
{
/**
* 查询
页面信息
* 查询
*
* @param docId
* @return
...
...
@@ -92,6 +91,19 @@ public class Iplat4jTools {
List
<
Map
>
results
=
DaoBase
.
getInstance
().
query
(
"EUDM02.queryDocById"
,
paramMap
);
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 {
List
<
Teudm05
>
results
=
DaoBase
.
getInstance
().
query
(
"EUDM05.getDocByDocId"
,
paramMap
);
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 @
2dc9a6fe
...
...
@@ -12,7 +12,9 @@ import com.baosight.iplat4j.common.eu.domain.Teudm05;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext
;
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.Map
;
...
...
@@ -33,8 +35,7 @@ public class Iplat4jUtils {
*/
public
static
boolean
deleteFileByDocId
(
String
docId
)
{
// 判断文件上传的地址
String
fileLocation
=
S3Constant
.
FILE_LOCATION
;
if
(
"s3"
.
equalsIgnoreCase
(
fileLocation
))
{
if
(
"s3"
.
equalsIgnoreCase
(
S3Constant
.
FILE_LOCATION
))
{
Teudm05
dbDm05
=
Iplat4jTools
.
EuDm05
.
getByDocId
(
docId
);
if
(
dbDm05
==
null
)
{
throw
new
PlatException
(
"文件在服务器中不存在"
);
...
...
@@ -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
...
...
@@ -111,7 +171,7 @@ public class Iplat4jUtils {
// 压缩完删除本地文件
FileUtils
.
deleteFiles
(
zipFolderPath
);
// 替换成HTTP地址
return
S3Constant
.
RESOURCE
+
zipFilePath
.
replace
(
OSConstant
.
USER
_DIR
,
""
)
return
S3Constant
.
RESOURCE
+
"/"
+
OSConstant
.
FILE_DOWNLOAD
+
zipFilePath
.
replace
(
OSConstant
.
DOC_ROOT
_DIR
,
""
)
.
replace
(
OSConstant
.
SEPARATOR
,
"/"
);
}
...
...
src/main/java/com/baosight/hggp/core/utils/S3Utils.java
View file @
2dc9a6fe
...
...
@@ -4,6 +4,7 @@ import com.amazonaws.services.s3.AmazonS3;
import
com.baosight.hggp.core.constant.S3Constant
;
import
com.baosight.hggp.core.tools.Iplat4jTools
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.FileUtils
;
import
com.baosight.hggp.util.StringUtils
;
import
com.baosight.iplat4j.common.eu.domain.Teudm05
;
import
com.baosight.iplat4j.eu.dm.document.bos.s3.api.signed.SignedBosHelp
;
...
...
@@ -28,17 +29,37 @@ public class S3Utils {
*/
public
static
Teudm05
buildUrl
(
String
docId
)
throws
Exception
{
Teudm05
dbDm05
=
Iplat4jTools
.
EuDm05
.
getByDocId
(
docId
);
AssertUtils
.
isNull
(
dbDm05
,
String
.
format
(
"文件【%s】不存在"
,
docId
));
String
s3UrlPrefix
=
dbDm05
.
getUrl
();
String
fileName
=
dbDm05
.
getResCname
();
String
returnUrlPrefix
=
BosParamHelp
.
disposeUrl
(
s3UrlPrefix
);
URL
s3Url
=
SignedBosHelp
.
getDownloadTempUrl
(
s3UrlPrefix
,
fileName
,
null
);
String
s3UrlParam
=
StringUtils
.
defaultIfEmpty
(
s3Url
.
getQuery
(),
""
);
String
returnUrl
=
returnUrlPrefix
+
"?"
+
s3UrlParam
;
dbDm05
.
setUrl
(
com
.
baosight
.
iplat4j
.
eu
.
dm
.
util
.
FileUtils
.
returnDocUrlByEncodeFileName
(
returnUrl
));
dbDm05
.
setUrl
(
FileUtils
.
returnDocUrlByEncodeFileName
(
returnUrl
));
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值作为文件名
...
...
src/main/java/com/baosight/hggp/hg/sc/service/ServiceHGSC101.java
View file @
2dc9a6fe
...
...
@@ -5,8 +5,6 @@ import com.baosight.hggp.core.dao.DaoUtils;
import
com.baosight.hggp.core.extapp.decheng.api.DcOpenApi
;
import
com.baosight.hggp.core.extapp.decheng.model.DcContract
;
import
com.baosight.hggp.core.extapp.decheng.model.DcContractList
;
import
com.baosight.hggp.core.extapp.decheng.model.DcUser
;
import
com.baosight.hggp.core.extapp.decheng.model.DcUserList
;
import
com.baosight.hggp.core.model.Pager
;
import
com.baosight.hggp.core.utils.ThreadUtils
;
import
com.baosight.hggp.hg.pz.domain.HGPZ009
;
...
...
@@ -16,17 +14,11 @@ import com.baosight.hggp.hg.sc.domain.HGSC001;
import
com.baosight.hggp.hg.sc.enums.ProjectSourceEnum
;
import
com.baosight.hggp.hg.sc.tools.HGSCTools
;
import
com.baosight.hggp.hg.wd.constant.HgWdSqlConstant
;
import
com.baosight.hggp.hg.wd.tools.HGWDTools
;
import
com.baosight.hggp.hg.xs.constant.HgXsSqlConstant
;
import
com.baosight.hggp.hg.xs.domain.User
;
import
com.baosight.hggp.hg.xs.tools.HGXSTools
;
import
com.baosight.hggp.hg.xs.utils.HGXSUtils
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.DateUtils
;
import
com.baosight.hggp.util.EiInfoUtils
;
import
com.baosight.hggp.util.LogUtils
;
import
com.baosight.hggp.util.MapUtils
;
import
com.baosight.hggp.util.StringUtils
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
...
...
@@ -175,9 +167,9 @@ public class ServiceHGSC101 extends ServiceEPBase {
* @param dcContractList
*/
private
void
syncDcContractSingle
(
HGPZ009
dbPz009
,
DcContractList
dcContractList
)
throws
IOException
{
// 获取
用户
详情
// 获取
合同
详情
DcContract
dcContract
=
DcOpenApi
.
contractDetail
(
dcContractList
.
getOrd
());
if
(
dcContract
==
null
)
{
if
(
dcContract
==
null
||
!
"审批通过"
.
equals
(
dcContract
.
getSpStatus
())
)
{
return
;
}
dcContract
.
setOrd
(
dcContractList
.
getOrd
());
...
...
src/main/java/com/baosight/hggp/hg/wd/service/ServiceHGWD001B.java
View file @
2dc9a6fe
...
...
@@ -3,9 +3,10 @@ package com.baosight.hggp.hg.wd.service;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.core.dao.DaoUtils
;
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.HGWD002
;
import
com.baosight.hggp.hg.wd.domain.HGWD099
;
import
com.baosight.hggp.hg.wd.tools.HGWDTools
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.EiInfoUtils
;
...
...
@@ -17,7 +18,6 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -91,15 +91,20 @@ public class ServiceHGWD001B extends ServiceBase {
*/
public
EiInfo
add
(
EiInfo
inInfo
)
{
try
{
List
<
HGWD001B
>
fWd001bs
=
MapUtils
.
toDaoEPBases
(
inInfo
,
HGWD001B
.
class
);
for
(
HGWD001B
fWd001b
:
fWd001bs
)
{
HGWD001B
fWd001b
=
MapUtils
.
toDaoEPBase
(
inInfo
,
HGWD001B
.
class
);
// AssertUtils.isEmpty(fWd001b.getFileId(), "文件ID不能为空");
// 预览记录+1
HGWDTools
.
HgWd099
.
previewIncr
(
fWd001b
.
getDocId
());
// 新增
fWd001b
.
setDeleteFlag
(
DeleteFlagEnum
.
UN_REMOVE
.
getCode
());
DaoUtils
.
insert
(
HGWD001B
.
INSERT
,
fWd001b
);
}
HGWD099
dbWd099
=
HGWDTools
.
HgWd099
.
getByDocId
(
fWd001b
.
getDocId
());
AssertUtils
.
isNull
(
dbWd099
,
"文件不存在"
);
// 预览次数+1
HGWDTools
.
HgWd099
.
previewIncr
(
fWd001b
.
getDocId
());
// 新增记录
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
.
setMsg
(
"操作成功"
);
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/baosight/hggp/hg/wd/service/ServiceHGWD001C.java
View file @
2dc9a6fe
...
...
@@ -96,8 +96,13 @@ public class ServiceHGWD001C extends ServiceBase {
*/
public
EiInfo
add
(
EiInfo
inInfo
)
{
try
{
HGWD001C
fWd001C
=
MapUtils
.
toDaoEPBase
(
inInfo
,
EiConstant
.
resultBlock
,
HGWD001C
.
class
);
// 写入下载记录
this
.
saveData
(
inInfo
);
this
.
saveData
(
inInfo
,
fWd001C
.
getFileId
());
// 构建文件HTTP地址
String
url
=
Iplat4jUtils
.
buildDocUrl
(
fWd001C
.
getDocId
());
AssertUtils
.
isEmpty
(
url
,
"文件地址异常,请联系管理人员!"
);
inInfo
.
set
(
"url"
,
url
);
inInfo
.
setMsg
(
"操作成功"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"操作失败"
);
...
...
@@ -114,12 +119,13 @@ public class ServiceHGWD001C extends ServiceBase {
public
EiInfo
batchDownload
(
EiInfo
inInfo
)
{
try
{
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
fileId
=
MapUtils
.
getString
(
queryMap
,
HGWD001
.
FIELD_FILE_ID
);
String
fileName
=
MapUtils
.
getString
(
queryMap
,
HGWD001
.
FIELD_FILE_NAME
);
String
zipName
=
fileName
+
"_"
+
DateUtils
.
shortDateTime
();
List
<
String
>
docIds
=
ObjectUtils
.
listKey
(
inInfo
,
HGWD099
.
FIELD_DOC_ID
);
inInfo
.
set
(
"
downloadU
rl"
,
Iplat4jUtils
.
compressFile
(
docIds
,
zipName
));
inInfo
.
set
(
"
u
rl"
,
Iplat4jUtils
.
compressFile
(
docIds
,
zipName
));
// 写入下载记录
this
.
saveData
(
inInfo
);
this
.
saveData
(
inInfo
,
fileId
);
}
catch
(
Exception
e
)
{
LogUtils
.
setMsg
(
inInfo
,
e
,
"批量下载失败"
);
}
...
...
@@ -131,9 +137,7 @@ public class ServiceHGWD001C extends ServiceBase {
*
* @param inInfo
*/
private
void
saveData
(
EiInfo
inInfo
)
{
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
fileId
=
MapUtils
.
getString
(
queryMap
,
HGWD001
.
FIELD_FILE_ID
);
private
void
saveData
(
EiInfo
inInfo
,
String
fileId
)
{
AssertUtils
.
isEmpty
(
fileId
,
"文件ID不能为空"
);
List
<
HGWD001C
>
fWd001Cs
=
MapUtils
.
toDaoEPBases
(
inInfo
,
HGWD001C
.
class
);
for
(
HGWD001C
fWd001c
:
fWd001Cs
)
{
...
...
src/main/java/com/baosight/hggp/hg/wd/service/ServiceHGWD002.java
View file @
2dc9a6fe
...
...
@@ -78,7 +78,6 @@ public class ServiceHGWD002 extends ServiceBase {
return
inInfo
;
}
public
void
builder
(
EiInfo
eiInfo
)
{
String
[]
orderBy
=
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getString
(
"orderBy"
).
split
(
","
);
if
(
orderBy
.
length
>
0
)
{
...
...
src/main/java/com/baosight/hggp/hg/wd/tools/HGWDTools.java
View file @
2dc9a6fe
...
...
@@ -378,12 +378,12 @@ public class HGWDTools {
public
static
class
HgWd099
{
public
static
List
<
HGWD099
>
getByDocId
(
String
bizType
,
String
docId
)
{
public
static
HGWD099
getByDocId
(
String
docId
)
{
AssertUtils
.
isEmpty
(
docId
,
"文件ID不能为空"
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
HGWD099
.
FIELD_BIZ_TYPE
,
bizType
);
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 @
2dc9a6fe
...
...
@@ -2,8 +2,6 @@ package com.baosight.hggp.util;
import
com.baosight.hggp.core.constant.OSConstant
;
import
org.apache.poi.util.IOUtils
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
...
...
@@ -665,4 +663,57 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
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 @
2dc9a6fe
This diff is collapsed.
Click to expand it.
src/main/java/com/baosight/iplat4j/eu/dm/sql/EUDM05.xml
0 → 100644
View file @
2dc9a6fe
<?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/SC/HGSC012.js
View file @
2dc9a6fe
This diff is collapsed.
Click to expand it.
src/main/webapp/HG/SC/HGSC012.jsp
View file @
2dc9a6fe
<
%
--
Created
by
IntelliJ
IDEA
.
User:
1
Date:
2024
/
10
/
23
Time:
8:45
To
change
this
template
use
File
|
Settings
|
File
Templates
.
--
%
>
<!DOCTYPE html>
<
%@
page
import=
"com.baosight.iplat4j.core.web.threadlocal.UserSession"
%
>
<
%@
page
contentType=
"text/html;charset=UTF-8"
language=
"java"
%
>
<html>
<head>
<title>
Title
</title>
</head>
<body>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
prefix=
"EF"
tagdir=
"/WEB-INF/tags/EF"
%
>
<
%
String
loginName =
UserSession.getLoginName();
%
>
<c:set
var=
"ctx"
value=
"${pageContext.request.contextPath}"
/>
<c:set
var=
"loginName"
value=
"<%=loginName%>"
/>
<script>
var
ctx
=
"${ctx}"
;
</script>
<script
src=
"${ctx}/common/js/vue-2.6.10.js"
></script>
<style>
table
{
border-color
:
#99d2ff
;
}
table
tr
{
</body>
</html>
}
table
tr
th
{
padding
:
2px
8px
;
font-size
:
.8125rem
;
color
:
#2f80ed
;
background
:
#dbefff
;
height
:
30px
;
text-align
:
center
;
}
table
tr
th
span
{
white-space
:
nowrap
;
}
table
tr
td
span
{
white-space
:
nowrap
;
}
table
tr
td
{
padding
:
0
8px
;
height
:
25px
;
}
#table-box
{
position
:
relative
;
width
:
100%
;
overflow
:
auto
;
min-height
:
100%
;
height
:
74vh
;
}
#table-box
.table-content
{
position
:
absolute
;
min-height
:
100%
;
min-width
:
100%
;
}
</style>
<EF:EFPage
title=
"委外执行加工表"
>
<EF:EFRegion
id=
"inqu"
title=
"查询条件"
>
<div
class=
"row"
>
<EF:EFSelect
blockId=
"inqu_status"
row=
"0"
ename=
"companyCode"
cname=
"公司名称"
colWidth=
"3"
filter=
"contains"
>
<EF:EFOption
label=
"全部"
value=
""
/>
<EF:EFOptions
blockId=
"roleCompany"
textField=
"companyName"
valueField=
"companyCode"
/>
</EF:EFSelect>
<EF:EFDatePicker
blockId=
"inqu_status"
row=
"0"
ename=
"contractDate"
cname=
"委外加工日期"
role=
"date"
format=
"yyyy-MM-dd"
parseFormats=
"['yyyyMMdd']"
colWidth=
"3"
/>
<EF:EFInput
blockId=
"inqu_status"
row=
"0"
ename=
"contractCode"
cname=
"委外加工单号"
placeholder=
"模糊查询"
colWidth=
"3"
/>
<EF:EFSelect
blockId=
"inqu_status"
row=
"0"
ename=
"supCode"
cname=
"供应商名称"
colWidth=
"3"
filter=
"contains"
>
<EF:EFOption
label=
"全部"
value=
""
/>
<EF:EFOptions
blockId=
"sup_record_block_id"
textField=
"textField"
valueField=
"valueField"
/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion
id=
"result"
title=
"明细信息"
>
<EF:EFGrid
blockId=
"result"
autoDraw=
"override"
isFloat=
"true"
checkMode=
"row"
>
</EF:EFGrid>
<section
id=
"table-box"
>
<section
class=
"table-content"
>
<table
border=
"1"
>
<colgroup>
<col
v-for=
"(item,k) in columns2"
:key=
"k"
>
</colgroup>
<thead>
<tr>
<th
v-for=
"(item,k) in columns"
:key=
"k"
:colspan=
"item.colspan"
>
<span>
{{item.label}}
</span>
</th>
</tr>
<tr>
<th
v-for=
"(item,k) in columns2"
:key=
"k"
>
<span>
{{item.label}}
</span>
</th>
</tr>
</thead>
<tbody>
<tr
v-for=
"(valObj,i) in list"
:key=
"i"
>
<td
v-for=
"(item,k) in columns2"
:key=
"k"
v-if=
"valObj[item.value].show"
:rowspan=
"valObj[item.value].rowspan"
>
<span>
{{valObj[item.value].value}}
</span>
</td>
</tr>
</tbody>
</table>
</section>
</section>
</EF:EFRegion>
</EF:EFPage>
src/main/webapp/HG/WD/HGWD001.js
View file @
2dc9a6fe
...
...
@@ -481,14 +481,12 @@ $(function () {
e
.
preventDefault
();
deleteFunc
();
},
columns
:
[
{
columns
:
[{
field
:
"operator"
,
title
:
"操作"
,
readonly
:
true
,
template
:
function
(
item
)
{
let
template
=
'<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+
'href="'
+
downloadHref
(
item
.
docId
)
+
'">下载</a>'
;
let
template
=
""
;
template
+=
'<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+
'onclick="changeFile(
\'
'
+
item
.
docId
+
'
\'
,
\'
'
+
item
.
bizId
+
'
\'
)" target="_blank">变更</a>'
;
template
+=
'<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
...
...
@@ -556,7 +554,7 @@ $(function () {
//确认发布
$
(
"#confirmRelease"
).
on
(
"click"
,
updateRelease
);
// 批量下载
$
(
"#BATCH_DOWNLOAD"
).
on
(
"click"
,
batchD
ownload
);
$
(
"#BATCH_DOWNLOAD"
).
on
(
"click"
,
d
ownload
);
});
let
query
=
function
()
{
...
...
@@ -1079,21 +1077,3 @@ let isProjectManager = function (parentId) {
}
},
{
async
:
false
})
}
/**
* 批量下载
*/
let
batchDownload
=
function
()
{
var
rows
=
resultGrid
.
getCheckedRows
();
if
(
rows
.
length
==
0
)
{
message
(
"请先勾选要下载的数据!"
);
return
;
}
JSUtils
.
submitGridsData
(
"result"
,
"HGWD001C"
,
"batchDownload"
,
false
,
function
(
res
)
{
if
(
res
.
status
>
-
1
)
{
window
.
open
(
res
.
extAttr
.
downloadUrl
,
'_blank'
);
}
}
);
}
src/main/webapp/HG/WD/HGWD001.jsp
View file @
2dc9a6fe
...
...
@@ -9,6 +9,7 @@
<c:set
var=
"ctx"
value=
"${pageContext.request.contextPath}"
/>
<c:set
var=
"loginName"
value=
"<%=userId%>"
/>
<script
type=
"text/javascript"
src=
"${ctx}/common/js/dayjs.min.js"
></script>
<script
src=
"${ctx}/HG/WD/HGWD001C1.js"
></script>
<EF:EFPage
title=
"文档库"
>
...
...
src/main/webapp/HG/WD/HGWD001C1.js
View file @
2dc9a6fe
...
...
@@ -20,13 +20,14 @@ let download = function () {
* @param row
*/
let
singleDownload
=
function
(
row
)
{
let
fileId
=
$
(
"#inqu_status-0-parentId"
).
val
();
let
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"result-0-fileId"
,
row
[
'fileId'
]
);
inInfo
.
set
(
"result-0-fileId"
,
fileId
);
inInfo
.
set
(
"result-0-docId"
,
row
[
'docId'
]);
EiCommunicator
.
send
(
"HGWD001C"
,
"add"
,
inInfo
,
{
onSuccess
(
res
)
{
if
(
res
.
status
>
-
1
)
{
window
.
open
(
CommonUtils
.
downloadFile
(
row
[
'docId'
],
false
)
,
'_blank'
);
window
.
open
(
res
.
extAttr
.
url
,
'_blank'
);
}
else
{
message
(
res
.
msg
);
}
...
...
@@ -44,7 +45,7 @@ let batchDownload = function () {
JSUtils
.
submitGridsData
(
"result"
,
"HGWD001C"
,
"batchDownload"
,
false
,
function
(
res
)
{
if
(
res
.
status
>
-
1
)
{
window
.
open
(
res
.
extAttr
.
downloadU
rl
,
'_blank'
);
window
.
open
(
res
.
extAttr
.
u
rl
,
'_blank'
);
}
}
);
...
...
src/main/webapp/HG/WD/HGWD002A1.js
View file @
2dc9a6fe
...
...
@@ -34,7 +34,9 @@ function addRecord(fileId, docId, docType, docName) {
onSuccess
:
function
(
res
)
{
if
(
res
.
getStatus
()
>=
0
)
{
try
{
previewFile
(
docId
,
docType
,
docName
);
let
url
=
res
.
extAttr
.
url
;
let
docType
=
res
.
extAttr
.
docType
;
previewFile
(
url
,
docType
);
}
catch
(
e
)
{
}
}
else
{
...
...
@@ -52,27 +54,26 @@ function addRecord(fileId, docId, docType, docName) {
/**
* 新增记录后回调
*
* @param
docId
* @param
url
* @param docType
* @param docName
*/
function
previewFile
(
docId
,
docType
,
docNam
e
)
{
function
previewFile
(
url
,
docTyp
e
)
{
// 隐藏文本描述
$
(
"#descDiv"
).
css
(
'display'
,
'none'
);
if
(
isXml
(
docType
))
{
previewXml
(
docId
);
previewXml
(
url
);
}
else
if
(
isExcel
(
docType
))
{
previewExcel
(
docId
);
previewExcel
(
url
);
}
else
if
(
isWord
(
docType
))
{
previewDocx
(
url
);
}
else
if
(
true
)
{
previewOnline
(
docId
,
docName
);
previewOnline
(
url
);
}
else
if
(
isText
(
docType
))
{
previewText
(
docId
);
}
else
if
(
isWord
(
docType
))
{
previewDocx
(
docId
);
previewText
(
url
);
}
else
if
(
isImage
(
docType
))
{
previewImage
(
docId
);
previewImage
(
url
);
}
else
if
(
isFrame
(
docType
))
{
previewFrame
(
docId
);
previewFrame
(
url
);
}
else
{
otherDownload
(
false
,
docId
);
}
...
...
@@ -145,10 +146,10 @@ function isXml(docType) {
/**
* xml文件预览
*
* @param
docId
* @param
url
*/
function
previewXml
(
docId
)
{
fetch
(
downloadHref
(
docId
,
true
)
).
then
(
res
=>
{
function
previewXml
(
url
)
{
fetch
(
url
).
then
(
res
=>
{
return
res
.
text
();
}).
then
(
data
=>
{
let
container
=
document
.
getElementById
(
"textContainer"
);
...
...
@@ -174,10 +175,10 @@ function isExcel(docType) {
/**
* 文件预览
*
* @param
docId
* @param
url
*/
function
previewExcel
(
docId
)
{
fetch
(
downloadHref
(
docId
,
true
)
).
then
(
res
=>
{
function
previewExcel
(
url
)
{
fetch
(
url
).
then
(
res
=>
{
return
res
.
blob
();
}).
then
(
blob
=>
{
let
container
=
document
.
getElementById
(
"textContainer"
);
...
...
@@ -223,10 +224,10 @@ function isWord(docType) {
/**
* docx预览
*
* @param
docId
* @param
url
*/
function
previewDocx
(
docId
)
{
fetch
(
downloadHref
(
docId
,
true
)
).
then
(
res
=>
{
function
previewDocx
(
url
)
{
fetch
(
url
).
then
(
res
=>
{
return
res
.
arrayBuffer
();
}).
then
(
arrayBuffer
=>
{
let
container
=
document
.
getElementById
(
"docxContainer"
);
...
...
@@ -288,12 +289,11 @@ function previewFrame(docId) {
/**
* 在线预览
*
* @param docId
* @param fileName
* @param url
*/
function
previewOnline
(
docId
,
fileName
)
{
function
previewOnline
(
url
)
{
$
(
"#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 @
2dc9a6fe
...
...
@@ -18,7 +18,7 @@
<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: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:EFInput ename="fileDocId" cname="" hidden="true"/>
</EF:EFPage>
...
...
src/main/webapp/common/js/common.js
View file @
2dc9a6fe
...
...
@@ -668,25 +668,24 @@ function loadChange(grid,e,field) {
/**
* 预览
*
* @param docId 文件ID
* @param docName 文件名称必须带后缀
* @param url 文件URL
*/
let
previewFile
=
function
(
docId
,
docName
)
{
let
hostname
=
window
.
location
.
hostname
;
let
domain
=
hostname
===
"localhost"
?
"http://129.211.46.84:8085"
:
window
.
location
.
origin
;
let
url
=
domain
+
IPLATUI
.
CONTEXT_PATH
+
'/file/download/preview/'
+
docId
+
"?fullfilename="
;
let
previewFile
=
function
(
url
)
{
//
let hostname = window.location.hostname;
//
let domain = hostname === "localhost" ? "http://129.211.46.84:8085" : window.location.origin;
//
let url = domain + IPLATUI.CONTEXT_PATH + '/file/download/preview/' + docId
//
+ "?fullfilename=";
// Base64转码
let
urlEncode
;
try
{
docName
=
encodeURIComponent
(
docName
);
urlEncode
=
encodeURIComponent
(
btoa
(
url
+
docName
));
urlEncode
=
encodeURIComponent
(
btoa
(
url
));
}
catch
(
e
)
{
console
.
error
(
"encodeURIComponent fail:"
,
e
)
let
newDocName
=
docId
+
docName
.
substring
(
docName
.
lastIndexOf
(
"."
))
urlEncode
=
encodeURIComponent
(
btoa
(
url
+
newDocName
))
;
message
(
"预览失败,文件地址存在非法字符!"
);
return
;
}
if
(
urlEncode
===
""
)
{
if
(
isBlank
(
urlEncode
))
{
message
(
"预览失败,文件地址为空!"
);
return
;
}
if
(
PROJECT_ENV
===
"run"
||
PROJECT_ENV
===
"RUN"
)
{
...
...
@@ -694,6 +693,19 @@ function loadChange(grid,e,field) {
}
else
{
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对象
...
...
@@ -702,6 +714,7 @@ function loadChange(grid,e,field) {
uploadFile
:
uploadFile
,
downloadFile
:
downloadFile
,
previewFile
:
previewFile
,
isBlank
:
isBlank
}
});
})(
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