Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
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
fangxinjiang
yifu-mvp
Commits
bd54c0d1
Commit
bd54c0d1
authored
Jan 04, 2026
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huych-电子档案批量导入第三次提交
parent
4338a7a0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
131 additions
and
164 deletions
+131
-164
ArchiveConstants.java
.../yifu/cloud/plus/v1/batch/constants/ArchiveConstants.java
+5
-20
FileUploadController.java
.../cloud/plus/v1/batch/controller/FileUploadController.java
+14
-6
TElectronicArchiveDetailMapper.java
.../plus/v1/batch/mapper/TElectronicArchiveDetailMapper.java
+4
-0
ElectronicArchiveImportServiceImpl.java
...atch/service/impl/ElectronicArchiveImportServiceImpl.java
+36
-23
FileUploadServiceImpl.java
...oud/plus/v1/batch/service/impl/FileUploadServiceImpl.java
+3
-2
TElectronicArchiveDetailServiceImpl.java
...tch/service/impl/TElectronicArchiveDetailServiceImpl.java
+57
-113
TElectronicArchiveDetailMapper.xml
.../main/resources/mapper/TElectronicArchiveDetailMapper.xml
+12
-0
No files found.
yifu-batch/yifu-batch-api/src/main/java/com/yifu/cloud/plus/v1/batch/constants/ArchiveConstants.java
View file @
bd54c0d1
...
...
@@ -53,6 +53,11 @@ public interface ArchiveConstants {
*/
String
ATTA_RELATION_TYPE_FEEDBACK
=
"3"
;
/**
* 附件关系类型-人员附件
*/
String
ATTA_RELATION_TYPE_PER
=
"4"
;
/**
* 附件状态-可用
*/
...
...
@@ -83,26 +88,6 @@ public interface ArchiveConstants {
*/
String
MATERIAL_TYPE_LEAVE
=
"离职"
;
/**
* 资料类型编码-存量
*/
String
MATERIAL_TYPE_CODE_STOCK
=
"0"
;
/**
* 资料类型编码-新签
*/
String
MATERIAL_TYPE_CODE_NEW
=
"1"
;
/**
* 资料类型编码-续签
*/
String
MATERIAL_TYPE_CODE_RENEW
=
"2"
;
/**
* 资料类型编码-离职
*/
String
MATERIAL_TYPE_CODE_LEAVE
=
"3"
;
/**
* 处理结果-成功
*/
...
...
yifu-batch/yifu-batch-biz/src/main/java/com/yifu/cloud/plus/v1/batch/controller/FileUploadController.java
View file @
bd54c0d1
package
com
.
yifu
.
cloud
.
plus
.
v1
.
batch
.
controller
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.yifu.cloud.plus.v1.batch.entity.TAttaInfo
;
import
com.yifu.cloud.plus.v1.batch.service.FileUploadService
;
import
com.yifu.cloud.plus.v1.batch.service.TAttaInfoService
;
import
com.yifu.cloud.plus.v1.batch.entity.TAttaInfo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil
;
...
...
@@ -18,7 +18,9 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.IOException
;
import
java.net.URL
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author fang
...
...
@@ -187,8 +189,9 @@ public class FileUploadController {
}
// 构建OSS文件路径,如果文件名重复则添加后缀
String
key
=
buildUniqueFilePath
(
filePath
,
fileName
);
Map
<
String
,
String
>
keyMap
=
buildUniqueFilePath
(
filePath
,
fileName
);
String
key
=
keyMap
.
get
(
"key"
);
fileName
=
keyMap
.
get
(
"name"
);
// 校验文件类型
if
(!
Common
.
checkFile
(
key
))
{
return
R
.
failed
(
"非法上传类型:"
+
fileName
);
...
...
@@ -245,11 +248,14 @@ public class FileUploadController {
* @param fileName 文件名
* @return 唯一的文件路径
*/
private
String
buildUniqueFilePath
(
String
filePath
,
String
fileName
)
{
private
Map
<
String
,
String
>
buildUniqueFilePath
(
String
filePath
,
String
fileName
)
{
Map
<
String
,
String
>
fileMap
=
new
HashMap
<>();
// 检查文件是否存在
if
(!
fileUploadService
.
checkFileExists
(
filePath
+
"/"
+
fileName
))
{
return
filePath
+
"/"
+
fileName
;
fileMap
.
put
(
"key"
,
filePath
+
"/"
+
fileName
);
fileMap
.
put
(
"name"
,
fileName
);
return
fileMap
;
}
// 文件存在,添加后缀
...
...
@@ -264,6 +270,8 @@ public class FileUploadController {
nameWithoutExt
=
fileName
;
extension
=
""
;
}
return
filePath
+
"/"
+
nameWithoutExt
+
"_"
+
System
.
currentTimeMillis
()
+
extension
;
fileMap
.
put
(
"key"
,
filePath
+
"/"
+
nameWithoutExt
+
"_"
+
System
.
currentTimeMillis
()
+
extension
);
fileMap
.
put
(
"name"
,
nameWithoutExt
+
"_"
+
System
.
currentTimeMillis
()
+
extension
);
return
fileMap
;
}
}
yifu-batch/yifu-batch-biz/src/main/java/com/yifu/cloud/plus/v1/batch/mapper/TElectronicArchiveDetailMapper.java
View file @
bd54c0d1
...
...
@@ -8,6 +8,8 @@ import com.yifu.cloud.plus.v1.batch.vo.TElectronicArchiveDetailSearchVo;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 电子档案明细表
*
...
...
@@ -22,4 +24,6 @@ public interface TElectronicArchiveDetailMapper extends BaseMapper<TElectronicAr
* @return
*/
IPage
<
TElectronicArchiveDetail
>
getTElectronicArchiveDetailPage
(
Page
<
TElectronicArchiveDetail
>
page
,
@Param
(
"tElectronicArchiveDetail"
)
TElectronicArchiveDetailSearchVo
tElectronicArchiveDetail
);
List
<
TElectronicArchiveDetail
>
getTElectronicArchiveDetailList
(
@Param
(
"tElectronicArchiveDetail"
)
TElectronicArchiveDetailSearchVo
tElectronicArchiveDetail
);
}
yifu-batch/yifu-batch-biz/src/main/java/com/yifu/cloud/plus/v1/batch/service/impl/ElectronicArchiveImportServiceImpl.java
View file @
bd54c0d1
...
...
@@ -24,6 +24,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.IdNameNoVo;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
...
...
@@ -38,7 +39,6 @@ import org.springframework.cache.support.SimpleValueWrapper;
import
org.springframework.mock.web.MockMultipartFile
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
...
...
@@ -189,14 +189,24 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
Map
<
String
,
String
>
map
=
new
HashMap
<>();
List
<
String
>
deptNoList
=
new
ArrayList
<>();
if
(
Common
.
isNotNull
(
user
)
&&
!
CommonConstants
.
ZERO_STRING
.
equals
(
user
.
getSystemFlag
()))
{
boolean
isCheck
=
true
;
List
<
Long
>
roleList
=
user
.
getClientRoleMap
().
get
(
ClientNameConstants
.
CLIENT_MVP
);
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
user
.
getSystemFlag
())
||
(
Common
.
isNotNull
(
roleList
)
&&
roleList
.
stream
().
anyMatch
(
role
->
role
==
1569585030423158786L
)))
{
isCheck
=
false
;
}
if
(
Common
.
isNotNull
(
user
)
&&
isCheck
)
{
deptNoList
=
getDeptNoList
(
user
.
getId
());
}
for
(
ArchiveImportVO
data
:
dataList
)
{
try
{
//超管和档案管理员无需校验项目权限
if
(
Common
.
isNotNull
(
user
)
&&
!
CommonConstants
.
ZERO_STRING
.
equals
(
user
.
getSystemFlag
())
)
{
if
(
Common
.
isEmpty
(
deptNoList
))
{
if
(
Common
.
isNotNull
(
user
)
&&
isCheck
)
{
if
(
Common
.
isEmpty
(
deptNoList
)
||
!
deptNoList
.
contains
(
data
.
getDeptNo
())
)
{
ErrorMessage
<
ArchiveImportVO
>
errorMessage
=
new
ErrorMessage
<>(
data
.
getRowIndex
()
,
InsurancesConstants
.
DEPT_NO_NOT_IN_USER_DEPT_LIST
,
data
);
errorMessageList
.
add
(
errorMessage
);
...
...
@@ -374,7 +384,6 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
* 第二步:导入ZIP文件
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
<?>
importZipFile
(
MultipartFile
file
,
String
taskId
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
null
==
user
)
{
...
...
@@ -566,7 +575,7 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
taskService
.
updateById
(
task
);
// 生成反馈表
generateFeedbackExcel
(
task
Id
,
feedbackList
);
generateFeedbackExcel
(
task
,
feedbackList
);
return
R
.
ok
(
"处理完成"
);
}
catch
(
Exception
e
)
{
...
...
@@ -761,15 +770,6 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
private
void
processFile
(
File
file
,
TElectronicArchiveDetail
detail
,
String
materialType
,
List
<
ArchiveFeedbackVO
>
feedbackList
,
Set
<
String
>
materialTypes
)
{
String
fileName
=
file
.
getName
();
long
fileSize
=
file
.
length
();
// 1. 校验文件大小
// if (fileSize > ArchiveConstants.SINGLE_FILE_MAX_SIZE) {
// ArchiveFeedbackVO feedback = createFeedbackVO(detail, materialType,
// ArchiveConstants.PROCESS_RESULT_FAILED, "单个文件大小超过15M:" + fileName);
// feedbackList.add(feedback);
// return;
// }
// 2. 校验文件格式
if
(!
checkFileFormat
(
fileName
))
{
...
...
@@ -916,7 +916,7 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
/**
* 生成反馈表Excel
*/
private
void
generateFeedbackExcel
(
String
taskId
,
List
<
ArchiveFeedbackVO
>
feedbackList
)
{
private
void
generateFeedbackExcel
(
TElectronicArchiveTask
task
,
List
<
ArchiveFeedbackVO
>
feedbackList
)
{
if
(
CollUtil
.
isEmpty
(
feedbackList
))
{
return
;
}
...
...
@@ -924,7 +924,7 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
try
{
// 创建临时文件
String
tempFilePath
=
System
.
getProperty
(
"java.io.tmpdir"
)
+
File
.
separator
+
"feedback_"
+
System
.
currentTimeMillis
()
+
".xlsx"
;
task
.
getTaskCode
()
+
"结果反馈表"
+
".xlsx"
;
File
feedbackFile
=
new
File
(
tempFilePath
);
// 使用EasyExcel生成反馈表
...
...
@@ -939,13 +939,13 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
fileToMultipartFile
(
feedbackFile
),
"archive/feedback"
,
ArchiveConstants
.
ATTA_RELATION_TYPE_FEEDBACK
,
task
Id
task
.
getId
()
);
if
(
R
.
isSuccess
(
uploadResult
))
{
log
.
info
(
"反馈表生成成功
,任务ID:{}"
,
taskId
);
log
.
info
(
"反馈表生成成功
"
);
}
else
{
log
.
error
(
"反馈表上传失败
,任务ID:{}"
,
taskId
);
log
.
error
(
"反馈表上传失败
"
);
}
}
...
...
@@ -953,7 +953,7 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
FileUtil
.
del
(
feedbackFile
);
}
catch
(
Exception
e
)
{
log
.
error
(
"生成反馈表失败
,任务ID:{}"
,
taskId
,
e
);
log
.
error
(
"生成反馈表失败
:"
,
e
);
}
}
...
...
@@ -1021,7 +1021,6 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
* 单个新增人员附件
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
<?>
uploadSinglePersonArchive
(
String
empIdcard
,
String
empName
,
String
deptNo
,
String
deptName
,
String
materialType
,
MultipartFile
[]
files
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
...
...
@@ -1173,7 +1172,6 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
* 前端先调用文件上传接口获取附件ID列表,再调用此方法更新附件的domainId
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
<?>
uploadSinglePersonArchiveByAttaIds
(
String
empIdcard
,
String
empName
,
String
deptNo
,
String
deptName
,
String
materialType
,
List
<
String
>
attaIdList
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
...
...
@@ -1245,6 +1243,21 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
detail
.
setFileCity
(
empInfo
.
getFileCity
());
detail
.
setFileTown
(
empInfo
.
getFileTown
());
detailService
.
save
(
detail
);
// 创建任务,假删除任务
TElectronicArchiveTask
task
=
new
TElectronicArchiveTask
();
task
.
setTaskCode
(
"DZDAPL_SINGLE"
);
task
.
setUploadFileName
(
"单个上传"
);
task
.
setStatus
(
ArchiveConstants
.
TASK_STATUS_GENERATED
);
task
.
setDeleteFlag
(
CommonConstants
.
ONE_STRING
);
taskService
.
save
(
task
);
// 建立任务和档案详情的关联关系
TTaskArchiveRelation
relation
=
new
TTaskArchiveRelation
();
relation
.
setTaskId
(
task
.
getId
());
relation
.
setArchiveDetailId
(
detail
.
getId
());
relationService
.
save
(
relation
);
}
else
{
// 存在则更新资料类型(追加)
Set
<
String
>
existTypes
=
new
HashSet
<>();
...
...
yifu-batch/yifu-batch-biz/src/main/java/com/yifu/cloud/plus/v1/batch/service/impl/FileUploadServiceImpl.java
View file @
bd54c0d1
...
...
@@ -36,9 +36,9 @@ public class FileUploadServiceImpl implements FileUploadService {
private
final
TAttaInfoService
tAttaInfoService
;
private
AtomicInteger
atomicInteger
=
new
AtomicInteger
(
0
);
private
AtomicInteger
atomicInteger
=
new
AtomicInteger
(
0
);
//初始化附件上传队列上限值
private
int
maxLimit
=
1
;
private
int
maxLimit
=
1
;
private
final
SysConfigLimitMapper
configLimitMapper
;
...
...
@@ -80,6 +80,7 @@ public class FileUploadServiceImpl implements FileUploadService {
extension
=
""
;
}
key
=
filePath
+
"/"
+
nameWithoutExt
+
"_"
+
System
.
currentTimeMillis
()
+
extension
;
fileName
=
nameWithoutExt
+
"_"
+
System
.
currentTimeMillis
()
+
extension
;
}
boolean
flag
=
ossUtil
.
uploadFileByStream
(
file
.
getInputStream
(),
key
,
"yf-hr-efile-source"
);
...
...
yifu-batch/yifu-batch-biz/src/main/java/com/yifu/cloud/plus/v1/batch/service/impl/TElectronicArchiveDetailServiceImpl.java
View file @
bd54c0d1
This diff is collapsed.
Click to expand it.
yifu-batch/yifu-batch-biz/src/main/resources/mapper/TElectronicArchiveDetailMapper.xml
View file @
bd54c0d1
...
...
@@ -105,4 +105,16 @@
</where>
ORDER BY a.CREATE_TIME DESC
</select>
<!--tElectronicArchiveDetail简单分页查询-->
<select
id=
"getTElectronicArchiveDetailList"
resultMap=
"tElectronicArchiveDetailMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM t_electronic_archive_detail a
<where>
a.DELETE_FLAG = '0'
<include
refid=
"tElectronicArchiveDetail_where"
/>
</where>
ORDER BY a.CREATE_TIME DESC
</select>
</mapper>
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