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
5e42c554
Commit
5e42c554
authored
Jul 17, 2022
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fdd 户配置 代码修改
parent
e097cfb7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
35 deletions
+66
-35
TElecEmployeeInfoServiceImpl.java
...u/archives/service/impl/TElecEmployeeInfoServiceImpl.java
+66
-35
No files found.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TElecEmployeeInfoServiceImpl.java
View file @
5e42c554
...
...
@@ -78,12 +78,12 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
@Override
public
IPage
<
TElecEmployeeInfo
>
getTElecEmployeeInfoPage
(
Page
page
,
TElecEmployeeInfo
tElecEmployeeInfo
)
{
return
baseMapper
.
getTElecEmployeeInfoPage
(
page
,
tElecEmployeeInfo
);
return
baseMapper
.
getTElecEmployeeInfoPage
(
page
,
tElecEmployeeInfo
);
}
/**
* @description: 解析zip文件包中的多个附件,并生成结算记录
* @param zipFile zip文件包
* @description: 解析zip文件包中的多个附件,并生成结算记录
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: huyc
* @date: 2022/6/27
...
...
@@ -117,7 +117,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
@Override
public
R
getEmpInfoByCard
(
String
idCard
)
{
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getOne
((
Wrappers
.<
TEmployeeInfo
>
query
().
lambda
()
.
eq
(
TEmployeeInfo:
:
getEmpIdcard
,
idCard
)).
eq
(
TEmployeeInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
));
.
eq
(
TEmployeeInfo:
:
getEmpIdcard
,
idCard
)).
eq
(
TEmployeeInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
));
if
(
Common
.
isNotNull
(
tEmployeeInfo
))
{
if
(
CommonConstants
.
ONE_INT
==
tEmployeeInfo
.
getFileStatus
())
{
return
R
.
failed
(
"身份证号对应的档案为已减档"
);
...
...
@@ -132,15 +132,16 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
baseMapper
.
insert
(
tElecEmployeeInfo
);
//更新附件信息
List
<
String
>
ids
;
if
(
Common
.
isNotNull
(
tElecEmployeeInfo
.
getAttaIds
())){
ids
=
Common
.
initStrToList
(
tElecEmployeeInfo
.
getAttaIds
(),
CommonConstants
.
COMMA_STRING
);
attaInfoMapper
.
updateDomainId
(
tElecEmployeeInfo
.
getId
(),
ids
);
if
(
Common
.
isNotNull
(
tElecEmployeeInfo
.
getAttaIds
()))
{
ids
=
Common
.
initStrToList
(
tElecEmployeeInfo
.
getAttaIds
(),
CommonConstants
.
COMMA_STRING
);
attaInfoMapper
.
updateDomainId
(
tElecEmployeeInfo
.
getId
(),
ids
);
}
return
R
.
ok
();
}
/**
* zip解压
*
* @param srcFile zip源文件
* @throws RuntimeException 解压失败会抛出运行时异常
*/
...
...
@@ -155,7 +156,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
Map
<
String
,
String
>
elecTypeMap
;
if
(
dictR
==
null
)
{
return
R
.
failed
(
"获取字典失败!"
);
}
else
{
}
else
{
dictMap
=
dictR
.
getData
();
elecTypeMapData
=
dictMap
.
get
(
"data"
);
elecTypeMap
=
elecTypeMapData
.
get
(
"literature_types"
);
...
...
@@ -170,34 +171,54 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
zipFile
=
new
ZipFile
(
srcFile
,
CharsetUtil
.
CHARSET_GBK
);
Enumeration
<?>
entries
=
zipFile
.
entries
();
Enumeration
<?>
entriesCheck
=
zipFile
.
entries
();
Map
<
String
,
String
>
insMap
=
new
HashMap
<>();
List
<
TElecEmployeeInfo
>
infolist
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
Set
<
String
>
infoList
=
new
HashSet
<>();
Set
<
String
>
idCardList
=
new
HashSet
<>();
Set
<
String
>
cardType
=
new
HashSet
<>();
while
(
entriesCheck
.
hasMoreElements
())
{
ZipEntry
entry
=
(
ZipEntry
)
entriesCheck
.
nextElement
();
//添加进filesName
String
empInfo
=
entry
.
getName
();
// 如果是文件夹,就创建个文件夹
if
(!
entry
.
isDirectory
())
{
if
(
empInfo
.
length
()
>
empInfo
.
lastIndexOf
(
"/"
)
+
1
)
{
String
idCard
=
empInfo
.
substring
(
0
,
empInfo
.
indexOf
(
"/"
));
String
dataType
=
empInfo
.
substring
(
empInfo
.
indexOf
(
"/"
)
+
1
,
empInfo
.
lastIndexOf
(
"/"
));
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getOne
((
Wrappers
.<
TEmployeeInfo
>
query
().
lambda
()
.
eq
(
TEmployeeInfo:
:
getEmpIdcard
,
idCard
)).
eq
(
TEmployeeInfo:
:
getFileStatus
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TEmployeeInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
TEmployeeInfo:
:
getFileStatus
,
CommonConstants
.
ZERO_INT
));
if
(
Common
.
isEmpty
(
tEmployeeInfo
))
{
return
R
.
failed
(
"未找到身份证对应的档案信息,身份证号:"
+
idCard
);
}
infoList
.
add
(
empInfo
);
String
dataType
=
""
;
if
(
empInfo
.
length
()
==
empInfo
.
lastIndexOf
(
"/"
)
+
1
)
{
String
idCard
=
empInfo
.
substring
(
0
,
empInfo
.
indexOf
(
"/"
));
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getOne
((
Wrappers
.<
TEmployeeInfo
>
query
().
lambda
()
.
eq
(
TEmployeeInfo:
:
getEmpIdcard
,
idCard
)).
eq
(
TEmployeeInfo:
:
getFileStatus
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TEmployeeInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
TEmployeeInfo:
:
getFileStatus
,
CommonConstants
.
ZERO_INT
));
if
(
Common
.
isEmpty
(
tEmployeeInfo
))
{
return
R
.
failed
(
"未找到身份证对应的档案信息,身份证号:"
+
idCard
);
}
idCardList
.
add
(
idCard
);
if
(
empInfo
.
length
()
>
20
)
{
dataType
=
empInfo
.
substring
(
empInfo
.
indexOf
(
"/"
)
+
1
,
empInfo
.
lastIndexOf
(
"/"
));
if
(
Common
.
isNotNull
(
elecTypeMap
))
{
if
(!
Common
.
isNotNull
(
elecTypeMap
.
get
(
dataType
)))
{
return
R
.
failed
(
"资料类型错误:"
+
dataType
);
}
cardType
.
add
(
idCard
+
"/"
+
dataType
);
}
}
}
}
for
(
String
idCarInfo
:
idCardList
)
{
if
(!
infoList
.
stream
().
anyMatch
(
e
->
containsCheckTwo
(
e
,
idCarInfo
)))
{
return
R
.
failed
(
idCarInfo
+
":"
+
"证件数据不可为空"
);
}
}
if
(
cardType
.
size
()
>
CommonConstants
.
ZERO_INT
)
{
for
(
String
typeInfo
:
cardType
)
{
if
(!
infoList
.
stream
().
anyMatch
(
e
->
containsCheckOne
(
e
,
typeInfo
)))
{
return
R
.
failed
(
typeInfo
+
":"
+
"证件数据不可为空"
);
}
}
}
Map
<
String
,
String
>
insMap
=
new
HashMap
<>();
List
<
TElecEmployeeInfo
>
infolist
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
while
(
entries
.
hasMoreElements
())
{
ZipEntry
entry
=
(
ZipEntry
)
entries
.
nextElement
();
//添加进filesName
...
...
@@ -226,37 +247,31 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
}
TElecEmployeeInfo
tElecEmployeeInfo
=
new
TElecEmployeeInfo
();
if
(
empInfo
.
length
()
>
empInfo
.
lastIndexOf
(
"/"
)
+
1
)
{
String
idCard
=
empInfo
.
substring
(
0
,
empInfo
.
indexOf
(
"/"
));
String
dataType
=
empInfo
.
substring
(
empInfo
.
indexOf
(
"/"
)
+
1
,
empInfo
.
lastIndexOf
(
"/"
));
if
(
empInfo
.
length
()
>
empInfo
.
lastIndexOf
(
"/"
)
+
1
)
{
String
idCard
=
empInfo
.
substring
(
0
,
empInfo
.
indexOf
(
"/"
));
String
dataType
=
empInfo
.
substring
(
empInfo
.
indexOf
(
"/"
)
+
1
,
empInfo
.
lastIndexOf
(
"/"
));
String
empName
=
""
;
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getOne
((
Wrappers
.<
TEmployeeInfo
>
query
().
lambda
()
.
eq
(
TEmployeeInfo:
:
getEmpIdcard
,
idCard
)).
eq
(
TEmployeeInfo:
:
getFileStatus
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TEmployeeInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
));
.
eq
(
TEmployeeInfo:
:
getEmpIdcard
,
idCard
)).
eq
(
TEmployeeInfo:
:
getFileStatus
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TEmployeeInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
));
if
(
Common
.
isNotNull
(
tEmployeeInfo
))
{
empName
=
tEmployeeInfo
.
getEmpName
();
}
else
{
return
R
.
failed
(
"未找到身份证对应的档案信息,身份证号:"
+
idCard
);
}
tElecEmployeeInfo
.
setEmpIdcard
(
idCard
);
tElecEmployeeInfo
.
setEmpName
(
empName
);
if
(
Common
.
isNotNull
(
elecTypeMap
))
{
if
(
Common
.
isNotNull
(
elecTypeMap
.
get
(
dataType
)))
{
tElecEmployeeInfo
.
setDataType
(
elecTypeMap
.
get
(
dataType
));
}
else
{
return
R
.
failed
(
"资料类型错误:"
+
dataType
);
}
}
String
id
=
insMap
.
get
(
idCard
+
CommonConstants
.
DOWN_LINE_STRING
+
dataType
);
//if (!elecTypeMap.get(dataType).equals(insMap.get(idCard))) {
if
(
Common
.
isEmpty
(
id
))
{
infolist
.
add
(
tElecEmployeeInfo
);
this
.
save
(
tElecEmployeeInfo
);
insMap
.
put
(
idCard
+
CommonConstants
.
DOWN_LINE_STRING
+
dataType
,
tElecEmployeeInfo
.
getId
());
}
list
.
add
(
insMap
.
get
(
idCard
+
CommonConstants
.
DOWN_LINE_STRING
+
dataType
));
fileUploadService
.
uploadImg
(
fileCovertMultipartFile
(
targetFile
),
""
,
CommonConstants
.
EIGHT_INT
,
insMap
.
get
(
idCard
+
CommonConstants
.
DOWN_LINE_STRING
+
dataType
));
fileUploadService
.
uploadImg
(
fileCovertMultipartFile
(
targetFile
),
""
,
CommonConstants
.
EIGHT_INT
,
insMap
.
get
(
idCard
+
CommonConstants
.
DOWN_LINE_STRING
+
dataType
));
}
// 关流顺序,先打开的后关闭
...
...
@@ -282,8 +297,9 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
/**
* File转MultipartFile
*
@description: File转MultipartFile
*
* @param file 需要转换的文件
* @description: File转MultipartFile
* @return: org.springframework.web.multipart.MultipartFile
* @author: huyc
* @date: 2022/6/27
...
...
@@ -311,6 +327,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
/**
* 根据路径删除指定的目录或文件,无论存在与否
*
* @param path 要删除的目录或文件路径
* @return 删除成功返回 true,否则返回 false
*/
...
...
@@ -376,4 +393,18 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
//删除当前目录
return
dirFile
.
delete
();
}
public
boolean
containsCheckTwo
(
String
e
,
String
idCard
)
{
if
(
e
.
contains
(
idCard
)
&&
e
.
length
()
>
20
)
{
return
true
;
}
return
false
;
}
public
boolean
containsCheckOne
(
String
e
,
String
cardType
)
{
if
(
e
.
contains
(
cardType
)
&&
e
.
contains
(
CommonConstants
.
SPOT
))
{
return
true
;
}
return
false
;
}
}
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