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
dc76bdc3
Commit
dc76bdc3
authored
Jul 01, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导入
parent
76335095
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
394 additions
and
53 deletions
+394
-53
TEmployeeContractInfo.java
...d/plus/v1/yifu/archives/entity/TEmployeeContractInfo.java
+13
-13
EmployeeContractVO.java
...fu/cloud/plus/v1/yifu/archives/vo/EmployeeContractVO.java
+176
-0
EmployeeVO.java
...a/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeVO.java
+1
-0
TEmployeeContractInfoController.java
.../archives/controller/TEmployeeContractInfoController.java
+18
-0
TEmployeeContractInfoService.java
...1/yifu/archives/service/TEmployeeContractInfoService.java
+4
-0
TEmployeeContractInfoServiceImpl.java
...chives/service/impl/TEmployeeContractInfoServiceImpl.java
+179
-40
TEmployeeInfoServiceImpl.java
.../yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
+3
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TEmployeeContractInfo.java
View file @
dc76bdc3
...
...
@@ -131,12 +131,12 @@ public class TEmployeeContractInfo extends BaseEntity {
@Schema
(
description
=
"客户名称"
,
name
=
"subjectUnit"
)
private
String
subjectUnit
;
/**
* 签订
情况
* 签订
类型
*/
@NotBlank
(
message
=
"签订
情况
不能为空"
)
@Length
(
max
=
1
,
message
=
"签订
情况
不能超过1个字符"
)
@ExcelAttribute
(
name
=
"签订
情况"
,
isNotEmpty
=
true
,
errorInfo
=
"签订情况
不能为空"
,
maxLength
=
100
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMPLOYEE_SITUATION_TYPE
)
@Schema
(
description
=
"签订
情况
"
,
name
=
"situation"
)
@NotBlank
(
message
=
"签订
类型
不能为空"
)
@Length
(
max
=
1
,
message
=
"签订
类型
不能超过1个字符"
)
@ExcelAttribute
(
name
=
"签订
类型"
,
isNotEmpty
=
true
,
errorInfo
=
"签订类型
不能为空"
,
maxLength
=
100
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMPLOYEE_SITUATION_TYPE
)
@Schema
(
description
=
"签订
类型(字典)
"
,
name
=
"situation"
)
private
String
situation
;
/**
* 合同年限
...
...
@@ -144,20 +144,20 @@ public class TEmployeeContractInfo extends BaseEntity {
@NotBlank
(
message
=
"合同年限不能为空"
)
@ExcelAttribute
(
name
=
"合同年限"
,
errorInfo
=
"合同年限不能为空"
)
@Schema
(
description
=
"合同年限"
,
name
=
"contractTerm"
)
private
Double
contractTerm
;
private
String
contractTerm
;
/**
* 合同编
号
* 合同编
码
*/
@NotBlank
(
message
=
"合同编
号
不能为空"
)
@Length
(
max
=
128
,
message
=
"合同编号不能超过128
个字符"
)
@ExcelAttribute
(
name
=
"合同编
号"
,
maxLength
=
128
)
@Schema
(
description
=
"合同编
号
"
,
name
=
"contractNo"
)
@NotBlank
(
message
=
"合同编
码
不能为空"
)
@Length
(
max
=
50
,
message
=
"合同编码不能超过50
个字符"
)
@ExcelAttribute
(
name
=
"合同编
码"
,
maxLength
=
50
)
@Schema
(
description
=
"合同编
码
"
,
name
=
"contractNo"
)
private
String
contractNo
;
/**
* 备注
*/
@Length
(
max
=
512
,
message
=
"不能超过512
个字符"
)
@ExcelAttribute
(
name
=
"备注"
,
maxLength
=
512
)
@Length
(
max
=
200
,
message
=
"不能超过200
个字符"
)
@ExcelAttribute
(
name
=
"备注"
,
maxLength
=
200
)
@Schema
(
description
=
"备注"
,
name
=
"remark"
)
private
String
remark
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeContractVO.java
0 → 100644
View file @
dc76bdc3
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
com.alibaba.excel.annotation.format.DateTimeFormat
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.Size
;
import
java.io.Serializable
;
import
java.time.LocalDate
;
/**
* 员工合同-批量操作的VO
*
* @author hgw
* @date 2022-7-1 17:40:40
*/
@Data
@Schema
(
description
=
"员工合同-批量操作的VO"
)
public
class
EmployeeContractVO
extends
RowIndex
implements
Serializable
{
/**
* 员工姓名
*/
@Length
(
max
=
20
,
message
=
"员工姓名不能超过20个字符"
)
@ExcelAttribute
(
name
=
"员工姓名"
,
isNotEmpty
=
true
,
maxLength
=
20
,
needExport
=
true
)
@Schema
(
description
=
"员工姓名"
,
name
=
"empName"
)
private
String
empName
;
/**
* 员工身份证号
*/
@Length
(
max
=
20
,
message
=
"身份证号不能超过20个字符"
)
@ExcelAttribute
(
name
=
"身份证号"
,
isNotEmpty
=
true
,
maxLength
=
20
,
isIdCard
=
true
,
needExport
=
true
)
@Schema
(
description
=
"身份证号"
,
name
=
"empIdcard"
)
private
String
empIdcard
;
/**
* 项目编码
*/
@Length
(
max
=
20
,
message
=
"项目编码不能超过20个字符"
)
@ExcelAttribute
(
name
=
"项目编码"
,
isNotEmpty
=
true
,
maxLength
=
20
,
needExport
=
true
)
@Schema
(
description
=
"项目编码"
)
private
String
deptNo
;
/**
* 签订类型(字典)
*/
@NotBlank
(
message
=
"签订类型不能为空"
)
@Length
(
max
=
20
,
message
=
"签订类型不能超过20个字符"
)
@ExcelAttribute
(
name
=
"签订类型"
,
isNotEmpty
=
true
,
errorInfo
=
"签订情况不能为空"
,
maxLength
=
20
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMPLOYEE_SITUATION_TYPE
)
@Schema
(
description
=
"签订类型(字典)"
,
name
=
"situation"
)
private
String
situation
;
/**
* 合同类型
*/
@NotBlank
(
message
=
"合同类型不能为空"
)
@Length
(
max
=
32
,
message
=
"合同类型不能超过32个字符"
)
@ExcelAttribute
(
name
=
"合同类型"
,
isNotEmpty
=
true
,
errorInfo
=
"合同类型不能为空"
,
maxLength
=
32
,
needExport
=
true
)
@Schema
(
description
=
"合同类型"
,
name
=
"contractName"
)
private
String
contractName
;
/**
* 业务细分
*/
@NotBlank
(
message
=
"业务细分不能为空"
)
@Length
(
max
=
32
,
message
=
"业务细分不能超过32个字符"
)
@ExcelAttribute
(
name
=
"业务细分"
,
maxLength
=
32
,
needExport
=
true
)
@Schema
(
description
=
"业务细分"
,
name
=
"contractName"
)
private
String
contractSubName
;
/**
* 原因说明
*/
@Length
(
max
=
200
,
message
=
"原因说明不能超过200个字符"
)
@ExcelAttribute
(
name
=
"原因说明"
,
maxLength
=
200
,
needExport
=
true
)
@Schema
(
description
=
"原因说明"
,
name
=
"reason"
)
private
String
reason
;
/**
* 合同甲方
*/
@Length
(
max
=
50
,
message
=
"原因说明不能超过200个字符"
)
@ExcelAttribute
(
name
=
"合同甲方"
,
maxLength
=
50
,
needExport
=
true
)
@Schema
(
description
=
"合同甲方"
)
@Size
(
max
=
50
,
message
=
"合同甲方不可超过50位"
)
private
String
contractParty
;
/**
* 签订期限employee_contract_type
* 0 已完成一定工作任务为期限
* 1 固定期限
* 2 无固定期限
*/
@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
;
/**
* 合同起始时间
*/
@NotBlank
(
message
=
"起始日期不能为空"
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
@ExcelAttribute
(
name
=
"起始日期"
,
isNotEmpty
=
true
,
errorInfo
=
"起始日期不能为空"
)
@Schema
(
description
=
"起始日期"
,
name
=
"contractStart"
)
private
LocalDate
contractStart
;
/**
* 合同到期时间
*/
@ExcelAttribute
(
name
=
"截止日期"
,
needExport
=
true
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
@Schema
(
description
=
"截止日期"
,
name
=
"contractEnd"
)
private
LocalDate
contractEnd
;
/**
* 合同岗位
*/
@Length
(
max
=
32
,
message
=
"合同岗位不能超过32个字符"
)
@ExcelAttribute
(
name
=
"合同岗位"
,
maxLength
=
32
,
needExport
=
true
)
@Schema
(
description
=
"合同岗位"
,
name
=
"post"
)
private
String
post
;
/**
* 工时制(数据字典) 1标准工时 2 综合工时 3不定时工时制
*/
@Length
(
max
=
32
,
message
=
"工时制不能超过32个字符"
)
@ExcelAttribute
(
name
=
"工时制"
,
maxLength
=
32
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
WORKING_HOURS
)
@Schema
(
description
=
"工时制(数据字典) 1标准工时 2 综合工时 3不定时工时制"
,
name
=
"workingHours"
)
private
String
workingHours
;
/**
* 合同编码
*/
@NotBlank
(
message
=
"合同编码不能为空"
)
@Length
(
max
=
50
,
message
=
"合同编码不能超过50个字符"
)
@ExcelAttribute
(
name
=
"合同编码"
,
maxLength
=
50
)
@Schema
(
description
=
"合同编码"
,
name
=
"contractNo"
)
private
String
contractNo
;
/**
* 档案柜号
*/
@Length
(
max
=
50
,
message
=
"档案柜号不能超过50个字符"
)
@ExcelAttribute
(
name
=
"档案柜号"
,
maxLength
=
50
)
@Schema
(
description
=
"档案柜号"
,
name
=
"fileCabinetNo"
)
private
String
fileCabinetNo
;
/**
* 备注
*/
@Length
(
max
=
200
,
message
=
"不能超过200个字符"
)
@ExcelAttribute
(
name
=
"备注"
,
maxLength
=
200
)
@Schema
(
description
=
"备注"
,
name
=
"remark"
)
private
String
remark
;
}
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeVO.java
View file @
dc76bdc3
...
...
@@ -21,6 +21,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
javax.validation.constraints.Max
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
java.io.Serializable
;
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeContractInfoController.java
View file @
dc76bdc3
...
...
@@ -34,9 +34,11 @@ import io.swagger.v3.oas.annotations.Operation;
import
io.swagger.v3.oas.annotations.security.SecurityRequirement
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.SneakyThrows
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
...
...
@@ -205,4 +207,20 @@ public class TEmployeeContractInfoController {
return
tEmployeeContractInfoService
.
filingContract
(
tEmployeeContractInfo
);
}
/**
* 批量申请-合同
* @param file
* @return
* @Author hgw
* @Date 2022-7-1 18:45:22
**/
@SneakyThrows
@Operation
(
description
=
"批量申请-合同 hasPermission('temployeecontractinfo_batch_import')"
)
@SysLog
(
"批量申请-合同"
)
@PostMapping
(
"/batchImport"
)
@PreAuthorize
(
"@pms.hasPermission('temployeecontractinfo_batch_import')"
)
public
R
<
List
<
ErrorMessage
>>
batchImport
(
@RequestBody
MultipartFile
file
)
{
return
tEmployeeContractInfoService
.
batchImport
(
file
.
getInputStream
());
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeContractInfoService.java
View file @
dc76bdc3
...
...
@@ -22,11 +22,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorMessageVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.validation.BindingResult
;
import
java.io.InputStream
;
import
java.util.List
;
/**
...
...
@@ -99,5 +102,6 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
**/
R
<
String
>
filingContract
(
TEmployeeContractInfo
tEmployeeContractInfo
);
R
<
List
<
ErrorMessage
>>
batchImport
(
InputStream
inputStream
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeContractInfoServiceImpl.java
View file @
dc76bdc3
...
...
@@ -16,7 +16,12 @@
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.read.listener.ReadListener
;
import
com.alibaba.excel.read.metadata.holder.ReadRowHolder
;
import
com.alibaba.excel.util.ListUtils
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -25,15 +30,17 @@ 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.E
rrorMessage
VO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.E
mployeeContract
VO
;
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
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.support.SimpleValueWrapper
;
...
...
@@ -41,11 +48,10 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.io.InputStream
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
/**
* 员工合同
...
...
@@ -53,6 +59,7 @@ import java.util.Set;
* @author hgw
* @date 2022-06-29 20:45:22
*/
@Log4j2
@Service
@RequiredArgsConstructor
public
class
TEmployeeContractInfoServiceImpl
extends
ServiceImpl
<
TEmployeeContractInfoMapper
,
TEmployeeContractInfo
>
implements
TEmployeeContractInfoService
{
...
...
@@ -88,6 +95,14 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
if
(
Common
.
isEmpty
(
tEmployeeContractInfo
.
getEmpId
())
||
Common
.
isEmpty
(
tEmployeeContractInfo
.
getSettleDomain
()))
{
return
R
.
failed
(
EMPID_NOT_EMPTY
);
}
return
this
.
setBaseInfo
(
tEmployeeContractInfo
);
}
catch
(
Exception
e
)
{
log
.
error
(
"员工合同保存异常:"
+
e
.
getMessage
());
return
R
.
failed
(
"员工合同保存系统异常!"
);
}
}
private
R
<
List
<
ErrorMessage
>>
setBaseInfo
(
TEmployeeContractInfo
tEmployeeContractInfo
)
{
// 获取人员档案
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getById
(
tEmployeeContractInfo
.
getEmpId
());
// 获取项目
...
...
@@ -123,10 +138,6 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
else
{
return
R
.
failed
();
}
}
catch
(
Exception
e
)
{
log
.
error
(
"员工合同保存异常:"
+
e
.
getMessage
());
return
R
.
failed
(
"员工合同保存系统异常!"
);
}
}
@Override
...
...
@@ -387,7 +398,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
for
(
int
i
=
0
;
i
<
idList
.
size
();
i
++)
{
errorVo
=
new
ErrorVO
();
errorVo
.
setResult
(
CommonConstants
.
ZERO_INT
);
errorVo
.
setLineNum
(
i
+
1
);
errorVo
.
setLineNum
(
i
+
1
);
id
=
idList
.
get
(
i
);
contractInfo
=
this
.
getById
(
id
);
if
(
contractInfo
==
null
)
{
...
...
@@ -433,4 +444,132 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
return
R
.
failed
(
"参数不可为空"
);
}
@Override
public
R
<
List
<
ErrorMessage
>>
batchImport
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmployeeContractVO
>
util1
=
new
ExcelUtil
<>(
EmployeeContractVO
.
class
);
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
EmployeeContractVO
.
class
,
new
ReadListener
<
EmployeeContractVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmployeeContractVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmployeeContractVO
data
,
AnalysisContext
context
)
{
ReadRowHolder
readRowHolder
=
context
.
readRowHolder
();
Integer
rowIndex
=
readRowHolder
.
getRowIndex
();
data
.
setRowIndex
(
rowIndex
+
1
);
ErrorMessage
errorMessage
=
util1
.
checkEntity
(
data
,
data
.
getRowIndex
());
if
(
Common
.
isNotNull
(
errorMessage
))
{
errorMessageList
.
add
(
errorMessage
);
}
else
{
cachedDataList
.
add
(
data
);
}
if
(
cachedDataList
.
size
()
>=
BATCH_COUNT
)
{
saveData
();
// 存储完成清理 list
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
}
}
@Override
public
void
doAfterAllAnalysed
(
AnalysisContext
context
)
{
saveData
();
}
/**
* 加上存储数据库
*/
private
void
saveData
()
{
log
.
info
(
"{}条数据,开始存储数据库!"
,
cachedDataList
.
size
());
importContract
(
cachedDataList
,
errorMessageList
);
log
.
info
(
"存储数据库成功!"
);
}
}).
sheet
().
doRead
();
}
catch
(
Exception
e
)
{
log
.
error
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
,
e
);
return
R
.
failed
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
);
}
return
R
.
ok
(
errorMessageList
);
}
/**
* @Author hgw
* @Description 批量导入
* @Date 2022-7-1 18:48:01
**/
@Transactional
public
void
importContract
(
List
<
EmployeeContractVO
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
/// 个性化校验逻辑
List
<
TEmployeeContractInfo
>
list
=
this
.
list
();
ErrorMessage
errorMsg
;
EmployeeContractVO
excel
;
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
excel
=
excelVOList
.
get
(
i
);
errorMsg
=
checkRes
(
excel
,
list
);
if
(
Common
.
isNotNull
(
errorMsg
))
{
errorMessageList
.
add
(
errorMsg
);
continue
;
}
// 存储
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
));
}
return
null
;
}
/**
* 插入excel education
*/
private
void
insertExcel
(
EmployeeContractVO
excel
,
List
<
ErrorMessage
>
errorMessageList
)
{
TEmployeeContractInfo
insert
=
new
TEmployeeContractInfo
();
BeanUtil
.
copyProperties
(
excel
,
insert
);
try
{
if
(
Common
.
isEmpty
(
insert
.
getEmpIdcard
())
||
Common
.
isEmpty
(
insert
.
getDeptNo
()))
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
EMPID_NOT_EMPTY
));
}
TEmployeeProject
project
=
tEmployeeProjectService
.
getOne
(
Wrappers
.<
TEmployeeProject
>
query
().
lambda
()
.
eq
(
TEmployeeProject:
:
getEmpIdcard
,
insert
.
getEmpIdcard
())
.
eq
(
TEmployeeProject:
:
getDeptNo
,
insert
.
getDeptNo
())
.
eq
(
TEmployeeProject:
:
getDeleteFlag
,
CommonConstants
.
STATUS_NORMAL
)
.
eq
(
TEmployeeProject:
:
getProjectStatus
,
CommonConstants
.
ZERO_INT
).
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
project
==
null
)
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
EMPINFO_IS_NOT_EXITS_BYID
));
}
else
{
insert
.
setEmpId
(
project
.
getEmpId
());
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
));
}
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
View file @
dc76bdc3
...
...
@@ -1228,6 +1228,9 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if
(
Common
.
isNotNull
(
excel
.
getEmpName
()))
{
saveEmp
.
setEmpName
(
excel
.
getEmpName
());
}
if
(
Common
.
isNotNull
(
excel
.
getEmpPhone
()))
{
saveEmp
.
setEmpPhone
(
excel
.
getEmpPhone
());
}
// 校验手机号
existEmp
=
existPhoneMap
.
get
(
excel
.
getEmpPhone
());
...
...
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