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
c6adb2a7
Commit
c6adb2a7
authored
Oct 11, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.批量下载文件
parent
43c7eb17
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
609 additions
and
352 deletions
+609
-352
HggpApplication.java
src/main/java/com/baosight/hggp/HggpApplication.java
+23
-20
OSConstant.java
...main/java/com/baosight/hggp/core/constant/OSConstant.java
+7
-2
S3Constant.java
...main/java/com/baosight/hggp/core/constant/S3Constant.java
+5
-0
Iplat4jUtils.java
src/main/java/com/baosight/hggp/core/utils/Iplat4jUtils.java
+42
-0
ServiceHGCW999.java
.../java/com/baosight/hggp/hg/cw/service/ServiceHGCW999.java
+2
-1
ServiceHGPZ002A.java
...java/com/baosight/hggp/hg/pz/service/ServiceHGPZ002A.java
+2
-1
ServiceHGPZ009A.java
...java/com/baosight/hggp/hg/pz/service/ServiceHGPZ009A.java
+2
-1
ServiceHGSB099.java
.../java/com/baosight/hggp/hg/sb/service/ServiceHGSB099.java
+2
-1
ServiceHGWD001.java
.../java/com/baosight/hggp/hg/wd/service/ServiceHGWD001.java
+287
-267
ServiceHGXT099.java
.../java/com/baosight/hggp/hg/xt/service/ServiceHGXT099.java
+2
-1
ClearZipJob.java
src/main/java/com/baosight/hggp/job/ClearZipJob.java
+46
-0
FileUtils.java
src/main/java/com/baosight/hggp/util/FileUtils.java
+138
-45
ObjectUtils.java
src/main/java/com/baosight/hggp/util/ObjectUtils.java
+18
-0
HGWD001.js
src/main/webapp/HG/WD/HGWD001.js
+32
-12
HGWD001.jsp
src/main/webapp/HG/WD/HGWD001.jsp
+1
-1
No files found.
src/main/java/com/baosight/hggp/HggpApplication.java
View file @
c6adb2a7
...
@@ -10,30 +10,33 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
...
@@ -10,30 +10,33 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ImportResource
;
import
org.springframework.context.annotation.ImportResource
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.web.multipart.commons.CommonsMultipartResolver
;
import
org.springframework.web.multipart.commons.CommonsMultipartResolver
;
@EnableScheduling
@SpringBootApplication
(
scanBasePackages
=
"com.baosight"
)
@SpringBootApplication
(
scanBasePackages
=
"com.baosight"
)
@ServletComponentScan
(
"com.baosight.iplat4j.core.web.servlet"
)
@ServletComponentScan
(
"com.baosight.iplat4j.core.web.servlet"
)
@ImportResource
(
locations
=
{
"classpath*:spring/framework/platApplicationContext*.xml"
,
"classpath*:spring/framework/applicationContext*.xml"
})
@ImportResource
(
locations
=
{
"classpath*:spring/framework/platApplicationContext*.xml"
,
"classpath*:spring/framework/applicationContext*.xml"
})
@EnableConfigurationProperties
({
LiquibaseProperties
.
class
,
ApplicationProperties
.
class
})
@EnableConfigurationProperties
({
LiquibaseProperties
.
class
,
ApplicationProperties
.
class
})
public
class
HggpApplication
extends
SpringBootServletInitializer
{
public
class
HggpApplication
extends
SpringBootServletInitializer
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
app
=
new
SpringApplication
(
HggpApplication
.
class
);
SpringApplication
app
=
new
SpringApplication
(
HggpApplication
.
class
);
app
.
run
(
args
);
app
.
run
(
args
);
}
}
@Override
@Override
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
application
)
{
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
application
)
{
return
application
.
sources
(
HggpApplication
.
class
);
return
application
.
sources
(
HggpApplication
.
class
);
}
}
@Bean
(
"multipartResolver"
)
@Bean
(
"multipartResolver"
)
public
CommonsMultipartResolver
multipartResolver
()
{
public
CommonsMultipartResolver
multipartResolver
()
{
CommonsMultipartResolver
resolver
=
new
CommonsMultipartResolver
();
CommonsMultipartResolver
resolver
=
new
CommonsMultipartResolver
();
resolver
.
setDefaultEncoding
(
"UTF-8"
);
resolver
.
setDefaultEncoding
(
"UTF-8"
);
resolver
.
setMaxInMemorySize
(
10000
);
resolver
.
setMaxInMemorySize
(
10000
);
return
resolver
;
return
resolver
;
}
}
}
}
src/main/java/com/baosight/hggp/core/constant/OSConstant.java
View file @
c6adb2a7
...
@@ -34,11 +34,16 @@ public class OSConstant {
...
@@ -34,11 +34,16 @@ public class OSConstant {
/**
/**
* 程序运行目录
* 程序运行目录
*/
*/
public
final
static
String
DOWN_DIR
=
USER_DIR
+
SEPARATOR
+
"download"
;
public
final
static
String
DOWN_DIR
=
USER_DIR
+
SEPARATOR
+
"
file"
+
SEPARATOR
+
"
download"
;
/**
/**
* 二维码目录
* 二维码目录
*/
*/
public
final
static
String
QRCODE_DIR
=
USER_DIR
+
SEPARATOR
+
"qrcode"
;
public
final
static
String
QRCODE_DIR
=
USER_DIR
+
SEPARATOR
+
"file"
+
SEPARATOR
+
"qrcode"
;
/**
* 压缩包目录
*/
public
final
static
String
ZIP_DIR
=
USER_DIR
+
SEPARATOR
+
"file"
+
SEPARATOR
+
"zip"
;
}
}
src/main/java/com/baosight/hggp/core/constant/S3Constant.java
View file @
c6adb2a7
...
@@ -22,6 +22,11 @@ public class S3Constant {
...
@@ -22,6 +22,11 @@ public class S3Constant {
public
static
String
ENDPOINT
=
PlatApplicationContext
.
getProperty
(
"iplat4j.admin.objectStorage.s3.endpoint"
);
public
static
String
ENDPOINT
=
PlatApplicationContext
.
getProperty
(
"iplat4j.admin.objectStorage.s3.endpoint"
);
/**
/**
* resource
*/
public
static
String
RESOURCE
=
PlatApplicationContext
.
getProperty
(
"iplat4j.admin.objectStorage.s3.resource"
);
/**
* bucket名称
* bucket名称
*/
*/
public
static
String
BUCKET_NAME
=
PlatApplicationContext
.
getProperty
(
"iplat4j.admin.objectStorage.s3.bucket"
);
public
static
String
BUCKET_NAME
=
PlatApplicationContext
.
getProperty
(
"iplat4j.admin.objectStorage.s3.bucket"
);
...
...
src/main/java/com/baosight/hggp/core/utils/Iplat4jUtils.java
View file @
c6adb2a7
package
com
.
baosight
.
hggp
.
core
.
utils
;
package
com
.
baosight
.
hggp
.
core
.
utils
;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.core.constant.OSConstant
;
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.DateUtils
;
import
com.baosight.hggp.util.FileUtils
;
import
com.baosight.hggp.util.FileUtils
;
import
com.baosight.hggp.util.MapUtils
;
import
com.baosight.hggp.util.MapUtils
;
import
com.baosight.hggp.util.StringUtils
;
import
com.baosight.hggp.util.StringUtils
;
...
@@ -10,6 +13,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
...
@@ -10,6 +13,7 @@ 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
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -73,4 +77,42 @@ public class Iplat4jUtils {
...
@@ -73,4 +77,42 @@ public class Iplat4jUtils {
return
document
;
return
document
;
}
}
/**
* 压缩文件
*
* @param docIds
* @param zipName
* @return
*/
public
static
String
compressFile
(
List
<
String
>
docIds
,
String
zipName
)
throws
Exception
{
String
zipFolderPath
=
OSConstant
.
ZIP_DIR
+
OSConstant
.
SEPARATOR
+
DateUtils
.
shortDate
()
+
OSConstant
.
SEPARATOR
+
zipName
;
FileUtils
.
createDirs
(
zipFolderPath
);
String
zipFilePath
=
zipFolderPath
+
".zip"
;
if
(
CommonConstant
.
FileLocation
.
S3
.
equalsIgnoreCase
(
S3Constant
.
FILE_LOCATION
))
{
for
(
String
docId
:
docIds
)
{
Teudm05
dbDm05
=
S3Utils
.
buildUrl
(
docId
);
// 文件路径:压缩包路径+文件名称
String
localFilePath
=
zipFolderPath
+
OSConstant
.
SEPARATOR
+
dbDm05
.
getResCname
();
FileUtils
.
downloadUrlFile
(
dbDm05
.
getUrl
(),
localFilePath
);
}
}
else
{
for
(
String
docId
:
docIds
)
{
Map
dbDm02
=
Iplat4jUtils
.
getDoc02ById
(
docId
);
String
returnUrl
=
MapUtils
.
getString
(
dbDm02
,
"url"
);
String
docName
=
MapUtils
.
getString
(
dbDm02
,
"docName"
);
// 文件路径:压缩包路径+文件名称
String
localFilePath
=
zipFolderPath
+
OSConstant
.
SEPARATOR
+
docName
;
FileUtils
.
fileCopy
(
returnUrl
,
localFilePath
);
}
}
// 开始压缩
FileUtils
.
zip
(
zipFolderPath
,
zipFilePath
);
// 压缩完删除本地文件
FileUtils
.
deleteFiles
(
zipFolderPath
);
// 替换成HTTP地址
return
S3Constant
.
RESOURCE
+
zipFilePath
.
replace
(
OSConstant
.
USER_DIR
,
""
)
.
replace
(
OSConstant
.
SEPARATOR
,
"/"
);
}
}
}
src/main/java/com/baosight/hggp/hg/cw/service/ServiceHGCW999.java
View file @
c6adb2a7
...
@@ -17,6 +17,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
...
@@ -17,6 +17,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -161,7 +162,7 @@ public class ServiceHGCW999 extends ServiceEPBase {
...
@@ -161,7 +162,7 @@ public class ServiceHGCW999 extends ServiceEPBase {
* @param docId 文件ID
* @param docId 文件ID
*/
*/
@OperationLogAnnotation
(
operModul
=
"附件清单"
,
operType
=
"删除"
,
operDesc
=
"删除附件文件"
)
@OperationLogAnnotation
(
operModul
=
"附件清单"
,
operType
=
"删除"
,
operDesc
=
"删除附件文件"
)
public
void
delectDoc
(
String
docId
){
public
void
delectDoc
(
String
docId
)
throws
IOException
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"docId"
,
docId
);
map
.
put
(
"docId"
,
docId
);
List
<
HGDS002
>
list
=
this
.
dao
.
query
(
HGDS002
.
QUERY
,
map
);
List
<
HGDS002
>
list
=
this
.
dao
.
query
(
HGDS002
.
QUERY
,
map
);
...
...
src/main/java/com/baosight/hggp/hg/pz/service/ServiceHGPZ002A.java
View file @
c6adb2a7
...
@@ -14,6 +14,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
...
@@ -14,6 +14,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -133,7 +134,7 @@ public class ServiceHGPZ002A extends ServiceEPBase {
...
@@ -133,7 +134,7 @@ public class ServiceHGPZ002A extends ServiceEPBase {
* @param docId 文件ID
* @param docId 文件ID
*/
*/
@OperationLogAnnotation
(
operModul
=
"附件清单"
,
operType
=
"删除"
,
operDesc
=
"删除附件文件"
)
@OperationLogAnnotation
(
operModul
=
"附件清单"
,
operType
=
"删除"
,
operDesc
=
"删除附件文件"
)
public
void
delectDoc
(
String
docId
){
public
void
delectDoc
(
String
docId
)
throws
IOException
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"docId"
,
docId
);
map
.
put
(
"docId"
,
docId
);
List
<
HGDS002
>
list
=
this
.
dao
.
query
(
HGDS002
.
QUERY
,
map
);
List
<
HGDS002
>
list
=
this
.
dao
.
query
(
HGDS002
.
QUERY
,
map
);
...
...
src/main/java/com/baosight/hggp/hg/pz/service/ServiceHGPZ009A.java
View file @
c6adb2a7
...
@@ -17,6 +17,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
...
@@ -17,6 +17,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -127,7 +128,7 @@ public class ServiceHGPZ009A extends ServiceEPBase {
...
@@ -127,7 +128,7 @@ public class ServiceHGPZ009A extends ServiceEPBase {
* @param docId 文件ID
* @param docId 文件ID
*/
*/
@OperationLogAnnotation
(
operModul
=
"banner清单"
,
operType
=
"删除"
,
operDesc
=
"删除附件文件"
)
@OperationLogAnnotation
(
operModul
=
"banner清单"
,
operType
=
"删除"
,
operDesc
=
"删除附件文件"
)
public
void
delectDoc
(
String
docId
){
public
void
delectDoc
(
String
docId
)
throws
IOException
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"docId"
,
docId
);
map
.
put
(
"docId"
,
docId
);
List
<
HGDS002
>
list
=
this
.
dao
.
query
(
HGDS002
.
QUERY
,
map
);
List
<
HGDS002
>
list
=
this
.
dao
.
query
(
HGDS002
.
QUERY
,
map
);
...
...
src/main/java/com/baosight/hggp/hg/sb/service/ServiceHGSB099.java
View file @
c6adb2a7
...
@@ -16,6 +16,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
...
@@ -16,6 +16,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -96,7 +97,7 @@ public class ServiceHGSB099 extends ServiceEPBase {
...
@@ -96,7 +97,7 @@ public class ServiceHGSB099 extends ServiceEPBase {
* 删除文件
* 删除文件
* @param docId 文件ID
* @param docId 文件ID
*/
*/
public
void
delectDoc
(
String
docId
){
public
void
delectDoc
(
String
docId
)
throws
IOException
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"docId"
,
docId
);
map
.
put
(
"docId"
,
docId
);
List
<
HGDS002
>
list
=
this
.
dao
.
query
(
HGDS002
.
QUERY
,
map
);
List
<
HGDS002
>
list
=
this
.
dao
.
query
(
HGDS002
.
QUERY
,
map
);
...
...
src/main/java/com/baosight/hggp/hg/wd/service/ServiceHGWD001.java
View file @
c6adb2a7
...
@@ -4,18 +4,12 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
...
@@ -4,18 +4,12 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import
com.baosight.hggp.common.ChangeTypeEnum
;
import
com.baosight.hggp.common.ChangeTypeEnum
;
import
com.baosight.hggp.common.DdynamicEnum
;
import
com.baosight.hggp.common.DdynamicEnum
;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.enums.OrgTypeEnum
;
import
com.baosight.hggp.core.enums.OrgTypeEnum
;
import
com.baosight.hggp.core.extapp.decheng.api.DcOpenApi
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.core.tools.Iplat4jTools
;
import
com.baosight.hggp.core.tools.Iplat4jTools
;
import
com.baosight.hggp.core.utils.Iplat4jUtils
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.cw.tools.HGCWTools
;
import
com.baosight.hggp.hg.dm.tools.HpDmTools
;
import
com.baosight.hggp.hg.pz.domain.HGPZ009
;
import
com.baosight.hggp.hg.pz.tools.HGPZTools
;
import
com.baosight.hggp.hg.sc.domain.HGSC008
;
import
com.baosight.hggp.hg.wd.constant.HgWdConstant
;
import
com.baosight.hggp.hg.wd.constant.HgWdConstant
;
import
com.baosight.hggp.hg.wd.constant.HgWdSqlConstant
;
import
com.baosight.hggp.hg.wd.constant.HgWdSqlConstant
;
import
com.baosight.hggp.hg.wd.domain.HGWD001
;
import
com.baosight.hggp.hg.wd.domain.HGWD001
;
...
@@ -35,9 +29,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
...
@@ -35,9 +29,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import
com.baosight.iplat4j.core.resource.I18nMessages
;
import
com.baosight.iplat4j.core.resource.I18nMessages
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -249,6 +241,28 @@ public class ServiceHGWD001 extends ServiceEPBase {
...
@@ -249,6 +241,28 @@ public class ServiceHGWD001 extends ServiceEPBase {
return
inInfo
;
return
inInfo
;
}
}
private
static
void
cleanBaseInfo
(
HGWD099
hgwd099
)
{
hgwd099
.
setCreatedBy
(
null
);
hgwd099
.
setCreatedName
(
null
);
hgwd099
.
setCreatedTime
(
null
);
hgwd099
.
setUpdatedBy
(
null
);
hgwd099
.
setUpdatedName
(
null
);
hgwd099
.
setUpdatedTime
(
null
);
hgwd099
.
setDepCode
(
null
);
hgwd099
.
setId
(
null
);
}
private
static
void
cleanBaseInfo
(
HGWD001
hgwd001
)
{
hgwd001
.
setCreatedBy
(
null
);
hgwd001
.
setCreatedName
(
null
);
hgwd001
.
setCreatedTime
(
null
);
hgwd001
.
setUpdatedBy
(
null
);
hgwd001
.
setUpdatedName
(
null
);
hgwd001
.
setUpdatedTime
(
null
);
hgwd001
.
setDepCode
(
null
);
hgwd001
.
setId
(
null
);
}
@OperationLogAnnotation
(
operModul
=
"文档库"
,
operType
=
"修改"
,
operDesc
=
"文档库-附件变更-变更附件操作"
)
@OperationLogAnnotation
(
operModul
=
"文档库"
,
operType
=
"修改"
,
operDesc
=
"文档库-附件变更-变更附件操作"
)
public
EiInfo
updateFile
(
EiInfo
inInfo
)
{
public
EiInfo
updateFile
(
EiInfo
inInfo
)
{
try
{
try
{
...
@@ -289,26 +303,28 @@ public class ServiceHGWD001 extends ServiceEPBase {
...
@@ -289,26 +303,28 @@ public class ServiceHGWD001 extends ServiceEPBase {
//排除登录用户
//排除登录用户
List
<
String
>
userIds
=
listByFile
.
stream
().
filter
(
item
->
!
item
.
getUserId
().
equals
(
UserSessionUtils
.
getUserId
()))
List
<
String
>
userIds
=
listByFile
.
stream
().
filter
(
item
->
!
item
.
getUserId
().
equals
(
UserSessionUtils
.
getUserId
()))
.
map
(
HGWD003:
:
getExtId
)
.
map
(
HGWD003:
:
getExtId
)
.
filter
(
ObjectUtils:
:
isNotBlank
).
distinct
().
collect
(
Collectors
.
toList
());
.
filter
(
ObjectUtils:
:
isNotBlank
).
distinct
().
collect
(
Collectors
.
toList
());
HGWDTools
.
interaction
(
String
.
format
(
"[%s]项目变更附件通知"
,
hgwd001
.
getProjName
()),
strFileName
.
substring
(
0
,
strFileName
.
length
()-
1
),
userIds
);
HGWDTools
.
interaction
(
String
.
format
(
"[%s]项目变更附件通知"
,
hgwd001
.
getProjName
()),
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
strFileName
.
substring
(
0
,
strFileName
.
length
()
-
1
),
userIds
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据新增成功!"
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据新增成功!"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"新增失败"
);
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"新增失败"
);
}
}
return
inInfo
;
return
inInfo
;
}
}
/**
/**
* 初始化变更记录
* 初始化变更记录
* @param hgwd001 项目信息
*
* @param hgwd099 附件信息
* @param hgwd001 项目信息
* @param type 变更类型
* @param hgwd099 附件信息
* @return HGWD001A 变更记录
* @param type 变更类型
*/
* @return HGWD001A 变更记录
public
HGWD001A
initHgwd001a
(
HGWD001
hgwd001
,
HGWD099
hgwd099
,
String
type
){
*/
HGWD001A
hgwd001a
=
new
HGWD001A
();
public
HGWD001A
initHgwd001a
(
HGWD001
hgwd001
,
HGWD099
hgwd099
,
String
type
)
{
hgwd001a
.
setCompanyCode
(
hgwd001
.
getCompanyCode
());
HGWD001A
hgwd001a
=
new
HGWD001A
();
hgwd001a
.
setCompanyCode
(
hgwd001
.
getCompanyCode
());
hgwd001a
.
setCompanyName
(
hgwd001
.
getCompanyName
());
hgwd001a
.
setCompanyName
(
hgwd001
.
getCompanyName
());
hgwd001a
.
setProjCode
(
hgwd001
.
getProjCode
());
hgwd001a
.
setProjCode
(
hgwd001
.
getProjCode
());
hgwd001a
.
setProjName
(
hgwd001
.
getProjName
());
hgwd001a
.
setProjName
(
hgwd001
.
getProjName
());
...
@@ -316,246 +332,250 @@ public class ServiceHGWD001 extends ServiceEPBase {
...
@@ -316,246 +332,250 @@ public class ServiceHGWD001 extends ServiceEPBase {
hgwd001a
.
setChangeType
(
ChangeTypeEnum
.
UPLOAD_ADD
.
getCode
());
hgwd001a
.
setChangeType
(
ChangeTypeEnum
.
UPLOAD_ADD
.
getCode
());
}
else
if
(
ChangeTypeEnum
.
DELETE
.
getCode
().
equals
(
type
)){
}
else
if
(
ChangeTypeEnum
.
DELETE
.
getCode
().
equals
(
type
)){
hgwd001a
.
setChangeType
(
ChangeTypeEnum
.
UPLOAD_DELETE
.
getCode
());
hgwd001a
.
setChangeType
(
ChangeTypeEnum
.
UPLOAD_DELETE
.
getCode
());
}
else
if
(
ChangeTypeEnum
.
UPLOAD_UPDATE
.
getCode
().
equals
(
type
))
{
}
else
if
(
ChangeTypeEnum
.
UPLOAD_UPDATE
.
getCode
().
equals
(
type
))
{
hgwd001a
.
setChangeType
(
ChangeTypeEnum
.
UPLOAD_UPDATE
.
getCode
());
hgwd001a
.
setChangeType
(
ChangeTypeEnum
.
UPLOAD_UPDATE
.
getCode
());
hgwd001a
.
setChangeStartCode
(
hgwd099
.
getDocId
());
hgwd001a
.
setChangeStartCode
(
hgwd099
.
getDocId
());
hgwd001a
.
setChangeStart
(
hgwd099
.
getDocName
());
hgwd001a
.
setChangeStart
(
hgwd099
.
getDocName
());
}
else
if
(
ChangeTypeEnum
.
RELEASE
.
getCode
().
equals
(
type
))
{
}
else
if
(
ChangeTypeEnum
.
RELEASE
.
getCode
().
equals
(
type
))
{
hgwd001a
.
setChangeType
(
ChangeTypeEnum
.
RELEASE
.
getCode
());
hgwd001a
.
setChangeType
(
ChangeTypeEnum
.
RELEASE
.
getCode
());
hgwd001a
.
setChangeContent
(
hgwd001
.
getRemark
().
trim
().
length
()==
0
?
"附件发布"
:
hgwd001
.
getRemark
().
trim
());
hgwd001a
.
setChangeContent
(
hgwd001
.
getRemark
().
trim
().
length
()
==
0
?
"附件发布"
:
hgwd001
.
getRemark
().
trim
());
hgwd001a
.
setChangeStart
(
"V"
.
concat
(
hgwd001
.
getDocVersion
()+
""
));
hgwd001a
.
setChangeStart
(
"V"
.
concat
(
hgwd001
.
getDocVersion
()
+
""
));
hgwd001a
.
setChangeEnd
(
"V"
.
concat
(
hgwd001
.
getDocVersion
()+
1
+
""
));
hgwd001a
.
setChangeEnd
(
"V"
.
concat
(
hgwd001
.
getDocVersion
()
+
1
+
""
));
}
}
hgwd001a
.
setChangeContent
(
hgwd001
.
getFileName
());
hgwd001a
.
setChangeContent
(
hgwd001
.
getFileName
());
hgwd001a
.
setMatId
(
hgwd001
.
getId
());
hgwd001a
.
setMatId
(
hgwd001
.
getId
());
return
hgwd001a
;
return
hgwd001a
;
}
}
/**
/**
* 删除组织及子节点
* 删除组织及子节点
*
*
* @param inInfo
* @param inInfo
* @return
* @return
*/
*/
public
EiInfo
deleteOrgAndChildrenById
(
EiInfo
inInfo
)
{
public
EiInfo
deleteOrgAndChildrenById
(
EiInfo
inInfo
)
{
try
{
try
{
List
<
Map
>
rows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
List
<
Map
>
rows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
Map
idMap
=
new
HashMap
();
Map
idMap
=
new
HashMap
();
int
sum
=
0
;
int
sum
=
0
;
for
(
int
i
=
0
;
i
<
rows
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
rows
.
size
();
++
i
)
{
String
orgId
=
rows
.
get
(
i
).
get
(
"fileId"
).
toString
();
String
orgId
=
rows
.
get
(
i
).
get
(
"fileId"
).
toString
();
Map
orgIdMap
=
new
HashMap
();
Map
orgIdMap
=
new
HashMap
();
orgIdMap
.
put
(
"parentId"
,
orgId
);
orgIdMap
.
put
(
"parentId"
,
orgId
);
List
orgIdChildList
=
this
.
dao
.
query
(
"HGWD001.queryFileChild"
,
orgIdMap
);
List
orgIdChildList
=
this
.
dao
.
query
(
"HGWD001.queryFileChild"
,
orgIdMap
);
for
(
int
j
=
0
;
j
<
orgIdChildList
.
size
();
++
j
)
{
for
(
int
j
=
0
;
j
<
orgIdChildList
.
size
();
++
j
)
{
Map
childMap
=
((
Map
)
orgIdChildList
.
get
(
j
));
Map
childMap
=
((
Map
)
orgIdChildList
.
get
(
j
));
String
childOrgId
=
childMap
.
get
(
"id"
).
toString
();
String
childOrgId
=
childMap
.
get
(
"id"
).
toString
();
idMap
.
put
(
"id"
,
childOrgId
);
idMap
.
put
(
"id"
,
childOrgId
);
this
.
dao
.
update
(
HGWD001
.
DELETE
,
idMap
);
this
.
dao
.
update
(
HGWD001
.
DELETE
,
idMap
);
Map
memberMap
=
new
HashMap
();
Map
memberMap
=
new
HashMap
();
memberMap
.
put
(
HGWD099
.
FIELD_BIZ_ID
,
((
Map
)
orgIdChildList
.
get
(
j
)).
get
(
"fileId"
));
memberMap
.
put
(
HGWD099
.
FIELD_BIZ_ID
,
((
Map
)
orgIdChildList
.
get
(
j
)).
get
(
"fileId"
));
DaoUtils
.
update
(
"HGWD099.deleteBizId"
,
memberMap
);
//删除附件记录
DaoUtils
.
update
(
"HGWD099.deleteBizId"
,
memberMap
);
//删除附件记录
++
sum
;
++
sum
;
}
}
}
}
inInfo
.
setMsg
(
"删除["
+
sum
+
"]条记录成功"
);
inInfo
.
setMsg
(
"删除["
+
sum
+
"]条记录成功"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LogUtils
.
setMsg
(
inInfo
,
e
,
"删除失败"
);
LogUtils
.
setMsg
(
inInfo
,
e
,
"删除失败"
);
}
}
return
inInfo
;
return
inInfo
;
}
}
public
EiInfo
query1
(
EiInfo
inInfo
)
{
public
EiInfo
query1
(
EiInfo
inInfo
)
{
try
{
try
{
Map
queryRow
=
EiInfoUtils
.
getFirstRow
(
inInfo
,
"inqu_status1"
);
Map
queryRow
=
EiInfoUtils
.
getFirstRow
(
inInfo
,
"inqu_status1"
);
queryRow
.
put
(
HGWD001
.
FIELD_DELETE_FLAG
,
CommonConstant
.
YesNo
.
NO_0
);
queryRow
.
put
(
HGWD001
.
FIELD_DELETE_FLAG
,
CommonConstant
.
YesNo
.
NO_0
);
// 非管理员仅查询自己有权限的项目
// 非管理员仅查询自己有权限的项目
String
userId
=
UserSessionUtils
.
getLoginName
();
String
userId
=
UserSessionUtils
.
getLoginName
();
if
(!
HgWdUtils
.
HgWd009
.
isManager
(
userId
))
{
if
(!
HgWdUtils
.
HgWd009
.
isManager
(
userId
))
{
queryRow
.
put
(
User
.
FIELD_USER_ID
,
userId
);
queryRow
.
put
(
User
.
FIELD_USER_ID
,
userId
);
}
}
EiBlock
block
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
EiBlock
block
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
block
.
addRow
(
queryRow
);
block
.
addRow
(
queryRow
);
inInfo
.
setBlock
(
block
);
inInfo
.
setBlock
(
block
);
return
super
.
query
(
inInfo
,
HGWD001
.
QUERY
,
new
HGWD001
(),
false
,
new
HGWD001
().
eiMetadata
,
"inqu_status1"
,
"result1"
,
"result1"
,
null
);
return
super
.
query
(
inInfo
,
HGWD001
.
QUERY
,
new
HGWD001
(),
false
,
new
HGWD001
().
eiMetadata
,
"inqu_status1"
,
}
catch
(
Exception
e
)
{
"result1"
,
"result1"
,
null
);
LogUtils
.
setMsg
(
inInfo
,
e
,
"查询失败"
);
}
catch
(
Exception
e
)
{
}
LogUtils
.
setMsg
(
inInfo
,
e
,
"查询失败"
);
return
inInfo
;
}
}
return
inInfo
;
}
@OperationLogAnnotation
(
operModul
=
"文档库"
,
operType
=
"复制附件"
,
operDesc
=
"文档库-附件复制-附件复制操作"
)
public
EiInfo
save1
(
EiInfo
inInfo
)
{
@OperationLogAnnotation
(
operModul
=
"文档库"
,
operType
=
"复制附件"
,
operDesc
=
"文档库-附件复制-附件复制操作"
)
try
{
public
EiInfo
save1
(
EiInfo
inInfo
)
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
try
{
List
<
Map
>
result1Rows
=
inInfo
.
getBlock
(
"result1"
).
getRows
();
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
//List<Map<String, Object>> edcm01List = Iplat4jTools.EdCm01.list("hggp.hgwd.fileType");
List
<
Map
>
result1Rows
=
inInfo
.
getBlock
(
"result1"
).
getRows
();
// 写入数据
//List<Map<String, Object>> edcm01List = Iplat4jTools.EdCm01.list("hggp.hgwd.fileType");
for
(
Map
result1Row:
result1Rows
)
{
// 写入数据
StringBuilder
strFileName
=
new
StringBuilder
();
for
(
Map
result1Row
:
result1Rows
)
{
HGWD001
hgwd001
=
new
HGWD001
();
StringBuilder
strFileName
=
new
StringBuilder
();
hgwd001
.
fromMap
(
result1Row
);
HGWD001
hgwd001
=
new
HGWD001
();
strFileName
.
append
(
hgwd001
.
getFileName
()).
append
(
"上传附件:附件名称"
);
hgwd001
.
fromMap
(
result1Row
);
for
(
Map
resultRow
:
resultRows
)
{
strFileName
.
append
(
hgwd001
.
getFileName
()).
append
(
"上传附件:附件名称"
);
HGWD099
hgdm099
=
new
HGWD099
();
for
(
Map
resultRow
:
resultRows
)
{
hgdm099
.
fromMap
(
resultRow
);
HGWD099
hgdm099
=
new
HGWD099
();
cleanBaseInfo
(
hgdm099
);
hgdm099
.
fromMap
(
resultRow
);
hgdm099
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
NO_0
);
cleanBaseInfo
(
hgdm099
);
hgdm099
.
setBizId
(
hgwd001
.
getFileId
());
hgdm099
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
NO_0
);
hgdm099
.
setStatus
(
HgWdConstant
.
FileStatus
.
S_0
);
hgdm099
.
setBizId
(
hgwd001
.
getFileId
());
DaoUtils
.
insert
(
HGWD099
.
INSERT
,
hgdm099
);
hgdm099
.
setStatus
(
HgWdConstant
.
FileStatus
.
S_0
);
strFileName
.
append
(
hgdm099
.
getDocName
()).
append
(
","
);
DaoUtils
.
insert
(
HGWD099
.
INSERT
,
hgdm099
);
strFileName
.
append
(
hgdm099
.
getDocName
()).
append
(
","
);
HGWD001A
hgwd001a
=
initHgwd001a
(
hgwd001
,
hgdm099
,
ChangeTypeEnum
.
UPLOAD_ADD
.
getCode
());
hgwd001a
.
setChangeEndCode
(
hgdm099
.
getDocId
());
HGWD001A
hgwd001a
=
initHgwd001a
(
hgwd001
,
hgdm099
,
ChangeTypeEnum
.
UPLOAD_ADD
.
getCode
());
hgwd001a
.
setChangeEnd
(
hgdm099
.
getDocName
());
hgwd001a
.
setChangeEndCode
(
hgdm099
.
getDocId
());
HGWDTools
.
HgWd001
.
addHGWD001A
(
hgwd001a
);
hgwd001a
.
setChangeEnd
(
hgdm099
.
getDocName
());
}
HGWDTools
.
HgWd001
.
addHGWD001A
(
hgwd001a
);
hgwd001
.
setStatus
(
HgWdConstant
.
FileStatus
.
S_0
);
}
HGWDTools
.
HgWd001
.
updateStatus
(
hgwd001
);
hgwd001
.
setStatus
(
HgWdConstant
.
FileStatus
.
S_0
);
HGWDTools
.
interaction
(
hgwd001
,
strFileName
.
substring
(
0
,
strFileName
.
length
()
-
1
));
HGWDTools
.
HgWd001
.
updateStatus
(
hgwd001
);
}
HGWDTools
.
interaction
(
hgwd001
,
strFileName
.
substring
(
0
,
strFileName
.
length
()
-
1
));
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据保存成功!"
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
}
catch
(
Exception
e
)
{
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据保存成功!"
);
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"保存失败"
);
}
catch
(
Exception
e
)
{
}
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"保存失败"
);
return
inInfo
;
}
}
return
inInfo
;
}
/**
* 复制项目列表
/**
* @param inInfo
* 复制项目列表
* @return
*
*/
* @param inInfo
public
EiInfo
query2
(
EiInfo
inInfo
)
{
* @return
try
{
*/
Map
queryRow
=
EiInfoUtils
.
getFirstRow
(
inInfo
,
"inqu_status2"
);
public
EiInfo
query2
(
EiInfo
inInfo
)
{
queryRow
.
put
(
HGWD001
.
FIELD_DELETE_FLAG
,
CommonConstant
.
YesNo
.
NO_0
);
try
{
// 非管理员仅查询自己有权限的项目
Map
queryRow
=
EiInfoUtils
.
getFirstRow
(
inInfo
,
"inqu_status2"
);
String
userId
=
UserSessionUtils
.
getLoginName
();
queryRow
.
put
(
HGWD001
.
FIELD_DELETE_FLAG
,
CommonConstant
.
YesNo
.
NO_0
);
if
(!
HgWdUtils
.
HgWd009
.
isManager
(
userId
))
{
// 非管理员仅查询自己有权限的项目
queryRow
.
put
(
User
.
FIELD_USER_ID
,
userId
);
String
userId
=
UserSessionUtils
.
getLoginName
();
}
if
(!
HgWdUtils
.
HgWd009
.
isManager
(
userId
))
{
EiBlock
block
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
queryRow
.
put
(
User
.
FIELD_USER_ID
,
userId
);
block
.
addRow
(
queryRow
);
}
inInfo
.
setBlock
(
block
);
EiBlock
block
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
return
super
.
query
(
inInfo
,
HGWD001
.
QUERY
,
new
HGWD001
(),
false
,
new
HGWD001
().
eiMetadata
,
"inqu_status2"
,
"result2"
,
"result2"
,
null
);
block
.
addRow
(
queryRow
);
}
catch
(
Exception
e
)
{
inInfo
.
setBlock
(
block
);
LogUtils
.
setMsg
(
inInfo
,
e
,
"查询失败"
);
return
super
.
query
(
inInfo
,
HGWD001
.
QUERY
,
new
HGWD001
(),
false
,
new
HGWD001
().
eiMetadata
,
"inqu_status2"
,
}
"result2"
,
"result2"
,
null
);
return
inInfo
;
}
catch
(
Exception
e
)
{
}
LogUtils
.
setMsg
(
inInfo
,
e
,
"查询失败"
);
}
@OperationLogAnnotation
(
operModul
=
"文档库"
,
operType
=
"复制项目"
,
operDesc
=
"文档库-复制项目-复制项目操作"
)
return
inInfo
;
public
EiInfo
save2
(
EiInfo
inInfo
)
{
}
try
{
Map
<
String
,
String
>
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
,
EiConstant
.
queryBlock
);
@OperationLogAnnotation
(
operModul
=
"文档库"
,
operType
=
"复制项目"
,
operDesc
=
"文档库-复制项目-复制项目操作"
)
List
<
HGWD001
>
result1Rows
=
MapUtils
.
toDaoEPBases
(
inInfo
.
getBlock
(
"result2"
).
getRows
(),
HGWD001
.
class
);
public
EiInfo
save2
(
EiInfo
inInfo
)
{
List
<
HGWD001
>
hgwd001List
=
HGWDTools
.
HgWd001
.
queryByParentId
(
queryMap
.
get
(
HGWD001
.
FIELD_PROJ_CODE
),
queryMap
.
get
(
HGWD001
.
FIELD_PARENT_ID
));
try
{
if
(
queryMap
.
get
(
"leafType"
).
equals
(
HgWdConstant
.
LeafType
.
P
)){
Map
<
String
,
String
>
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
,
EiConstant
.
queryBlock
);
hgwd001List
=
HGWDTools
.
HgWd001
.
queryByProjCode
(
queryMap
.
get
(
HGWD001
.
FIELD_PROJ_CODE
),
queryMap
.
get
(
HGWD001
.
FIELD_PARENT_ID
));
List
<
HGWD001
>
result1Rows
=
MapUtils
.
toDaoEPBases
(
inInfo
.
getBlock
(
"result2"
).
getRows
(),
HGWD001
.
class
);
}
List
<
HGWD001
>
hgwd001List
=
HGWDTools
.
HgWd001
.
queryByParentId
(
queryMap
.
get
(
HGWD001
.
FIELD_PROJ_CODE
),
// 要复制项目
queryMap
.
get
(
HGWD001
.
FIELD_PARENT_ID
));
if
(
queryMap
.
get
(
"leafType"
).
equals
(
HgWdConstant
.
LeafType
.
P
))
{
String
parentId
=
result1Rows
.
get
(
0
).
getParentId
();
hgwd001List
=
HGWDTools
.
HgWd001
.
queryByProjCode
(
queryMap
.
get
(
HGWD001
.
FIELD_PROJ_CODE
),
if
(!
StringUtils
.
isNull
(
hgwd001List
)){
queryMap
.
get
(
HGWD001
.
FIELD_PARENT_ID
));
hgwd001List
.
forEach
(
hgwd001
->
{
}
hgwd001
.
setParentId
(
parentId
);
// 要复制项目
});
// 查询添加子节点
String
parentId
=
result1Rows
.
get
(
0
).
getParentId
();
addNode
(
hgwd001List
);
if
(!
StringUtils
.
isNull
(
hgwd001List
))
{
}
hgwd001List
.
forEach
(
hgwd001
->
{
hgwd001
.
setParentId
(
parentId
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
});
inInfo
.
setMsg
(
"操作复制文件成功!"
);
// 查询添加子节点
}
catch
(
Exception
e
)
{
addNode
(
hgwd001List
);
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"复制文件失败"
);
}
}
return
inInfo
;
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
}
inInfo
.
setMsg
(
"操作复制文件成功!"
);
}
catch
(
Exception
e
)
{
public
void
addNode
(
List
<
HGWD001
>
hgwd001List
){
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"复制文件失败"
);
List
<
String
>
fileIds
=
hgwd001List
.
stream
().
map
(
HGWD001:
:
getFileId
).
collect
(
Collectors
.
toList
());
}
List
<
HGWD001
>
hgwd001s
=
HGWDTools
.
HgWd001
.
listByParentIds
(
fileIds
);
return
inInfo
;
for
(
HGWD001
hgwd001:
hgwd001List
)
{
}
String
fileId
=
SequenceGenerator
.
getNextSequence
(
HGConstant
.
SequenceId
.
WD_FILE_ID
);
if
(!
StringUtils
.
isNull
(
hgwd001s
)){
public
void
addNode
(
List
<
HGWD001
>
hgwd001List
)
{
hgwd001s
.
forEach
(
o
->
{
List
<
String
>
fileIds
=
hgwd001List
.
stream
().
map
(
HGWD001:
:
getFileId
).
collect
(
Collectors
.
toList
());
if
(
o
.
getParentId
().
equals
(
hgwd001
.
getFileId
())){
List
<
HGWD001
>
hgwd001s
=
HGWDTools
.
HgWd001
.
listByParentIds
(
fileIds
);
o
.
setParentId
(
fileId
);
for
(
HGWD001
hgwd001
:
hgwd001List
)
{
}
String
fileId
=
SequenceGenerator
.
getNextSequence
(
HGConstant
.
SequenceId
.
WD_FILE_ID
);
});
if
(!
StringUtils
.
isNull
(
hgwd001s
))
{
}
hgwd001s
.
forEach
(
o
->
{
addCopyFile
(
hgwd001
,
fileId
);
if
(
o
.
getParentId
().
equals
(
hgwd001
.
getFileId
()))
{
}
o
.
setParentId
(
fileId
);
}
if
(
hgwd001s
!=
null
&&
hgwd001s
.
size
()
>
0
){
});
addNode
(
hgwd001s
);
}
}
addCopyFile
(
hgwd001
,
fileId
);
}
}
private
void
addCopyFile
(
HGWD001
hgwd001
,
String
fileId
){
if
(
hgwd001s
!=
null
&&
hgwd001s
.
size
()
>
0
)
{
addNode
(
hgwd001s
);
List
<
HGWD099
>
hgwd099List
=
HGWDTools
.
HgWd099
.
queryByBiz
(
"WD"
,
hgwd001
.
getFileId
());
}
StringBuilder
strFileName
=
new
StringBuilder
();
}
strFileName
.
append
(
hgwd001
.
getFileName
()).
append
(
"上传附件:附件名称"
);
private
void
addCopyFile
(
HGWD001
hgwd001
,
String
fileId
)
{
List
<
HGWD099
>
hgwd099s
=
hgwd099List
.
stream
().
filter
(
hgdm099
->
hgdm099
.
getBizId
().
equals
(
hgwd001
.
getFileId
())).
collect
(
Collectors
.
toList
());
for
(
HGWD099
hgwd099
:
hgwd099s
)
{
List
<
HGWD099
>
hgwd099List
=
HGWDTools
.
HgWd099
.
queryByBiz
(
"WD"
,
hgwd001
.
getFileId
());
cleanBaseInfo
(
hgwd099
);
StringBuilder
strFileName
=
new
StringBuilder
();
hgwd099
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
NO_0
);
hgwd099
.
setBizId
(
fileId
);
strFileName
.
append
(
hgwd001
.
getFileName
()).
append
(
"上传附件:附件名称"
);
hgwd099
.
setStatus
(
HgWdConstant
.
FileStatus
.
S_0
);
List
<
HGWD099
>
hgwd099s
=
hgwd099List
.
stream
().
filter
(
hgdm099
->
hgdm099
.
getBizId
().
equals
(
hgwd001
.
getFileId
()))
DaoUtils
.
insert
(
HGWD099
.
INSERT
,
hgwd099
);
.
collect
(
Collectors
.
toList
());
strFileName
.
append
(
hgwd099
.
getDocName
()).
append
(
","
);
for
(
HGWD099
hgwd099
:
hgwd099s
)
{
cleanBaseInfo
(
hgwd099
);
HGWD001A
hgwd001a
=
initHgwd001a
(
hgwd001
,
hgwd099
,
ChangeTypeEnum
.
UPLOAD_ADD
.
getCode
());
hgwd099
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
NO_0
);
hgwd001a
.
setChangeEndCode
(
hgwd099
.
getDocId
());
hgwd099
.
setBizId
(
fileId
);
hgwd001a
.
setChangeEnd
(
hgwd099
.
getDocName
());
hgwd099
.
setStatus
(
HgWdConstant
.
FileStatus
.
S_0
);
HGWDTools
.
HgWd001
.
addHGWD001A
(
hgwd001a
);
DaoUtils
.
insert
(
HGWD099
.
INSERT
,
hgwd099
);
}
strFileName
.
append
(
hgwd099
.
getDocName
()).
append
(
","
);
//hgwd001.setParentId(parentId);
hgwd001
.
setFileId
(
fileId
);
HGWD001A
hgwd001a
=
initHgwd001a
(
hgwd001
,
hgwd099
,
ChangeTypeEnum
.
UPLOAD_ADD
.
getCode
());
hgwd001
.
setStatus
(
HgWdConstant
.
FileStatus
.
S_0
);
hgwd001a
.
setChangeEndCode
(
hgwd099
.
getDocId
());
cleanBaseInfo
(
hgwd001
);
hgwd001a
.
setChangeEnd
(
hgwd099
.
getDocName
());
DaoUtils
.
insert
(
HGWD001
.
INSERT
,
hgwd001
);
HGWDTools
.
HgWd001
.
addHGWD001A
(
hgwd001a
);
}
HGWDTools
.
interaction
(
hgwd001
,
strFileName
.
substring
(
0
,
strFileName
.
length
()
-
1
));
//hgwd001.setParentId(parentId);
}
hgwd001
.
setFileId
(
fileId
);
hgwd001
.
setStatus
(
HgWdConstant
.
FileStatus
.
S_0
);
public
EiInfo
queryProjectManager
(
EiInfo
inInfo
)
{
cleanBaseInfo
(
hgwd001
);
try
{
DaoUtils
.
insert
(
HGWD001
.
INSERT
,
hgwd001
);
Map
queryRow
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
Integer
isManager
=
HGWDTools
.
HgWd003
.
isProjectManager
(
queryRow
.
get
(
HGWD001
.
FIELD_FILE_ID
).
toString
());
HGWDTools
.
interaction
(
hgwd001
,
strFileName
.
substring
(
0
,
strFileName
.
length
()
-
1
));
inInfo
.
set
(
"isManager"
,
isManager
);
}
}
catch
(
Exception
e
){
LogUtils
.
setMsg
(
inInfo
,
e
,
"查询失败"
);
public
EiInfo
queryProjectManager
(
EiInfo
inInfo
)
{
}
try
{
return
inInfo
;
Map
queryRow
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
}
Integer
isManager
=
HGWDTools
.
HgWd003
.
isProjectManager
(
queryRow
.
get
(
HGWD001
.
FIELD_FILE_ID
).
toString
());
inInfo
.
set
(
"isManager"
,
isManager
);
private
static
void
cleanBaseInfo
(
HGWD099
hgwd099
){
}
catch
(
Exception
e
)
{
hgwd099
.
setCreatedBy
(
null
);
LogUtils
.
setMsg
(
inInfo
,
e
,
"查询失败"
);
hgwd099
.
setCreatedName
(
null
);
}
hgwd099
.
setCreatedTime
(
null
);
return
inInfo
;
hgwd099
.
setUpdatedBy
(
null
);
}
hgwd099
.
setUpdatedName
(
null
);
hgwd099
.
setUpdatedTime
(
null
);
/**
hgwd099
.
setDepCode
(
null
);
* 批量下载
hgwd099
.
setId
(
null
);
*
}
* @param inInfo
* @return
private
static
void
cleanBaseInfo
(
HGWD001
hgwd001
){
*/
hgwd001
.
setCreatedBy
(
null
);
public
EiInfo
batchDownload
(
EiInfo
inInfo
)
{
hgwd001
.
setCreatedName
(
null
);
try
{
hgwd001
.
setCreatedTime
(
null
);
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
hgwd001
.
setUpdatedBy
(
null
);
String
fileName
=
MapUtils
.
getString
(
queryMap
,
HGWD001
.
FIELD_FILE_NAME
);
hgwd001
.
setUpdatedName
(
null
);
String
zipName
=
fileName
+
"_"
+
DateUtils
.
shortDateTime
();
hgwd001
.
setUpdatedTime
(
null
);
List
<
String
>
docIds
=
ObjectUtils
.
listKey
(
inInfo
,
HGWD099
.
FIELD_DOC_ID
);
hgwd001
.
setDepCode
(
null
);
inInfo
.
set
(
"downloadUrl"
,
Iplat4jUtils
.
compressFile
(
docIds
,
zipName
));
hgwd001
.
setId
(
null
);
}
catch
(
Exception
e
)
{
}
LogUtils
.
setMsg
(
inInfo
,
e
,
"批量下载失败"
);
}
return
inInfo
;
}
}
}
src/main/java/com/baosight/hggp/hg/xt/service/ServiceHGXT099.java
View file @
c6adb2a7
...
@@ -14,6 +14,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
...
@@ -14,6 +14,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -115,7 +116,7 @@ public class ServiceHGXT099 extends ServiceEPBase {
...
@@ -115,7 +116,7 @@ public class ServiceHGXT099 extends ServiceEPBase {
* @param docId 文件ID
* @param docId 文件ID
*/
*/
@OperationLogAnnotation
(
operModul
=
"附件清单"
,
operType
=
"删除"
,
operDesc
=
"删除附件文件"
)
@OperationLogAnnotation
(
operModul
=
"附件清单"
,
operType
=
"删除"
,
operDesc
=
"删除附件文件"
)
public
void
delectDoc
(
String
docId
){
public
void
delectDoc
(
String
docId
)
throws
IOException
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"docId"
,
docId
);
map
.
put
(
"docId"
,
docId
);
List
<
HGDS002
>
list
=
this
.
dao
.
query
(
HGDS002
.
QUERY
,
map
);
List
<
HGDS002
>
list
=
this
.
dao
.
query
(
HGDS002
.
QUERY
,
map
);
...
...
src/main/java/com/baosight/hggp/job/ClearZipJob.java
0 → 100644
View file @
c6adb2a7
package
com
.
baosight
.
hggp
.
job
;
import
com.baosight.hggp.core.constant.OSConstant
;
import
com.baosight.hggp.util.DateUtil
;
import
com.baosight.hggp.util.DateUtils
;
import
com.baosight.hggp.util.FileUtils
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
import
java.time.LocalDate
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @author:songx
* @date:2024/10/11,12:26
*/
@Slf4j
@Component
public
class
ClearZipJob
{
/**
* 清理ZIP文件
*/
@Scheduled
(
cron
=
"0 15 3 * * ?"
)
public
void
clearZipFile
()
{
try
{
File
zipFolder
=
new
File
(
OSConstant
.
ZIP_DIR
);
File
[]
zipFolderFiles
=
zipFolder
.
listFiles
();
if
(
zipFolderFiles
.
length
==
0
)
{
log
.
warn
(
"清理ZIP文件:无有效的文件"
);
}
for
(
File
zipFolderFile
:
zipFolderFiles
)
{
String
folderName
=
zipFolderFile
.
getName
();
// 当天以前的文件夹全部删除
if
(
LocalDate
.
parse
(
folderName
,
DateUtils
.
SHORT_DATE
).
isBefore
(
LocalDate
.
now
()))
{
FileUtils
.
deleteFiles
(
zipFolderFile
);
}
}
log
.
info
(
"清理ZIP文件成功!!!"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"清理ZIP文件失败:{}"
,
e
.
getMessage
(),
e
);
}
}
}
src/main/java/com/baosight/hggp/util/FileUtils.java
View file @
c6adb2a7
...
@@ -2,6 +2,8 @@ package com.baosight.hggp.util;
...
@@ -2,6 +2,8 @@ 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
;
...
@@ -18,9 +20,12 @@ import java.io.InputStream;
...
@@ -18,9 +20,12 @@ import java.io.InputStream;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.nio.file.DirectoryStream
;
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.nio.file.Paths
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
...
@@ -30,6 +35,8 @@ import java.util.List;
...
@@ -30,6 +35,8 @@ import java.util.List;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -187,6 +194,40 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
...
@@ -187,6 +194,40 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
/**
/**
* 删除目录及文件
* 删除目录及文件
*
*
* @param path
* @return
*/
public
static
boolean
deleteFiles
(
String
path
)
{
return
deleteFiles
(
Paths
.
get
(
path
));
}
/**
* 删除目录及文件
*
* @param path
* @return
*/
public
static
boolean
deleteFiles
(
Path
path
)
{
try
{
if
(
Files
.
isDirectory
(
path
))
{
try
(
DirectoryStream
<
Path
>
directoryStream
=
Files
.
newDirectoryStream
(
path
))
{
for
(
Path
entry
:
directoryStream
)
{
deleteFiles
(
entry
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"删除文件失败,读取目录子文件失败:{}"
,
e
.
getMessage
(),
e
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"删除文件失败:{}"
,
e
.
getMessage
(),
e
);
return
false
;
}
return
deleteFile
(
path
);
}
/**
* 删除目录及文件
*
* @param file
* @param file
* @return
* @return
*/
*/
...
@@ -214,7 +255,25 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
...
@@ -214,7 +255,25 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
public
static
boolean
deleteFile
(
String
path
)
{
public
static
boolean
deleteFile
(
String
path
)
{
Objects
.
requireNonNull
(
path
);
Objects
.
requireNonNull
(
path
);
// 路径为文件且不为空则进行删除
// 路径为文件且不为空则进行删除
return
deleteFile
(
new
File
(
path
));
return
deleteFile
(
Paths
.
get
(
path
));
}
/**
* 删除单个文件或目录
*
* @param path 被删除的文件
* @return
*/
public
static
boolean
deleteFile
(
Path
path
)
{
Objects
.
requireNonNull
(
path
);
// 路径为文件且不为空则进行删除
try
{
Files
.
delete
(
path
);
}
catch
(
Exception
e
)
{
log
.
error
(
"删除文件失败:{}"
,
e
.
getMessage
(),
e
);
return
false
;
}
return
true
;
}
}
/**
/**
...
@@ -266,43 +325,20 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
...
@@ -266,43 +325,20 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
* @param targetPath
* @param targetPath
* @throws IOException
* @throws IOException
*/
*/
public
static
void
fileCope
(
String
filePath
,
String
targetPath
)
throws
IOException
{
public
static
void
fileCopy
(
String
filePath
,
String
targetPath
)
throws
IOException
{
// 获得流
File
targetFile
=
new
File
(
targetPath
);
FileInputStream
fileInputStream
=
null
;
creatFiles
(
targetPath
);
//新文件输出流
try
(
FileInputStream
fis
=
new
FileInputStream
(
filePath
);
FileOutputStream
fileOutputStream
=
null
;
FileOutputStream
fos
=
new
FileOutputStream
(
targetFile
))
{
try
{
fileInputStream
=
new
FileInputStream
(
filePath
);
File
targetFile
=
new
File
(
targetPath
);
//获取父目录
File
parentFile
=
targetFile
.
getParentFile
();
//判断是否存在
if
(!
parentFile
.
exists
())
{
// 创建父目录文件夹
parentFile
.
mkdirs
();
}
//判断文件是否存在
if
(!
targetFile
.
exists
())
{
//创建文件
targetFile
.
createNewFile
();
}
fileOutputStream
=
new
FileOutputStream
(
targetFile
);
byte
[]
buffer
=
new
byte
[
1024
];
byte
[]
buffer
=
new
byte
[
1024
];
int
len
;
int
len
;
//将文件流信息读取文件缓存区,如果读取结果不为-1就代表文件没有读取完毕,反之已经读取完毕
//将文件流信息读取文件缓存区,如果读取结果不为-1就代表文件没有读取完毕,反之已经读取完毕
while
((
len
=
fi
leInputStream
.
read
(
buffer
))
!=
-
1
)
{
while
((
len
=
fi
s
.
read
(
buffer
))
!=
-
1
)
{
f
ileOutputStream
.
write
(
buffer
,
0
,
len
);
f
os
.
write
(
buffer
,
0
,
len
);
f
ileOutputStream
.
flush
();
f
os
.
flush
();
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
e
;
throw
e
;
}
finally
{
if
(
fileInputStream
!=
null
)
{
fileInputStream
.
close
();
}
if
(
fileOutputStream
!=
null
)
{
fileOutputStream
.
close
();
}
}
}
}
}
...
@@ -464,16 +500,6 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
...
@@ -464,16 +500,6 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
}
}
/**
/**
* InputStream
*
* @param url
*/
public
static
InputStream
downloadStreamFromUrl
(
String
url
)
throws
IOException
{
URL
httpUrl
=
new
URL
(
url
);
return
httpUrl
.
openStream
();
}
/**
* 文件下载
* 文件下载
*
*
* @param file
* @param file
...
@@ -491,18 +517,48 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
...
@@ -491,18 +517,48 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
}
}
/**
/**
* 下载文件到本地
*
* @param httpUrl
* @param localFilePath
*/
public
static
void
downloadUrlFile
(
String
httpUrl
,
String
localFilePath
)
throws
IOException
{
// 创建文件
FileUtils
.
creatFiles
(
localFilePath
);
URL
url
=
new
URL
(
httpUrl
);
HttpURLConnection
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
try
(
InputStream
is
=
connection
.
getInputStream
();
OutputStream
os
=
new
FileOutputStream
(
localFilePath
))
{
// 这里也很关键每次读取的大小为5M,不一次性读取完
byte
[]
buffer
=
new
byte
[
1024
*
1024
*
1
];
int
len
=
0
;
while
((
len
=
is
.
read
(
buffer
))
!=
-
1
)
{
os
.
write
(
buffer
,
0
,
len
);
}
}
catch
(
IOException
e
)
{
throw
e
;
}
finally
{
connection
.
disconnect
();
}
}
/**
* 下载文件到前端
* 下载文件到前端
*
*
* @param
u
rl
* @param
httpU
rl
* @param fileName
* @param fileName
* @param response
* @param response
*/
*/
public
static
void
downloadUrlFile
(
String
u
rl
,
String
fileName
,
boolean
isPreview
,
HttpServletResponse
response
)
public
static
void
downloadUrlFile
(
String
httpU
rl
,
String
fileName
,
boolean
isPreview
,
HttpServletResponse
response
)
throws
IOException
{
throws
IOException
{
try
(
InputStream
is
=
downloadStreamFromUrl
(
url
);)
{
URL
url
=
new
URL
(
httpUrl
);
HttpURLConnection
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
try
(
InputStream
is
=
connection
.
getInputStream
())
{
downloadFile
(
is
,
fileName
,
isPreview
,
response
);
downloadFile
(
is
,
fileName
,
isPreview
,
response
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
e
;
throw
e
;
}
finally
{
connection
.
disconnect
();
}
}
}
}
...
@@ -572,4 +628,41 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
...
@@ -572,4 +628,41 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
}
}
}
}
/**
* 压缩文件夹.
*
* @param sourceFilePath 源文件夹路径
* @param zipFilePath 压缩包路径
*/
public
static
void
zip
(
String
sourceFilePath
,
String
zipFilePath
)
throws
IOException
{
File
zipFile
=
new
File
(
zipFilePath
);
if
(
zipFile
.
exists
())
{
zipFile
.
delete
();
}
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
zipFile
);
ZipOutputStream
zos
=
new
ZipOutputStream
(
fos
))
{
File
[]
sourceFiles
=
new
File
(
sourceFilePath
).
listFiles
();
if
(
null
==
sourceFiles
||
sourceFiles
.
length
<
1
)
{
log
.
info
(
"待压缩的文件目录:"
+
sourceFilePath
+
"里面不存在文件,无需压缩."
);
}
byte
[]
buffs
=
new
byte
[
1024
*
10
];
for
(
File
sourceFile
:
sourceFiles
)
{
// 创建ZIP实体,并添加进压缩包
ZipEntry
zipEntry
=
new
ZipEntry
(
sourceFile
.
getName
());
zos
.
putNextEntry
(
zipEntry
);
// 读取待压缩的文件并写进压缩包里
try
(
FileInputStream
fis
=
new
FileInputStream
(
sourceFile
);
BufferedInputStream
bis
=
new
BufferedInputStream
(
fis
,
1024
*
10
))
{
int
read
=
0
;
while
((
read
=
bis
.
read
(
buffs
,
0
,
1024
*
10
))
!=
-
1
)
{
zos
.
write
(
buffs
,
0
,
read
);
}
}
catch
(
IOException
e
)
{
throw
e
;
}
}
}
catch
(
IOException
e
)
{
throw
e
;
}
}
}
}
src/main/java/com/baosight/hggp/util/ObjectUtils.java
View file @
c6adb2a7
package
com
.
baosight
.
hggp
.
util
;
package
com
.
baosight
.
hggp
.
util
;
import
com.baosight.iplat4j.core.data.DaoEPBase
;
import
com.baosight.iplat4j.core.data.DaoEPBase
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.util.Collection
;
import
java.util.Collection
;
...
@@ -109,6 +111,22 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils {
...
@@ -109,6 +111,22 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils {
/**
/**
* 从集合MAP中取KEY
* 从集合MAP中取KEY
*
*
* @param inInfo
* @param keyName
* @return
*/
public
static
<
T
>
List
<
T
>
listKey
(
EiInfo
inInfo
,
String
keyName
)
{
List
<
Map
>
items
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
if
(
CollectionUtils
.
isEmpty
(
items
))
{
return
null
;
}
return
items
.
stream
().
map
(
item
->
(
T
)
item
.
get
(
keyName
)).
filter
(
ObjectUtils:
:
isNotBlank
).
distinct
()
.
collect
(
Collectors
.
toList
());
}
/**
* 从集合MAP中取KEY
*
* @param items
* @param items
* @param keyName
* @param keyName
* @return
* @return
...
...
src/main/webapp/HG/WD/HGWD001.js
View file @
c6adb2a7
...
@@ -469,9 +469,9 @@ $(function () {
...
@@ -469,9 +469,9 @@ $(function () {
readonly
:
true
,
readonly
:
true
,
template
:
function
(
item
)
{
template
:
function
(
item
)
{
let
template
=
'<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
let
template
=
'<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+
'href="'
+
downloadHref
(
item
.
docId
)
+
'">
附件
下载</a>'
;
+
'href="'
+
downloadHref
(
item
.
docId
)
+
'">下载</a>'
;
template
+=
'<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
template
+=
'<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+
'onclick="changeFile(
\'
'
+
item
.
docId
+
'
\'
,
\'
'
+
item
.
bizId
+
'
\'
)" target="_blank">
附件
变更</a>'
;
+
'onclick="changeFile(
\'
'
+
item
.
docId
+
'
\'
,
\'
'
+
item
.
bizId
+
'
\'
)" target="_blank">变更</a>'
;
return
template
;
return
template
;
}
}
},
{
},
{
...
@@ -498,14 +498,16 @@ $(function () {
...
@@ -498,14 +498,16 @@ $(function () {
}
}
};
};
downKeyUp
();
downKeyUp
();
// 查询
// 查询
$
(
"#BTN_DELETE"
).
on
(
"click"
,
deleteFunc
);
$
(
"#BTN_DELETE"
).
on
(
"click"
,
deleteFunc
);
$
(
"#SAVE1"
).
on
(
"click"
,
saveFunc
);
$
(
"#SAVE1"
).
on
(
"click"
,
saveFunc
);
$
(
"#SAVE2"
).
on
(
"click"
,
saveProtFunc
);
$
(
"#SAVE2"
).
on
(
"click"
,
saveProtFunc
);
//确认发布
//确认发布
$
(
"#confirmRelease"
).
on
(
"click"
,
updateRelease
);
$
(
"#confirmRelease"
).
on
(
"click"
,
updateRelease
);
// 批量下载
$
(
"#BATCH_DOWNLOAD"
).
on
(
"click"
,
batchDownload
);
});
});
let
query
=
function
()
{
let
query
=
function
()
{
...
@@ -994,12 +996,30 @@ let isProjectManager = function (parentId) {
...
@@ -994,12 +996,30 @@ let isProjectManager = function (parentId) {
default
:
default
:
$
(
"#RELEASE"
).
attr
(
"disabled"
,
true
);
$
(
"#RELEASE"
).
attr
(
"disabled"
,
true
);
$
(
"#UPLOAD_FILE"
).
attr
(
"disabled"
,
true
);
$
(
"#UPLOAD_FILE"
).
attr
(
"disabled"
,
true
);
$
(
"#COPY_FILE"
).
attr
(
"disabled"
,
true
);
$
(
"#COPY_FILE"
).
attr
(
"disabled"
,
true
);
$
(
"#PREVIEW"
).
attr
(
"disabled"
,
true
);
$
(
"#PREVIEW"
).
attr
(
"disabled"
,
true
);
}
}
}
}
}
}
},
{
},
{
async
:
false
async
:
false
})
})
}
}
/**
* 批量下载
*/
let
batchDownload
=
function
()
{
var
rows
=
resultGrid
.
getCheckedRows
();
if
(
rows
.
length
==
0
)
{
message
(
"请先勾选要下载的数据!"
);
return
;
}
JSUtils
.
submitGridsData
(
"result"
,
"HGWD001"
,
"batchDownload"
,
false
,
function
(
res
)
{
if
(
res
.
status
>
-
1
)
{
window
.
open
(
res
.
extAttr
.
downloadUrl
,
'_blank'
);
}
}
);
}
src/main/webapp/HG/WD/HGWD001.jsp
View file @
c6adb2a7
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
serviceName=
"HGWD099"
queryMethod=
"query"
deleteMethod=
"delete"
>
serviceName=
"HGWD099"
queryMethod=
"query"
deleteMethod=
"delete"
>
<EF:EFColumn
ename=
"id"
cname=
"ID"
hidden=
"true"
/>
<EF:EFColumn
ename=
"id"
cname=
"ID"
hidden=
"true"
/>
<EF:EFColumn
ename=
"docId"
cname=
"文件ID"
enable=
"false"
width=
"180"
hidden=
"true"
/>
<EF:EFColumn
ename=
"docId"
cname=
"文件ID"
enable=
"false"
width=
"180"
hidden=
"true"
/>
<EF:EFColumn
ename=
"operator"
cname=
"操作"
enable=
"false"
width=
"1
4
0"
align=
"center"
sort=
"false"
/>
<EF:EFColumn
ename=
"operator"
cname=
"操作"
enable=
"false"
width=
"1
0
0"
align=
"center"
sort=
"false"
/>
<EF:EFColumn
ename=
"docName"
cname=
"文件名称"
enable=
"false"
width=
"180"
/>
<EF:EFColumn
ename=
"docName"
cname=
"文件名称"
enable=
"false"
width=
"180"
/>
<EF:EFColumn
ename=
"docType"
cname=
"文件类型"
enable=
"false"
width=
"110"
align=
"center"
/>
<EF:EFColumn
ename=
"docType"
cname=
"文件类型"
enable=
"false"
width=
"110"
align=
"center"
/>
<EF:EFColumn
ename=
"docVersion"
cname=
"版本号"
enable=
"false"
width=
"90"
align=
"center"
sort=
"true"
/>
<EF:EFColumn
ename=
"docVersion"
cname=
"版本号"
enable=
"false"
width=
"90"
align=
"center"
sort=
"true"
/>
...
...
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