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
004137bd
Commit
004137bd
authored
Jul 05, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合同-导出
parent
324515f8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
31 deletions
+41
-31
EmployeeContractExportVO.java
...ud/plus/v1/yifu/archives/vo/EmployeeContractExportVO.java
+26
-6
TEmployeeContractInfoServiceImpl.java
...chives/service/impl/TEmployeeContractInfoServiceImpl.java
+8
-19
ExcelUtil.java
...m/yifu.cloud.plus.v1/yifu/common/core/util/ExcelUtil.java
+7
-6
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeContractExportVO.java
View file @
004137bd
...
...
@@ -29,8 +29,6 @@ import org.hibernate.validator.constraints.Length;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.Size
;
import
java.io.Serializable
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -47,68 +45,83 @@ public class EmployeeContractExportVO implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
@Schema
(
description
=
"申请编号"
)
@ExcelProperty
(
"申请编号"
)
private
String
applyNo
;
@ExcelProperty
(
"员工编码"
)
@Length
(
max
=
32
,
message
=
"员工编码不能超过32个字符"
)
@ExcelAttribute
(
name
=
"员工编码"
,
isNotEmpty
=
true
,
errorInfo
=
"员工编码不能为空"
,
maxLength
=
32
)
@Schema
(
description
=
"员工编码"
,
name
=
"empNo"
)
private
String
empNo
;
@ExcelProperty
(
"员工姓名"
)
@Length
(
max
=
32
,
message
=
"员工姓名不能超过32个字符"
)
@ExcelAttribute
(
name
=
"员工姓名"
,
maxLength
=
32
,
needExport
=
true
)
@Schema
(
description
=
"员工姓名"
,
name
=
"empName"
)
private
String
empName
;
@ExcelProperty
(
"身份证号"
)
@Length
(
max
=
32
,
message
=
"身份证号不能超过32个字符"
)
@ExcelAttribute
(
name
=
"身份证号"
,
maxLength
=
32
,
isIdCard
=
true
,
needExport
=
true
)
@Schema
(
description
=
"身份证号"
,
name
=
"empIdcard"
)
private
String
empIdcard
;
@ExcelProperty
(
"合同起始日期"
)
@NotBlank
(
message
=
"合同起始日期不能为空"
)
@ExcelAttribute
(
name
=
"合同起始日期"
,
isNotEmpty
=
true
,
errorInfo
=
"合同起始日期不能为空"
)
@Schema
(
description
=
"合同起始日期"
,
name
=
"contractStart"
)
private
LocalDate
contractStart
;
private
String
contractStart
;
@ExcelProperty
(
"合同截止日期"
)
@ExcelAttribute
(
name
=
"合同截止日期"
,
needExport
=
true
)
@Schema
(
description
=
"合同截止日期"
,
name
=
"contractEnd"
)
private
LocalDate
contractEnd
;
private
String
contractEnd
;
@ExcelProperty
(
"档案-省"
)
@ExcelAttribute
(
name
=
"档案-省"
,
maxLength
=
32
,
isDataId
=
true
,
isArea
=
true
,
parentField
=
""
)
@Schema
(
description
=
"档案-省"
,
name
=
"fileProvince"
)
private
String
fileProvince
;
@ExcelProperty
(
"档案-市"
)
@ExcelAttribute
(
name
=
"档案-市"
,
maxLength
=
32
,
isDataId
=
true
,
isArea
=
true
,
parentField
=
"fileProvince"
)
@Schema
(
description
=
"档案-市"
,
name
=
"fileCity"
)
private
String
fileCity
;
@ExcelProperty
(
"档案-县"
)
@ExcelAttribute
(
name
=
"档案-县"
,
maxLength
=
32
,
isDataId
=
true
,
isArea
=
true
,
parentField
=
"fileCity"
)
@Schema
(
description
=
"档案-县"
,
name
=
"fileTown"
)
private
String
fileTown
;
@ExcelProperty
(
"项目名称"
)
@Length
(
max
=
128
,
message
=
"项目名称不能超过128个字符"
)
@ExcelAttribute
(
name
=
"项目名称"
,
maxLength
=
128
)
@Schema
(
description
=
"项目名称"
,
name
=
"subjectDepart"
)
private
String
subjectDepart
;
@ExcelProperty
(
"项目编码"
)
@Schema
(
description
=
"项目编码"
)
private
String
deptNo
;
@ExcelAttribute
(
name
=
"员工类型"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMP_NATRUE
)
@ExcelProperty
(
"员工类型"
)
@ExcelAttribute
(
name
=
"员工类型"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMP_NATRUE
)
@Schema
(
description
=
"员工类型(字典值,0外包1派遣2代理)"
)
private
String
empNatrue
;
@ExcelProperty
(
"合同类型"
)
@NotBlank
(
message
=
"合同类型不能为空"
)
@Length
(
max
=
32
,
message
=
"合同类型不能超过32个字符"
)
@ExcelAttribute
(
name
=
"合同类型"
,
isNotEmpty
=
true
,
errorInfo
=
"合同类型不能为空"
,
maxLength
=
32
,
needExport
=
true
)
@Schema
(
description
=
"合同类型"
,
name
=
"contractName"
)
private
String
contractName
;
@ExcelProperty
(
"申请编号"
)
@NotBlank
(
message
=
"业务细分不能为空"
)
@Length
(
max
=
32
,
message
=
"业务细分不能超过32个字符"
)
@ExcelAttribute
(
name
=
"业务细分"
,
maxLength
=
32
,
needExport
=
true
)
@Schema
(
description
=
"业务细分"
,
name
=
"contractName"
)
private
String
contractSubName
;
@ExcelProperty
(
"签订类型"
)
@NotBlank
(
message
=
"签订类型不能为空"
)
@Length
(
max
=
1
,
message
=
"签订类型不能超过1个字符"
)
@ExcelAttribute
(
name
=
"签订类型"
,
isNotEmpty
=
true
,
errorInfo
=
"签订类型不能为空"
,
maxLength
=
100
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMPLOYEE_SITUATION_TYPE
)
...
...
@@ -121,34 +134,41 @@ public class EmployeeContractExportVO implements Serializable {
* 1 固定期限
* 2 无固定期限
*/
@ExcelProperty
(
"签订期限"
)
@NotBlank
(
message
=
"签订期限不能为空"
)
@Length
(
max
=
32
,
message
=
"签订期限不能超过32个字符"
)
@ExcelAttribute
(
name
=
"签订期限"
,
isNotEmpty
=
true
,
errorInfo
=
"签订期限不能为空"
,
maxLength
=
32
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMPLOYEE_CONTRACT_TYPE
,
needExport
=
true
)
@Schema
(
description
=
"签订期限"
,
name
=
"contractType"
)
private
String
contractType
;
@ExcelProperty
(
"合同甲方"
)
@ExcelAttribute
(
name
=
"合同甲方"
)
@Schema
(
description
=
"合同甲方"
)
@Size
(
max
=
50
,
message
=
"合同甲方不可超过50位"
)
private
String
contractParty
;
@ExcelProperty
(
"客户名称"
)
@Length
(
max
=
128
,
message
=
"客户名称不能超过128个字符"
)
@ExcelAttribute
(
name
=
"客户名称"
,
maxLength
=
128
)
@Schema
(
description
=
"客户名称"
,
name
=
"subjectUnit"
)
private
String
subjectUnit
;
@ExcelProperty
(
"审核状态"
)
@ExcelAttribute
(
name
=
"审核状态"
,
readConverterExp
=
"0=待提交,1=待审核,2=审核通过,3=审核不通过"
)
@Schema
(
description
=
"审核状态"
)
private
String
auditStatus
;
@ExcelProperty
(
"合同状态"
)
@ExcelAttribute
(
name
=
"合同状态"
,
readConverterExp
=
"0=可用,1=不可用"
)
@Schema
(
description
=
"合同状态"
,
name
=
"inUse"
)
private
String
inUse
;
@ExcelProperty
(
"附件状态"
)
@ExcelAttribute
(
name
=
"附件状态"
)
@Schema
(
description
=
"附件状态"
,
name
=
"isFile"
)
private
String
files
;
@ExcelProperty
(
"归档状态"
)
@ExcelAttribute
(
name
=
"归档状态"
,
readConverterExp
=
"0=已归档,1=未归档"
)
@Schema
(
description
=
"归档状态"
,
name
=
"isFile"
)
private
String
isFile
;
...
...
@@ -158,7 +178,7 @@ public class EmployeeContractExportVO implements Serializable {
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
private
String
createTime
;
@ExcelProperty
(
"累计签订次数"
)
private
String
createNum
;
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeContractInfoServiceImpl.java
View file @
004137bd
...
...
@@ -30,11 +30,13 @@ import com.yifu.cloud.plus.v1.yifu.archives.Constants.EmployeeContractConstants;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractUpdateVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
...
...
@@ -656,19 +658,8 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
excel
=
excelVOList
.
get
(
i
);
// 存储
insertExcel
(
excel
,
errorMessageList
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_SUCCESS
));
}
}
private
ErrorMessage
checkRes
(
EmployeeContractVO
excel
,
List
<
TEmployeeContractInfo
>
list
)
{
// 检查添加是否已经存在
boolean
match
=
list
.
stream
().
anyMatch
(
info
->
excel
.
getEmpIdcard
().
equals
(
info
.
getEmpIdcard
()));
if
(
match
)
{
return
new
ErrorMessage
(
excel
.
getRowIndex
(),
MsgUtils
.
getMessage
(
ErrorCodes
.
ARCHIVES_EMP_EDUCATION_EXISTING
));
this
.
insertExcel
(
excel
,
errorMessageList
);
}
return
null
;
}
/**
...
...
@@ -694,10 +685,8 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
insert
.
setSettleDomain
(
project
.
getDeptId
());
// 核心保存
R
<
List
<
ErrorMessage
>>
info
=
this
.
setBaseInfo
(
insert
);
if
(
info
.
getCode
()
!=
CommonConstants
.
SUCCESS
)
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
info
.
getMsg
()));
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"员工合同保存异常:"
+
e
.
getMessage
());
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_FAILED
));
...
...
@@ -725,7 +714,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel
.
write
(
out
,
EmployeeExportVO
.
class
).
includeColumnFiledNames
(
contractInfo
.
getExportFields
())
EasyExcel
.
write
(
out
,
Employee
Contract
ExportVO
.
class
).
includeColumnFiledNames
(
contractInfo
.
getExportFields
())
.
sheet
(
"员工合同"
).
doWrite
(
list
);
out
.
flush
();
}
catch
(
Exception
e
)
{
...
...
@@ -764,7 +753,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel
.
write
(
out
,
EmployeeExportVO
.
class
).
includeColumnFiledNames
(
contractInfo
.
getExportFields
())
EasyExcel
.
write
(
out
,
Employee
Contract
ExportVO
.
class
).
includeColumnFiledNames
(
contractInfo
.
getExportFields
())
.
sheet
(
"员工合同[合并]"
).
doWrite
(
list
);
out
.
flush
();
}
catch
(
Exception
e
)
{
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/util/ExcelUtil.java
View file @
004137bd
...
...
@@ -170,16 +170,17 @@ public class ExcelUtil <T> implements Serializable {
}
}
// 默认字典获取不到 去 缓存获取
if
(
Common
.
isEmpty
(
tempValue
)){
if
(
Common
.
isEmpty
(
tempValue
)
&&
Common
.
isNotNull
(
attr
.
dataType
())
){
Map
<
String
,
String
>
dicObj
=
(
Map
<
String
,
String
>)
RedisUtil
.
redis
.
opsForValue
().
get
(
attr
.
dataType
());
boolean
flag
=
true
;
for
(
Map
.
Entry
<
String
,
String
>
entry:
dicObj
.
entrySet
())
{
if
(
Common
.
isNotNull
(
entry
.
getKey
())
&&
entry
.
getKey
().
equals
(
value
.
trim
()))
{
if
(
dicObj
!=
null
)
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
dicObj
.
entrySet
())
{
if
(
Common
.
isNotNull
(
entry
.
getKey
())
&&
entry
.
getKey
().
equals
(
value
.
trim
()))
{
tempValue
=
entry
.
getValue
();
break
;
}
}
}
}
return
tempValue
;
}
/**
...
...
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