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
cc2f2537
Commit
cc2f2537
authored
Sep 11, 2024
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
人员档案附件打包下载开发结束未联调 fxj 2024-09-11
parent
c5c730ba
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
269 additions
and
4 deletions
+269
-4
TAttaInfo.java
...om/yifu/cloud/plus/v1/yifu/archives/entity/TAttaInfo.java
+11
-0
TEmpOtherFile.java
...ifu/cloud/plus/v1/yifu/archives/entity/TEmpOtherFile.java
+5
-0
TEmployeeInfo.java
...ifu/cloud/plus/v1/yifu/archives/entity/TEmployeeInfo.java
+6
-0
TEmployeeInfoController.java
.../v1/yifu/archives/controller/TEmployeeInfoController.java
+15
-1
TEmployeeInfoService.java
...d/plus/v1/yifu/archives/service/TEmployeeInfoService.java
+6
-2
TEmployeeInfoServiceImpl.java
.../yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
+215
-0
CommonConstants.java
...ud/plus/v1/yifu/common/core/constant/CommonConstants.java
+11
-1
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TAttaInfo.java
View file @
cc2f2537
...
...
@@ -80,4 +80,15 @@ public class TAttaInfo extends BaseEntity {
@Schema
(
description
=
"地址URL"
)
@TableField
(
exist
=
false
)
private
String
attaUrl
;
/**
* 附件变更类型:0 增加 1 减少。 档案编辑附件时需要告知后端是增加还是减少
*/
@TableField
(
exist
=
false
)
private
String
handleType
;
/**
* 其他分租名称
*/
@TableField
(
exist
=
false
)
private
String
groupName
;
}
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TEmpOtherFile.java
View file @
cc2f2537
...
...
@@ -77,5 +77,10 @@ public class TEmpOtherFile {
// 附件
@TableField
(
exist
=
false
)
private
List
<
TAttaInfo
>
attaList
;
/**
* 档案编辑其他附件分租信息处理类型 0 新增 1 更新 2 删除
*/
@TableField
(
exist
=
false
)
private
String
handleType
;
}
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TEmployeeInfo.java
View file @
cc2f2537
...
...
@@ -561,4 +561,10 @@ public class TEmployeeInfo extends BaseEntity {
@ExcelAttribute
(
name
=
"是否有职业资格证书"
,
isNotEmpty
=
true
,
isDataId
=
true
,
readConverterExp
=
"0=是,1=否"
)
@Schema
(
description
=
"是否有职业资格证书:0 是 1 否"
)
private
String
haveQualification
;
/**
* 其他附件--C段二维码扫码数据
*/
@TableField
(
exist
=
false
)
private
List
<
TEmpOtherFile
>
otherFiles
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeInfoController.java
View file @
cc2f2537
...
...
@@ -142,7 +142,7 @@ public class TEmployeeInfoController {
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询"
)
@GetMapping
(
"/{id}"
)
public
R
<
TEmployeeInfo
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
tEmployeeInfoService
.
getById
(
id
)
);
return
tEmployeeInfoService
.
getByIdAssociate
(
id
);
}
/**
...
...
@@ -531,4 +531,18 @@ public class TEmployeeInfoController {
tEmployeeInfoService
.
updateEmployeeAgeTask
();
}
/**
* @Author fxj
* @Description 人员档案附件信息导出
* @Date 15:15 2024/9/10
* @Param
* @return
**/
@Operation
(
summary
=
"导出人员档案附件信息ZIP包"
,
description
=
"导出人员档案附件信息ZIP包"
)
@SysLog
(
"导出人员档案附件信息ZIP包"
)
@PostMapping
(
"/exportEmployeeFile/{id}"
)
public
void
exportEmployeeFile
(
@PathVariable
(
"id"
)
String
id
,
HttpServletResponse
response
)
throws
Exception
{
tEmployeeInfoService
.
exportEmployeeFile
(
id
,
response
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeInfoService.java
View file @
cc2f2537
...
...
@@ -92,13 +92,13 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
R
<
String
>
addNewEmployee
(
TEmployeeInfo
employeeInfo
);
/**
* @param
e
mployeeInfo
* @param
tE
mployeeInfo
* @Description: 更新档案信息
* @Author: hgw
* @Date: 2022/6/21 19:29
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
R
<
Boolean
>
updateEmployee
(
TEmployeeInfo
e
mployeeInfo
);
R
<
Boolean
>
updateEmployee
(
TEmployeeInfo
tE
mployeeInfo
);
/**
* @param id
...
...
@@ -256,4 +256,8 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
void
updateEmployeeAgeTask
();
IPage
<
TEmployeeInfo
>
getPageAsso
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
tEmployeeInfo
);
R
<
TEmployeeInfo
>
getByIdAssociate
(
String
id
);
void
exportEmployeeFile
(
String
id
,
HttpServletResponse
response
)
throws
Exception
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
View file @
cc2f2537
...
...
@@ -51,10 +51,20 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.apache.commons.compress.archivers.zip.ZipArchiveEntry
;
import
org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.support.SimpleValueWrapper
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -62,6 +72,7 @@ import javax.servlet.ServletOutputStream;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.time.LocalDateTime
;
import
java.util.*
;
...
...
@@ -91,7 +102,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
private
final
TEmployeeContractInfoService
contractServicer
;
private
final
TEmpOtherFileService
otherFileService
;
private
final
TAttaInfoService
attaInfoService
;
private
final
TEmpOtherFileService
empOtherFileService
;
@Autowired
private
OSSUtil
ossUtil
;
@Override
public
IPage
<
TEmployeeInfo
>
getPage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
employeeInfo
)
{
...
...
@@ -176,6 +194,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
@Override
public
R
<
Boolean
>
updateEmployee
(
TEmployeeInfo
employeeInfo
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
user
==
null
||
Common
.
isEmpty
(
user
.
getId
()))
{
return
R
.
failed
(
CommonConstants
.
PLEASE_LOG_IN
);
...
...
@@ -187,6 +206,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if
(
old
==
null
||
Common
.
isEmpty
(
old
.
getId
()))
{
return
R
.
failed
(
"根据id未找到档案!"
+
employeeInfo
.
getId
());
}
// 获取历史附件信息 fxj 2024-09-09
getAttaInfo
(
old
);
// 校验手机号:
if
(
Common
.
isEmpty
(
employeeInfo
.
getEmpPhone
()))
{
...
...
@@ -227,11 +248,73 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
TEmpEducation
education
=
new
TEmpEducation
();
this
.
doUpdateEducationCore
(
education
,
employeeInfo
);
// 更新附件信息 fxj 2024-09-09
updateOtherAtta
(
employeeInfo
);
// 获取最新附件信息 fxj 2024-09-09
getAttaInfo
(
old
);
// 记录变更日志
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
0
],
old
.
getId
(),
""
,
old
,
employeeInfo
);
return
R
.
ok
(
this
.
updateById
(
employeeInfo
));
}
private
void
updateOtherAtta
(
TEmployeeInfo
employeeInfo
)
{
List
<
TEmpOtherFile
>
otherFileList
=
employeeInfo
.
getOtherFiles
();
if
(
Common
.
isNotNull
(
otherFileList
)){
List
<
TAttaInfo
>
attaInfos
=
new
ArrayList
<>();
for
(
TEmpOtherFile
otherFile:
otherFileList
){
//处理新增或删除其他附件分租的逻辑
handleOtherFile
(
otherFile
);
if
(
Common
.
isNotNull
(
otherFile
.
getAttaList
())){
attaInfos
.
addAll
(
otherFile
.
getAttaList
());
}
}
if
(
Common
.
isNotNull
(
attaInfos
)){
List
<
String
>
deleteIds
=
new
ArrayList
<>();
List
<
TAttaInfo
>
adds
=
new
ArrayList
<>();
for
(
TAttaInfo
attaInfo:
attaInfos
){
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
attaInfo
.
getHandleType
())){
adds
.
add
(
attaInfo
);
}
if
(
CommonConstants
.
ONE_STRING
.
equals
(
attaInfo
.
getHandleType
())){
deleteIds
.
add
(
attaInfo
.
getId
());
}
}
if
(
Common
.
isNotNull
(
deleteIds
)){
attaInfoService
.
removeBatchByIds
(
deleteIds
);
}
if
(
Common
.
isNotNull
(
adds
)){
attaInfoService
.
saveBatch
(
adds
);
}
}
}
}
private
void
handleOtherFile
(
TEmpOtherFile
otherFile
)
{
// 新增时先增加 empOtherFile
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
otherFile
.
getHandleType
())){
empOtherFileService
.
save
(
otherFile
);
if
(
Common
.
isNotNull
(
otherFile
.
getAttaList
())){
for
(
TAttaInfo
info:
otherFile
.
getAttaList
()){
info
.
setDomainId
(
otherFile
.
getId
());
}
}
// 删除时
}
else
if
(
CommonConstants
.
TWO_STRING
.
equals
(
otherFile
.
getHandleType
())){
empOtherFileService
.
removeById
(
otherFile
.
getId
());
}
}
private
void
getAttaInfo
(
TEmployeeInfo
old
)
{
List
<
TEmpOtherFile
>
otherFiles
=
otherFileService
.
getListByEmpId
(
old
.
getId
());
if
(
Common
.
isEmpty
(
otherFiles
)){
for
(
TEmpOtherFile
file:
otherFiles
){
file
.
setAttaList
(
attaInfoService
.
list
(
Wrappers
.<
TAttaInfo
>
query
().
lambda
().
eq
(
TAttaInfo:
:
getDomainId
,
file
.
getId
())));
}
}
old
.
setOtherFiles
(
otherFiles
);
}
@Override
public
R
<
String
>
deleteEmployee
(
String
id
)
{
TEmployeeInfo
employee
=
this
.
getById
(
id
);
...
...
@@ -2617,4 +2700,136 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
public
IPage
<
TEmployeeInfo
>
getPageAsso
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
employeeInfo
)
{
return
baseMapper
.
getPageAsso
(
page
,
employeeInfo
);
}
@Override
public
R
<
TEmployeeInfo
>
getByIdAssociate
(
String
id
)
{
if
(
Common
.
isEmpty
(
id
)){
return
R
.
failed
(
CommonConstants
.
PARAM_INFO_ERROR
);
}
TEmployeeInfo
employeeInfo
=
baseMapper
.
selectById
(
id
);
if
(
Common
.
isEmpty
(
employeeInfo
)){
return
R
.
failed
(
CommonConstants
.
NO_DATA_TO_HANDLE
);
}
getAttaInfo
(
employeeInfo
);
return
R
.
ok
(
employeeInfo
);
}
/**
* @Author fxj
* @Description 获取人员档案附件信息下载ZIP
* @Date 11:13 2024/9/10
* @Param
* @return
**/
@Override
public
void
exportEmployeeFile
(
String
id
,
HttpServletResponse
response
)
throws
Exception
{
if
(
Common
.
isEmpty
(
id
)){
throw
new
RuntimeException
(
CommonConstants
.
PARAM_IS_NOT_ERROR
);
}
TEmployeeInfo
emp
=
baseMapper
.
selectById
(
id
);
if
(
Common
.
isEmpty
(
emp
)){
throw
new
RuntimeException
(
CommonConstants
.
NO_DATA_TO_HANDLE
);
}
List
<
TAttaInfo
>
handles
=
new
ArrayList
<>();
HttpGet
httpGet
;
//初始化导出 response
response
.
setContentType
(
"application/octet-stream"
);
response
.
setHeader
(
"content-type"
,
"application/octet-stream"
);
response
.
setHeader
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename="
+
URLEncoder
.
encode
(
emp
.
getEmpName
()+
emp
.
getEmpIdcard
(),
"UTF-8"
)+
".zip"
);
ZipArchiveOutputStream
zipOutput
=
new
ZipArchiveOutputStream
(
response
.
getOutputStream
());
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
// 获取人员档案所有的附件信息
getFilesInfo
(
id
,
handles
);
// 处理附件 压缩并下载
if
(
Common
.
isNotNull
(
handles
)){
try
{
CloseableHttpResponse
response1
;
HttpEntity
entity
;
byte
[]
data
;
HashMap
<
String
,
Integer
>
groupNameMap
=
new
HashMap
<>();
ZipArchiveEntry
entry
;
for
(
TAttaInfo
fileAtta:
handles
){
httpGet
=
new
HttpGet
(
fileAtta
.
getAttaUrl
());
response1
=
httpClient
.
execute
(
httpGet
);
entity
=
response1
.
getEntity
();
data
=
EntityUtils
.
toByteArray
(
entity
);
entry
=
new
ZipArchiveEntry
(
initFileName
(
fileAtta
,
groupNameMap
));
zipOutput
.
putArchiveEntry
(
entry
);
zipOutput
.
write
(
data
);
zipOutput
.
closeArchiveEntry
();
}
zipOutput
.
finish
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
private
void
getFilesInfo
(
String
id
,
List
<
TAttaInfo
>
handles
)
{
List
<
TAttaInfo
>
attas
;
URL
url
;
// 获取其他附件
List
<
TEmpOtherFile
>
otherFiles
=
otherFileService
.
list
(
Wrappers
.<
TEmpOtherFile
>
query
().
lambda
().
eq
(
TEmpOtherFile:
:
getEmpId
,
id
));
if
(
Common
.
isNotNull
(
otherFiles
)){
try
{
for
(
TEmpOtherFile
otherFile:
otherFiles
){
attas
=
attaInfoService
.
list
(
Wrappers
.<
TAttaInfo
>
query
().
lambda
().
eq
(
TAttaInfo:
:
getDomainId
,
otherFile
.
getId
()));
if
(
Common
.
isNotNull
(
attas
)){
for
(
TAttaInfo
atta:
attas
){
url
=
ossUtil
.
getObjectUrl
(
null
,
atta
.
getAttaSrc
());
atta
.
setAttaUrl
(
url
.
toString
().
replace
(
"http"
,
"https"
));
atta
.
setGroupName
(
otherFile
.
getAttaName
());
handles
.
add
(
atta
);
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
// 获取其他附件以外的附件如身份证正反面
attas
=
attaInfoService
.
list
(
Wrappers
.<
TAttaInfo
>
query
().
lambda
().
eq
(
TAttaInfo:
:
getDomainId
,
id
));
if
(
Common
.
isNotNull
(
attas
))
{
for
(
TAttaInfo
atta:
attas
){
if
(
CommonConstants
.
TWENTY_THREE_STRING
.
equals
(
atta
.
getRelationType
())){
continue
;
}
url
=
ossUtil
.
getObjectUrl
(
null
,
atta
.
getAttaSrc
());
atta
.
setAttaUrl
(
url
.
toString
().
replace
(
"http"
,
"https"
));
handles
.
add
(
atta
);
}
}
}
private
String
initFileName
(
TAttaInfo
fileAtta
,
HashMap
<
String
,
Integer
>
groupNameMap
)
{
/**
* 关系类型(0客户附件1联系人附件2跟进记录附件3合同附件4合同归档附件5报价单6招投标7业务评估8二维码9身份证 10 户口本
* ;21(预入职申明签名);22(预入职确认签名);23(预入职pdf文件);0(最高教育经历);2(执业资格证书);24 身份证国徽
* 25 户口本本人页26学信27预入职其他附件
*/
if
(
CommonConstants
.
NINE_STRING
.
equals
(
fileAtta
.
getRelationType
())){
return
"身份证1"
+
fileAtta
.
getAttaType
();
}
else
if
(
CommonConstants
.
TWENTY_FOUR_STRING
.
equals
(
fileAtta
.
getRelationType
())){
return
"身份证2"
+
fileAtta
.
getAttaType
();
}
else
if
(
CommonConstants
.
TWENTY_ONE_STRING
.
equals
(
fileAtta
.
getRelationType
())){
return
"签名1"
+
fileAtta
.
getAttaType
();
}
else
if
(
CommonConstants
.
TWENTY_TWO_STRING
.
equals
(
fileAtta
.
getRelationType
())){
return
"签名2"
+
fileAtta
.
getAttaType
();
}
else
if
(
CommonConstants
.
TEN_STRING
.
equals
(
fileAtta
.
getRelationType
())){
return
"户口本1"
+
fileAtta
.
getAttaType
();
}
else
if
(
CommonConstants
.
TWENTY_FIVE_STRING
.
equals
(
fileAtta
.
getRelationType
())){
return
"户口本2"
+
fileAtta
.
getAttaType
();
}
else
if
(
CommonConstants
.
TWENTY_SEVEN_STRING
.
equals
(
fileAtta
.
getRelationType
())){
if
(
Common
.
isNotNull
(
fileAtta
.
getGroupName
())){
if
(
Common
.
isNotNull
(
groupNameMap
.
get
(
fileAtta
.
getGroupName
()))){
groupNameMap
.
put
(
fileAtta
.
getGroupName
(),
groupNameMap
.
get
(
fileAtta
.
getGroupName
())+
1
);
}
else
{
groupNameMap
.
put
(
fileAtta
.
getGroupName
(),
1
);
}
return
fileAtta
.
getGroupName
()
+
groupNameMap
.
get
(
fileAtta
.
getGroupName
())+
fileAtta
.
getAttaType
();
}
return
fileAtta
.
getGroupName
()+
fileAtta
.
getAttaType
();
}
else
{
return
fileAtta
.
getAttaName
();
}
}
}
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/constant/CommonConstants.java
View file @
cc2f2537
...
...
@@ -146,6 +146,16 @@ public interface CommonConstants {
String
SIXTEEN_STRING
=
"16"
;
String
TWENTY_TWO_STRING
=
"22"
;
String
TWENTY_THREE_STRING
=
"23"
;
String
TWENTY_FOUR_STRING
=
"24"
;
String
TWENTY_FIVE_STRING
=
"25"
;
String
TWENTY_SEVEN_STRING
=
"27"
;
public
static
final
String
DEFAULT_PASSWORD
=
"123456"
;
/**
...
...
@@ -507,7 +517,7 @@ public interface CommonConstants {
public
static
final
String
TWENTY_STRING
=
"20"
;
public
static
final
int
TWENTY_ONE_STRING
=
21
;
public
static
final
String
TWENTY_ONE_STRING
=
"21"
;
public
static
final
String
ERROR_MSG_PRFIX
=
"error="
;
...
...
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