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
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
...
...
@@ -19,6 +19,7 @@ import com.yifu.cloud.plus.v1.batch.service.TElectronicArchiveDetailService;
import
com.yifu.cloud.plus.v1.batch.service.TElectronicArchiveTaskService
;
import
com.yifu.cloud.plus.v1.batch.service.TTaskArchiveRelationService
;
import
com.yifu.cloud.plus.v1.batch.vo.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo
;
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.Common
;
...
...
@@ -211,12 +212,26 @@ public class TElectronicArchiveDetailServiceImpl extends ServiceImpl<TElectronic
// 用于存储需要下载的档案及其附件
Map
<
String
,
ArchiveDownloadInfo
>
downloadMap
=
new
LinkedHashMap
<>();
List
<
String
>
deptNoList
=
new
ArrayList
<>();
YifuUser
user
=
SecurityUtils
.
getUser
();
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
)
||
roleList
.
stream
().
anyMatch
(
role
->
role
==
2003347621962379266L
))))
{
isCheck
=
false
;
}
if
(
Common
.
isNotNull
(
user
)
&&
isCheck
)
{
deptNoList
=
getDeptNoList
(
user
.
getId
());
}
try
{
// 1. 校验请求并查询档案信息
for
(
ArchiveBatchDownloadRequestVO
request
:
requestList
)
{
try
{
validateAndPrepareDownload
(
request
,
downloadMap
,
feedbackList
);
validateAndPrepareDownload
(
request
,
downloadMap
,
feedbackList
,
isCheck
,
deptNoList
);
}
catch
(
Exception
e
)
{
log
.
error
(
"处理下载请求失败,姓名:{},身份证:{},项目编码:{}"
,
request
.
getEmpName
(),
request
.
getEmpIdcard
(),
request
.
getDeptNo
(),
e
);
...
...
@@ -278,7 +293,30 @@ public class TElectronicArchiveDetailServiceImpl extends ServiceImpl<TElectronic
log
.
error
(
"批量下载电子档案失败"
,
e
);
}
}
/**
* 获取项目权限
*
* @author huych
* @param userId
* @return {@link List< String>}
*/
public
List
<
String
>
getDeptNoList
(
String
userId
){
List
<
String
>
deptList
=
new
ArrayList
<>(
16
);
try
{
R
<
TSettleDomainListVo
>
settleDomainList
=
archivesDaprUtil
.
getSettleDomainIdsByUserId
(
userId
);
if
(
Common
.
isNotNull
(
settleDomainList
)
&&
settleDomainList
.
getCode
()
==
CommonConstants
.
SUCCESS
){
TSettleDomainListVo
data
=
settleDomainList
.
getData
();
if
(
Optional
.
ofNullable
(
data
).
isPresent
()){
deptList
=
data
.
getDeptNos
();
}
}
}
catch
(
Exception
e
){
log
.
error
(
"查询项目信息出错:"
+
e
);
}
return
deptList
;
}
/**
* 校验请求并准备下载信息
*
...
...
@@ -288,8 +326,15 @@ public class TElectronicArchiveDetailServiceImpl extends ServiceImpl<TElectronic
*/
private
void
validateAndPrepareDownload
(
ArchiveBatchDownloadRequestVO
request
,
Map
<
String
,
ArchiveDownloadInfo
>
downloadMap
,
List
<
ArchiveDownloadFeedbackVO
>
feedbackList
)
{
List
<
ArchiveDownloadFeedbackVO
>
feedbackList
,
boolean
isCheck
,
List
<
String
>
deptNoList
)
{
//项目权限校验
if
(
isCheck
&&
!
deptNoList
.
contains
(
request
.
getDeptNo
()))
{
feedbackList
.
add
(
createFeedbackVO
(
request
,
"没有该项目的权限"
));
return
;
}
// 1. 根据姓名、身份证、项目编码、项目名称查询电子档案明细
LambdaQueryWrapper
<
TElectronicArchiveDetail
>
wrapper
=
Wrappers
.<
TElectronicArchiveDetail
>
lambdaQuery
()
.
eq
(
TElectronicArchiveDetail:
:
getEmpName
,
request
.
getEmpName
())
...
...
@@ -569,33 +614,18 @@ public class TElectronicArchiveDetailServiceImpl extends ServiceImpl<TElectronic
return
R
.
failed
(
"电子档案明细不存在"
);
}
// 2. 校验任务是否存在
TElectronicArchiveTask
task
=
taskService
.
getById
(
request
.
getTaskId
());
if
(
task
==
null
)
{
return
R
.
failed
(
"任务不存在"
);
}
// 3. 校验任务和明细的关联关系
LambdaQueryWrapper
<
TTaskArchiveRelation
>
relationWrapper
=
Wrappers
.<
TTaskArchiveRelation
>
lambdaQuery
()
.
eq
(
TTaskArchiveRelation:
:
getTaskId
,
request
.
getTaskId
())
.
eq
(
TTaskArchiveRelation:
:
getArchiveDetailId
,
request
.
getDetailId
());
TTaskArchiveRelation
relation
=
relationService
.
getOne
(
relationWrapper
);
if
(
relation
==
null
)
{
return
R
.
failed
(
"任务和档案明细没有关联关系"
);
}
// 4. 校验资料类型是否有效
// 2. 校验资料类型是否有效
if
(!
isValidMaterialType
(
request
.
getMaterialType
()))
{
return
R
.
failed
(
"资料类型不正确,必须为:存量、新签、续签、离职"
);
}
//
5
. 查询要删除的附件
//
3
. 查询要删除的附件
List
<
TAttaInfo
>
attachments
=
attaInfoService
.
listByIds
(
request
.
getAttachmentIds
());
if
(
CollUtil
.
isEmpty
(
attachments
))
{
return
R
.
failed
(
"附件不存在"
);
}
//
6
. 校验附件是否都属于该明细
//
4
. 校验附件是否都属于该明细
for
(
TAttaInfo
atta
:
attachments
)
{
if
(!
request
.
getDetailId
().
equals
(
atta
.
getDomainId
()))
{
return
R
.
failed
(
"附件【"
+
atta
.
getAttaName
()
+
"】不属于该档案明细"
);
...
...
@@ -613,7 +643,7 @@ public class TElectronicArchiveDetailServiceImpl extends ServiceImpl<TElectronic
}
}
//
7
. 逻辑删除附件(将状态更新为不可用)
//
5
. 逻辑删除附件(将状态更新为不可用)
int
successCount
=
0
;
int
failCount
=
0
;
StringBuilder
failReasons
=
new
StringBuilder
();
...
...
@@ -643,7 +673,7 @@ public class TElectronicArchiveDetailServiceImpl extends ServiceImpl<TElectronic
}
}
//
8
. 检查该资料类型下是否还有其他可用附件
//
6
. 检查该资料类型下是否还有其他可用附件
LambdaQueryWrapper
<
TAttaInfo
>
attaWrapper
=
Wrappers
.<
TAttaInfo
>
lambdaQuery
()
.
eq
(
TAttaInfo:
:
getDomainId
,
request
.
getDetailId
())
.
eq
(
TAttaInfo:
:
getRelationType
,
ArchiveConstants
.
ATTA_RELATION_TYPE_ZIP
)
...
...
@@ -651,12 +681,12 @@ public class TElectronicArchiveDetailServiceImpl extends ServiceImpl<TElectronic
.
like
(
TAttaInfo:
:
getAttaSrc
,
"/"
+
request
.
getMaterialType
()
+
"/"
);
long
remainingCount
=
attaInfoService
.
count
(
attaWrapper
);
//
9
. 如果该资料类型下没有附件了,从明细的资料类型字段中移除
//
7
. 如果该资料类型下没有附件了,从明细的资料类型字段中移除
if
(
remainingCount
==
0
)
{
updateDetailMaterialTypeAfterDelete
(
detail
,
request
.
getMaterialType
());
}
//
10
. 返回结果
//
8
. 返回结果
String
resultMsg
=
String
.
format
(
"删除完成,成功:%d个,失败:%d个"
,
successCount
,
failCount
);
if
(
failCount
>
0
)
{
resultMsg
+=
"。失败的附件:"
+
failReasons
.
toString
();
...
...
@@ -1049,11 +1079,8 @@ public class TElectronicArchiveDetailServiceImpl extends ServiceImpl<TElectronic
// 1. 根据查询条件查询电子档案明细列表
initSearchVo
(
searchVo
);
// 构建查询条件
LambdaQueryWrapper
<
TElectronicArchiveDetail
>
wrapper
=
buildQueryWrapper
(
searchVo
);
// 查询符合条件的档案明细列表
List
<
TElectronicArchiveDetail
>
detailList
=
baseMapper
.
selectList
(
wrapper
);
List
<
TElectronicArchiveDetail
>
detailList
=
baseMapper
.
getTElectronicArchiveDetailList
(
searchVo
);
// 2. 检查是否有查询结果
if
(
CollUtil
.
isEmpty
(
detailList
))
{
...
...
@@ -1121,89 +1148,6 @@ public class TElectronicArchiveDetailServiceImpl extends ServiceImpl<TElectronic
}
}
/**
* 构建查询条件
*
* @param searchVo 查询VO
* @return 查询条件
*/
private
LambdaQueryWrapper
<
TElectronicArchiveDetail
>
buildQueryWrapper
(
TElectronicArchiveDetailSearchVo
searchVo
)
{
LambdaQueryWrapper
<
TElectronicArchiveDetail
>
wrapper
=
Wrappers
.<
TElectronicArchiveDetail
>
lambdaQuery
()
.
eq
(
TElectronicArchiveDetail:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
TElectronicArchiveDetail:
:
getStatus
,
ArchiveConstants
.
DETAIL_STATUS_ENABLED
);
// 姓名(模糊查询)
if
(
StrUtil
.
isNotBlank
(
searchVo
.
getEmpName
()))
{
wrapper
.
like
(
TElectronicArchiveDetail:
:
getEmpName
,
searchVo
.
getEmpName
());
}
// 身份证号(精确查询)
if
(
StrUtil
.
isNotBlank
(
searchVo
.
getEmpIdcard
()))
{
wrapper
.
eq
(
TElectronicArchiveDetail:
:
getEmpIdcard
,
searchVo
.
getEmpIdcard
());
}
// 项目编码(精确查询)
if
(
StrUtil
.
isNotBlank
(
searchVo
.
getDeptNo
()))
{
wrapper
.
eq
(
TElectronicArchiveDetail:
:
getDeptNo
,
searchVo
.
getDeptNo
());
}
// 项目名称(模糊查询)
if
(
StrUtil
.
isNotBlank
(
searchVo
.
getDeptName
()))
{
wrapper
.
like
(
TElectronicArchiveDetail:
:
getDeptName
,
searchVo
.
getDeptName
());
}
// 客户名称(模糊查询)
if
(
StrUtil
.
isNotBlank
(
searchVo
.
getCustomerName
()))
{
wrapper
.
like
(
TElectronicArchiveDetail:
:
getCustomerName
,
searchVo
.
getCustomerName
());
}
// 客户编码(精确查询)
if
(
StrUtil
.
isNotBlank
(
searchVo
.
getCustomerCode
()))
{
wrapper
.
eq
(
TElectronicArchiveDetail:
:
getCustomerCode
,
searchVo
.
getCustomerCode
());
}
// 资料类型(IN查询)
if
(
CollUtil
.
isNotEmpty
(
searchVo
.
getTypeList
()))
{
wrapper
.
and
(
w
->
{
for
(
String
type
:
searchVo
.
getTypeList
())
{
w
.
or
().
like
(
TElectronicArchiveDetail:
:
getMaterialType
,
type
);
}
});
}
// 档案所在地-省
if
(
searchVo
.
getFileProvince
()
!=
null
)
{
wrapper
.
eq
(
TElectronicArchiveDetail:
:
getFileProvince
,
searchVo
.
getFileProvince
());
}
// 档案所在地-市
if
(
searchVo
.
getFileCity
()
!=
null
)
{
wrapper
.
eq
(
TElectronicArchiveDetail:
:
getFileCity
,
searchVo
.
getFileCity
());
}
// 档案所在地-县
if
(
searchVo
.
getFileTown
()
!=
null
)
{
wrapper
.
eq
(
TElectronicArchiveDetail:
:
getFileTown
,
searchVo
.
getFileTown
());
}
// 创建人
if
(
StrUtil
.
isNotBlank
(
searchVo
.
getCreateBy
()))
{
wrapper
.
eq
(
TElectronicArchiveDetail:
:
getCreateBy
,
searchVo
.
getCreateBy
());
}
// 创建时间区间
if
(
searchVo
.
getCreateTimes
()
!=
null
&&
searchVo
.
getCreateTimes
().
length
==
2
)
{
if
(
searchVo
.
getCreateTimes
()[
0
]
!=
null
)
{
wrapper
.
ge
(
TElectronicArchiveDetail:
:
getCreateTime
,
searchVo
.
getCreateTimes
()[
0
]);
}
if
(
searchVo
.
getCreateTimes
()[
1
]
!=
null
)
{
wrapper
.
le
(
TElectronicArchiveDetail:
:
getCreateTime
,
searchVo
.
getCreateTimes
()[
1
]);
}
}
return
wrapper
;
}
/**
* 准备单个明细的导出信息
*
...
...
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