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
5668f0a8
Commit
5668f0a8
authored
Jul 03, 2022
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huyc 项目档案代码提交
parent
bdf116c8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
186 additions
and
104 deletions
+186
-104
EmployeeProjectExportVO.java
...oud/plus/v1/yifu/archives/vo/EmployeeProjectExportVO.java
+28
-3
EmployeeProjectVO.java
...ifu/cloud/plus/v1/yifu/archives/vo/EmployeeProjectVO.java
+6
-4
TEmployeeProjectController.java
.../yifu/archives/controller/TEmployeeProjectController.java
+10
-5
TEmployeeProjectService.java
...lus/v1/yifu/archives/service/TEmployeeProjectService.java
+5
-5
TEmployeeProjectServiceImpl.java
...fu/archives/service/impl/TEmployeeProjectServiceImpl.java
+137
-87
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeProjectExportVO.java
View file @
5668f0a8
...
@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo;
...
@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants
;
import
lombok.Data
;
import
lombok.Data
;
import
javax.validation.constraints.Past
;
import
javax.validation.constraints.Past
;
...
@@ -42,7 +43,7 @@ public class EmployeeProjectExportVO{
...
@@ -42,7 +43,7 @@ public class EmployeeProjectExportVO{
* 档案员工类型(字典值,0外包1派遣2代理)
* 档案员工类型(字典值,0外包1派遣2代理)
*/
*/
@ExcelProperty
(
value
=
"档案员工类型"
)
@ExcelProperty
(
value
=
"档案员工类型"
)
@ExcelAttribute
(
name
=
"档案员工类型"
,
is
NotEmpty
=
true
,
errorInfo
=
"档案员工类型不可为空"
,
isDataId
=
true
,
dataType
=
"emp_natrue"
)
@ExcelAttribute
(
name
=
"档案员工类型"
,
is
DataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMP_NATRUE
)
private
String
proEmpNatrue
;
private
String
proEmpNatrue
;
/**
/**
...
@@ -79,18 +80,21 @@ public class EmployeeProjectExportVO{
...
@@ -79,18 +80,21 @@ public class EmployeeProjectExportVO{
* 婚姻状况
* 婚姻状况
*/
*/
@ExcelProperty
(
value
=
"婚姻状况"
)
@ExcelProperty
(
value
=
"婚姻状况"
)
@ExcelAttribute
(
name
=
"婚姻状况"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMP_MARRIED
)
private
String
empMarriStatus
;
private
String
empMarriStatus
;
/**
/**
* 民族
* 民族
*/
*/
@ExcelProperty
(
value
=
"民族"
)
@ExcelProperty
(
value
=
"民族"
)
@ExcelAttribute
(
name
=
"民族"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMP_NATIONAL
)
private
String
empNational
;
private
String
empNational
;
/**
/**
* 政治面貌
* 政治面貌
*/
*/
@ExcelProperty
(
value
=
"政治面貌"
)
@ExcelProperty
(
value
=
"政治面貌"
)
@ExcelAttribute
(
name
=
"政治面貌"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMP_POLITICAL
)
private
String
politicalStatus
;
private
String
politicalStatus
;
/**
/**
...
@@ -108,6 +112,7 @@ public class EmployeeProjectExportVO{
...
@@ -108,6 +112,7 @@ public class EmployeeProjectExportVO{
/**
/**
* 身份证-省
* 身份证-省
*/
*/
@ExcelAttribute
(
name
=
"户籍所在省"
,
isArea
=
true
)
@ExcelProperty
(
value
=
"户籍所在省"
)
@ExcelProperty
(
value
=
"户籍所在省"
)
private
String
idProvince
;
private
String
idProvince
;
...
@@ -115,48 +120,56 @@ public class EmployeeProjectExportVO{
...
@@ -115,48 +120,56 @@ public class EmployeeProjectExportVO{
* 身份证-市
* 身份证-市
*/
*/
@ExcelProperty
(
value
=
"户籍所在市"
)
@ExcelProperty
(
value
=
"户籍所在市"
)
@ExcelAttribute
(
name
=
"户籍所在市"
,
isArea
=
true
,
parentField
=
"idProvince"
)
private
String
idCity
;
private
String
idCity
;
/**
/**
* 身份证-县
* 身份证-县
*/
*/
@ExcelProperty
(
value
=
"户籍所在县"
)
@ExcelProperty
(
value
=
"户籍所在县"
)
@ExcelAttribute
(
name
=
"户籍所在县"
,
isArea
=
true
,
parentField
=
"idCity"
)
private
String
idTown
;
private
String
idTown
;
/**
/**
* 户口性质
* 户口性质
*/
*/
@ExcelProperty
(
value
=
"户口性质"
)
@ExcelProperty
(
value
=
"户口性质"
)
@ExcelAttribute
(
name
=
"户口性质"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMP_REGISTYPE
)
private
String
empRegisType
;
private
String
empRegisType
;
/**
/**
* 档案-省
* 档案-省
*/
*/
@ExcelProperty
(
value
=
"档案所在省"
)
@ExcelProperty
(
value
=
"档案所在省"
)
@ExcelAttribute
(
name
=
"档案所在省"
,
isArea
=
true
)
private
String
fileProvince
;
private
String
fileProvince
;
/**
/**
* 档案-市
* 档案-市
*/
*/
@ExcelProperty
(
value
=
"档案所在市"
)
@ExcelProperty
(
value
=
"档案所在市"
)
@ExcelAttribute
(
name
=
"档案所在市"
,
isArea
=
true
,
parentField
=
"fileProvince"
)
private
String
fileCity
;
private
String
fileCity
;
/**
/**
* 档案-县
* 档案-县
*/
*/
@ExcelProperty
(
value
=
"档案所在县"
)
@ExcelProperty
(
value
=
"档案所在县"
)
@ExcelAttribute
(
name
=
"档案所在县"
,
isArea
=
true
,
parentField
=
"fileCity"
)
private
String
fileTown
;
private
String
fileTown
;
/**
/**
* 是否大专及以上(0否1是)
* 是否大专及以上(0否1是)
*/
*/
@ExcelProperty
(
value
=
"是否大专及以上"
)
@ExcelProperty
(
value
=
"是否大专及以上"
)
@ExcelAttribute
(
name
=
"是否大专及以上"
,
readConverterExp
=
"0=否,1=是"
)
private
String
isCollege
;
private
String
isCollege
;
/**
/**
* 最高学历(字典值)
* 最高学历(字典值)
*/
*/
@ExcelProperty
(
value
=
"最高学历"
)
@ExcelProperty
(
value
=
"最高学历"
)
@ExcelAttribute
(
name
=
"最高学历"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EDUCATION
)
private
String
hignEducation
;
private
String
hignEducation
;
/**
/**
...
@@ -175,13 +188,13 @@ public class EmployeeProjectExportVO{
...
@@ -175,13 +188,13 @@ public class EmployeeProjectExportVO{
* 入学时间
* 入学时间
*/
*/
@ExcelProperty
(
value
=
"入学时间"
)
@ExcelProperty
(
value
=
"入学时间"
)
private
LocalDate
admissionDate
;
private
LocalDate
Time
admissionDate
;
/**
/**
* 毕业时间
* 毕业时间
*/
*/
@ExcelProperty
(
value
=
"毕业时间"
)
@ExcelProperty
(
value
=
"毕业时间"
)
private
LocalDate
gradutionDate
;
private
LocalDate
Time
gradutionDate
;
/**
/**
* 备注
* 备注
...
@@ -193,18 +206,21 @@ public class EmployeeProjectExportVO{
...
@@ -193,18 +206,21 @@ public class EmployeeProjectExportVO{
* 人员档案来源(字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)
* 人员档案来源(字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)
*/
*/
@ExcelProperty
(
value
=
"人员档案来源"
)
@ExcelProperty
(
value
=
"人员档案来源"
)
@ExcelAttribute
(
name
=
"人员档案来源"
,
readConverterExp
=
"1=社保公积金,2=薪酬,3=商险,4=人员档案新建"
)
private
String
fileSource
;
private
String
fileSource
;
/**
/**
* 人员档案状态(0草稿、1已审核)
* 人员档案状态(0草稿、1已审核)
*/
*/
@ExcelProperty
(
value
=
"人员档案状态"
)
@ExcelProperty
(
value
=
"人员档案状态"
)
@ExcelAttribute
(
name
=
"人员档案状态"
,
readConverterExp
=
"0=草稿,1=已审核"
)
private
Integer
proStatus
;
private
Integer
proStatus
;
/**
/**
* 档案状态(0正常;1已减档)
* 档案状态(0正常;1已减档)
*/
*/
@ExcelProperty
(
value
=
"档案状态"
)
@ExcelProperty
(
value
=
"档案状态"
)
@ExcelAttribute
(
name
=
"人员档案状态"
,
readConverterExp
=
"0=正常,1=已减档"
)
private
Integer
fileStatus
;
private
Integer
fileStatus
;
/**
/**
...
@@ -248,12 +264,14 @@ public class EmployeeProjectExportVO{
...
@@ -248,12 +264,14 @@ public class EmployeeProjectExportVO{
* 合同类型(字典值)
* 合同类型(字典值)
*/
*/
@ExcelProperty
(
value
=
"合同类型"
)
@ExcelProperty
(
value
=
"合同类型"
)
@ExcelAttribute
(
name
=
"合同类型"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMPLOYEE_CONTRACT_TYPE
)
private
String
contractType
;
private
String
contractType
;
/**
/**
* 工时制
* 工时制
*/
*/
@ExcelProperty
(
value
=
"工时制"
)
@ExcelProperty
(
value
=
"工时制"
)
@ExcelAttribute
(
name
=
"工时制"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
WORKING_HOURS
)
private
String
workingHours
;
private
String
workingHours
;
/**
/**
...
@@ -279,6 +297,7 @@ public class EmployeeProjectExportVO{
...
@@ -279,6 +297,7 @@ public class EmployeeProjectExportVO{
* 项目员工类型
* 项目员工类型
*/
*/
@ExcelProperty
(
value
=
"项目员工类型"
)
@ExcelProperty
(
value
=
"项目员工类型"
)
@ExcelAttribute
(
name
=
"项目员工类型"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
PERSONNEL_STATE
)
private
String
empNatrue
;
private
String
empNatrue
;
/**
/**
...
@@ -309,6 +328,7 @@ public class EmployeeProjectExportVO{
...
@@ -309,6 +328,7 @@ public class EmployeeProjectExportVO{
* 员工合同状态(字典)
* 员工合同状态(字典)
*/
*/
@ExcelProperty
(
value
=
"合同状态"
)
@ExcelProperty
(
value
=
"合同状态"
)
@ExcelAttribute
(
name
=
"合同状态"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
PERSONNEL_STATE
)
private
Integer
contractStatus
;
private
Integer
contractStatus
;
/**
/**
...
@@ -333,30 +353,35 @@ public class EmployeeProjectExportVO{
...
@@ -333,30 +353,35 @@ public class EmployeeProjectExportVO{
* 商险状态(字典)
* 商险状态(字典)
*/
*/
@ExcelProperty
(
value
=
"商险状态"
)
@ExcelProperty
(
value
=
"商险状态"
)
@ExcelAttribute
(
name
=
"商险状态"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
COMMERCIAL_SATTE
)
private
Integer
insuranceStatus
;
private
Integer
insuranceStatus
;
/**
/**
* 社保状态(字典)
* 社保状态(字典)
*/
*/
@ExcelProperty
(
value
=
"社保状态"
)
@ExcelProperty
(
value
=
"社保状态"
)
@ExcelAttribute
(
name
=
"社保状态"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
SOCIAL_ECURITY_STATE
)
private
Integer
socialStatus
;
private
Integer
socialStatus
;
/**
/**
* 公积金状态(字典)
* 公积金状态(字典)
*/
*/
@ExcelProperty
(
value
=
"公积金状态"
)
@ExcelProperty
(
value
=
"公积金状态"
)
@ExcelAttribute
(
name
=
"公积金状态"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
FUND_STATUS
)
private
Integer
fundStatus
;
private
Integer
fundStatus
;
/**
/**
* 近3个月发薪(0否;1是)
* 近3个月发薪(0否;1是)
*/
*/
@ExcelProperty
(
value
=
"近3个月发薪"
)
@ExcelProperty
(
value
=
"近3个月发薪"
)
@ExcelAttribute
(
name
=
"近3个月发薪"
,
readConverterExp
=
"0=无,1=是,2=否"
)
private
Integer
salaryStatus
;
private
Integer
salaryStatus
;
/**
/**
* 项目档案来源(字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)
* 项目档案来源(字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)
*/
*/
@ExcelProperty
(
value
=
"项目档案来源"
)
@ExcelProperty
(
value
=
"项目档案来源"
)
@ExcelAttribute
(
name
=
"项目档案来源"
,
readConverterExp
=
"1=社保/公积金,2=薪酬,3=商险,4=人员档案新建,5=项目档案新建"
)
private
String
projectSource
;
private
String
projectSource
;
/**
/**
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeProjectVO.java
View file @
5668f0a8
...
@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo;
...
@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants
;
import
lombok.Data
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
...
@@ -34,7 +35,7 @@ import java.time.LocalDate;
...
@@ -34,7 +35,7 @@ import java.time.LocalDate;
*/
*/
@Data
@Data
@ColumnWidth
(
30
)
@ColumnWidth
(
30
)
public
class
EmployeeProjectVO
implements
Serializable
{
public
class
EmployeeProjectVO
extends
RowIndex
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -42,7 +43,7 @@ public class EmployeeProjectVO implements Serializable {
...
@@ -42,7 +43,7 @@ public class EmployeeProjectVO implements Serializable {
* 员工类型(字典值,0外包1派遣2代理)
* 员工类型(字典值,0外包1派遣2代理)
*/
*/
@NotNull
(
message
=
"员工类型不能为空"
)
@NotNull
(
message
=
"员工类型不能为空"
)
@ExcelAttribute
(
name
=
"员工类型"
,
isNotEmpty
=
true
,
errorInfo
=
"员工类型不能为空"
,
maxLength
=
1
)
@ExcelAttribute
(
name
=
"员工类型"
,
isNotEmpty
=
true
,
errorInfo
=
"员工类型不能为空"
,
maxLength
=
1
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMP_NATRUE
)
@ExcelProperty
(
value
=
"员工类型"
)
@ExcelProperty
(
value
=
"员工类型"
)
private
String
empNatrue
;
private
String
empNatrue
;
...
@@ -93,7 +94,7 @@ public class EmployeeProjectVO implements Serializable {
...
@@ -93,7 +94,7 @@ public class EmployeeProjectVO implements Serializable {
*/
*/
@NotNull
(
message
=
"合同类型不能为空"
)
@NotNull
(
message
=
"合同类型不能为空"
)
@ExcelProperty
(
value
=
"合同类型"
)
@ExcelProperty
(
value
=
"合同类型"
)
@ExcelAttribute
(
name
=
"合同类型"
,
isNotEmpty
=
true
,
errorInfo
=
"
项目编码不能为空"
,
maxLength
=
2
)
@ExcelAttribute
(
name
=
"合同类型"
,
isNotEmpty
=
true
,
errorInfo
=
"
合同类型不能为空"
,
maxLength
=
2
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
EMPLOYEE_CONTRACT_TYPE
)
private
String
contractType
;
private
String
contractType
;
/**
/**
...
@@ -101,7 +102,7 @@ public class EmployeeProjectVO implements Serializable {
...
@@ -101,7 +102,7 @@ public class EmployeeProjectVO implements Serializable {
*/
*/
@NotNull
(
message
=
"工时制不能为空"
)
@NotNull
(
message
=
"工时制不能为空"
)
@ExcelProperty
(
value
=
"工时制"
)
@ExcelProperty
(
value
=
"工时制"
)
@ExcelAttribute
(
name
=
"工时制"
,
isNotEmpty
=
true
,
errorInfo
=
"工时制不能为空"
,
maxLength
=
1
)
@ExcelAttribute
(
name
=
"工时制"
,
isNotEmpty
=
true
,
errorInfo
=
"工时制不能为空"
,
maxLength
=
1
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
WORKING_HOURS
)
private
String
workingHours
;
private
String
workingHours
;
/**
/**
...
@@ -125,6 +126,7 @@ public class EmployeeProjectVO implements Serializable {
...
@@ -125,6 +126,7 @@ public class EmployeeProjectVO implements Serializable {
*/
*/
@ExcelProperty
(
value
=
"试用期"
)
@ExcelProperty
(
value
=
"试用期"
)
@NotNull
(
message
=
"试用期不能为空"
)
@NotNull
(
message
=
"试用期不能为空"
)
@ExcelAttribute
(
name
=
"试用期"
,
isNotEmpty
=
true
,
errorInfo
=
"试用期不能为空"
,
maxLength
=
2
)
private
String
tryPeriod
;
private
String
tryPeriod
;
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeProjectController.java
View file @
5668f0a8
...
@@ -21,23 +21,26 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -21,23 +21,26 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.pig4cloud.plugin.excel.annotation.RequestExcel
;
import
com.pig4cloud.plugin.excel.annotation.RequestExcel
;
import
com.pig4cloud.plugin.excel.vo.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.SneakyThrows
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -198,12 +201,13 @@ public class TEmployeeProjectController {
...
@@ -198,12 +201,13 @@ public class TEmployeeProjectController {
* @Author huyc
* @Author huyc
* @Date 2022-06-20
* @Date 2022-06-20
**/
**/
@SneakyThrows
@Operation
(
description
=
"批量新增项目档案信息 hasPermission('wxhr:employeeProjectinfo_importListAdd')"
)
@Operation
(
description
=
"批量新增项目档案信息 hasPermission('wxhr:employeeProjectinfo_importListAdd')"
)
@SysLog
(
"批量新增项目档案信息"
)
@SysLog
(
"批量新增项目档案信息"
)
@PostMapping
(
"/importListAdd"
)
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('wxhr:employeeProjectinfo_importListAdd')"
)
@PreAuthorize
(
"@pms.hasPermission('wxhr:employeeProjectinfo_importListAdd')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@Request
Excel
List
<
EmployeeProjectVO
>
excelVOList
,
BindingResult
bindingResult
,
@RequestParam
(
"idAdd"
)
String
idAdd
)
{
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@Request
Body
MultipartFile
file
,
@RequestParam
(
"idAdd"
)
String
idAdd
)
throws
IOException
{
return
tEmployeeProjectService
.
importListAdd
(
excelVOList
,
bindingResult
,
idAdd
);
return
tEmployeeProjectService
.
importListAdd
(
file
.
getInputStream
()
,
idAdd
);
}
}
/**
/**
...
@@ -214,12 +218,13 @@ public class TEmployeeProjectController {
...
@@ -214,12 +218,13 @@ public class TEmployeeProjectController {
* @Author huyc
* @Author huyc
* @Date 2022-06-21
* @Date 2022-06-21
**/
**/
@SneakyThrows
@Operation
(
description
=
"批量更新项目档案信息 hasPermission('archives_project_importListUpdate')"
)
@Operation
(
description
=
"批量更新项目档案信息 hasPermission('archives_project_importListUpdate')"
)
@SysLog
(
"批量更新项目档案信息"
)
@SysLog
(
"批量更新项目档案信息"
)
@PostMapping
(
"/importListUpate"
)
@PostMapping
(
"/importListUpate"
)
@PreAuthorize
(
"@pms.hasPermission('archives_project_importListUpdate')"
)
@PreAuthorize
(
"@pms.hasPermission('archives_project_importListUpdate')"
)
public
R
<
List
<
ErrorMessage
>>
importListUpate
(
@Request
Excel
List
<
EmployeeProjectVO
>
excelVOList
,
BindingResult
bindingResult
)
{
public
R
<
List
<
ErrorMessage
>>
importListUpate
(
@Request
Body
MultipartFile
file
)
{
return
tEmployeeProjectService
.
importEmpProjectUpdate
(
excelVOList
,
bindingResult
);
return
tEmployeeProjectService
.
importEmpProjectUpdate
(
file
.
getInputStream
()
);
}
}
/**
/**
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeProjectService.java
View file @
5668f0a8
...
@@ -21,15 +21,16 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -21,15 +21,16 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.pig4cloud.plugin.excel.vo.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.BindingResult
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.InputStream
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -66,15 +67,14 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
...
@@ -66,15 +67,14 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
R
<
List
<
ErrorMessage
>>
batchDeleteEmpPro
(
List
<
EmployeeProjectVO
>
list
,
BindingResult
bindingResult
);
R
<
List
<
ErrorMessage
>>
batchDeleteEmpPro
(
List
<
EmployeeProjectVO
>
list
,
BindingResult
bindingResult
);
/**
/**
* @param excelVOList
* @param inputStream
* @param bindingResult
* @param isAdd
* @param isAdd
* @Description: 批量新增项目档案
* @Description: 批量新增项目档案
* @Author: huyc
* @Author: huyc
* @Date: 2022/6/21 10:30
* @Date: 2022/6/21 10:30
* @return: R
* @return: R
**/
**/
R
<
List
<
ErrorMessage
>>
importListAdd
(
List
<
EmployeeProjectVO
>
excelVOList
,
BindingResult
bindingResult
,
String
isAdd
);
R
<
List
<
ErrorMessage
>>
importListAdd
(
InputStream
inputStream
,
String
isAdd
);
/**
/**
* @param projectStatus 传0才过滤
* @param projectStatus 传0才过滤
...
@@ -104,7 +104,7 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
...
@@ -104,7 +104,7 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
* @Date: 2022/6/21 10:30
* @Date: 2022/6/21 10:30
* @return: R
* @return: R
**/
**/
R
<
List
<
ErrorMessage
>>
importEmpProjectUpdate
(
List
<
EmployeeProjectVO
>
excelVOList
,
BindingResult
bindingResult
);
R
<
List
<
ErrorMessage
>>
importEmpProjectUpdate
(
InputStream
inputStream
);
/**
/**
* @param ids
* @param ids
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeProjectServiceImpl.java
View file @
5668f0a8
...
@@ -19,13 +19,15 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
...
@@ -19,13 +19,15 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
com.alibaba.excel.EasyExcel
;
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.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.pig4cloud.plugin.excel.vo.ErrorMessage
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckIdCard
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject
;
...
@@ -40,24 +42,25 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
...
@@ -40,24 +42,25 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
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.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
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.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCheckProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCheckProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.support.SimpleValueWrapper
;
import
org.springframework.cache.support.SimpleValueWrapper
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.BindingResult
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.*
;
...
@@ -72,6 +75,7 @@ import java.util.stream.Collectors;
...
@@ -72,6 +75,7 @@ import java.util.stream.Collectors;
@Service
@Service
@RequiredArgsConstructor
@RequiredArgsConstructor
@EnableConfigurationProperties
(
DaprCheckProperties
.
class
)
@EnableConfigurationProperties
(
DaprCheckProperties
.
class
)
@Log4j2
public
class
TEmployeeProjectServiceImpl
extends
ServiceImpl
<
TEmployeeProjectMapper
,
TEmployeeProject
>
implements
TEmployeeProjectService
{
public
class
TEmployeeProjectServiceImpl
extends
ServiceImpl
<
TEmployeeProjectMapper
,
TEmployeeProject
>
implements
TEmployeeProjectService
{
private
final
TEmployeeLogService
tEmployeeLogService
;
private
final
TEmployeeLogService
tEmployeeLogService
;
...
@@ -224,21 +228,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
...
@@ -224,21 +228,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
public
R
<
List
<
ErrorMessage
>>
batchDeleteEmpPro
(
List
<
EmployeeProjectVO
>
excelVOList
,
BindingResult
bindingResult
)
{
public
R
<
List
<
ErrorMessage
>>
batchDeleteEmpPro
(
List
<
EmployeeProjectVO
>
excelVOList
,
BindingResult
bindingResult
)
{
// 通用校验获取失败的数据
// 通用校验获取失败的数据
List
<
ErrorMessage
>
errorMessageList
=
(
List
<
ErrorMessage
>)
bindingResult
.
getTarget
();
List
<
ErrorMessage
>
errorMessageList
=
(
List
<
ErrorMessage
>)
bindingResult
.
getTarget
();
Map
<
Long
,
ErrorMessage
>
errorMsgMap
=
new
HashMap
<>();
if
(
Common
.
isNotNull
(
errorMessageList
)){
errorMessageList
.
stream
().
forEach
(
errorMessage
->
errorMsgMap
.
put
(
errorMessage
.
getLineNum
(),
errorMessage
));
}
// 执行数据插入操作 组装 PostDto
// 执行数据插入操作 组装 PostDto
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
EmployeeProjectVO
excel
=
excelVOList
.
get
(
i
);
EmployeeProjectVO
excel
=
excelVOList
.
get
(
i
);
Set
<
String
>
errorMsg
=
new
HashSet
<>();
// 已有验证报错直接下一个
if
(
Common
.
isNotNull
(
errorMsgMap
.
get
(
i
+
2
)))
{
continue
;
}
//根据身份证和项目编码获取项目档案
//根据身份证和项目编码获取项目档案
TEmployeeProject
tEmployeeProject
=
this
.
getOne
(
Wrappers
.<
TEmployeeProject
>
query
().
lambda
()
TEmployeeProject
tEmployeeProject
=
this
.
getOne
(
Wrappers
.<
TEmployeeProject
>
query
().
lambda
()
.
eq
(
TEmployeeProject:
:
getEmpIdcard
,
excel
.
getEmpIdcard
())
.
eq
(
TEmployeeProject:
:
getEmpIdcard
,
excel
.
getEmpIdcard
())
...
@@ -254,7 +247,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
...
@@ -254,7 +247,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.
eq
(
TEmployeeProject:
:
getEmpId
,
tEmployeeProject
.
getEmpId
())
.
eq
(
TEmployeeProject:
:
getEmpId
,
tEmployeeProject
.
getEmpId
())
.
eq
(
TEmployeeProject:
:
getProjectStatus
,
CommonConstants
.
dingleDigitIntArray
[
0
]));
.
eq
(
TEmployeeProject:
:
getProjectStatus
,
CommonConstants
.
dingleDigitIntArray
[
0
]));
if
(
count
.
compareTo
(
CommonConstants
.
DEPT_TREE_ROOT_ID
)
>
0
)
{
if
(
count
.
compareTo
(
CommonConstants
.
DEPT_TREE_ROOT_ID
)
>
0
)
{
errorM
sg
.
add
(
MsgUtils
.
getMessage
(
ErrorCodes
.
ARCHIVES_PROJECT_CHANGE_NOT_EXIST
));
errorM
essageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
MsgUtils
.
getMessage
(
ErrorCodes
.
ARCHIVES_PROJECT_CHANGE_NOT_EXIST
)
));
}
}
tEmployeeInfo
.
setFileStatus
(
CommonConstants
.
dingleDigitIntArray
[
1
]);
tEmployeeInfo
.
setFileStatus
(
CommonConstants
.
dingleDigitIntArray
[
1
]);
tEmployeeInfoMapper
.
updateById
(
tEmployeeInfo
);
tEmployeeInfoMapper
.
updateById
(
tEmployeeInfo
);
...
@@ -264,33 +257,82 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
...
@@ -264,33 +257,82 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
0
],
tEmployeeInfo
.
getId
(),
""
,
tEmployeeProjectOld
,
tEmployeeInfo
);
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
0
],
tEmployeeInfo
.
getId
(),
""
,
tEmployeeProjectOld
,
tEmployeeInfo
);
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
1
],
""
,
tEmployeeProject
.
getId
(),
tEmployeeInfoOld
,
tEmployeeProject
);
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
1
],
""
,
tEmployeeProject
.
getId
(),
tEmployeeInfoOld
,
tEmployeeProject
);
}
}
if
(!
CollUtil
.
isEmpty
(
errorMsg
))
{
errorMessageList
.
add
(
new
ErrorMessage
((
long
)
(
i
+
2
),
errorMsg
));
}
}
}
if
(
errorMessageList
.
size
()>
CommonConstants
.
ZERO_INT
)
{
if
(
CollUtil
.
isNotEmpty
(
errorMessageList
))
{
return
R
.
failed
(
errorMessageList
);
return
R
.
failed
(
errorMessageList
);
}
}
return
R
.
ok
();
return
R
.
ok
();
}
}
@Override
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
InputStream
inputStream
,
String
isAdd
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmployeeProjectVO
>
util1
=
new
ExcelUtil
<>(
EmployeeProjectVO
.
class
);
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
EmployeeProjectVO
.
class
,
new
ReadListener
<
EmployeeProjectVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmployeeProjectVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmployeeProjectVO
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
());
importListAdd
(
cachedDataList
,
errorMessageList
,
isAdd
);
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
);
}
/**
/**
* 新增档案操作记录
* 新增档案操作记录
* @param excelVOList
* @param excelVOList
* @param
bindingResul
t
* @param
errorMessageLis
t
* @param
* @param
* @author huyc
* @author huyc
* @date 2022-06-20 18:52:16
* @date 2022-06-20 18:52:16
*/
*/
@
Override
@
Transactional
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
List
<
EmployeeProjectVO
>
excelVOList
,
BindingResult
bindingResul
t
,
String
idAdd
)
{
public
void
importListAdd
(
List
<
EmployeeProjectVO
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageLis
t
,
String
idAdd
)
{
// 通用校验获取失败的数据
// 通用校验获取失败的数据
List
<
ErrorMessage
>
errorMessageList
=
(
List
<
ErrorMessage
>)
bindingResult
.
getTarget
();
Map
<
Long
,
ErrorMessage
>
errorMsgMap
=
new
HashMap
<>();
if
(
Common
.
isNotNull
(
errorMessageList
)){
errorMessageList
.
stream
().
forEach
(
errorMessage
->
errorMsgMap
.
put
(
errorMessage
.
getLineNum
(),
errorMessage
));
}
List
<
TEmployeeInfo
>
updateList
=
new
ArrayList
();
List
<
TEmployeeInfo
>
updateList
=
new
ArrayList
();
List
<
TEmployeeProject
>
proInsList
=
new
ArrayList
();
List
<
TEmployeeProject
>
proInsList
=
new
ArrayList
();
List
<
TEmployeeProject
>
proupdateList
=
new
ArrayList
();
List
<
TEmployeeProject
>
proupdateList
=
new
ArrayList
();
...
@@ -305,15 +347,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
...
@@ -305,15 +347,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
EmployeeProjectVO
excel
=
excelVOList
.
get
(
i
);
EmployeeProjectVO
excel
=
excelVOList
.
get
(
i
);
Set
<
String
>
errorMsg
=
new
HashSet
<>();
Set
<
String
>
errorMsg
=
new
HashSet
<>();
// 已有验证报错直接下一个
if
(
Common
.
isNotNull
(
errorMsgMap
.
get
(
i
+
2
))){
continue
;
}
idCard
=
excel
.
getEmpIdcard
();
idCard
=
excel
.
getEmpIdcard
();
deptNo
=
excel
.
getDeptNo
();
deptNo
=
excel
.
getDeptNo
();
if
(
idCardMap
.
get
(
idCard
.
concat
(
deptNo
))
!=
null
)
{
if
(
idCardMap
.
get
(
idCard
.
concat
(
deptNo
))
!=
null
)
{
errorM
sgMap
.
put
((
i
+
2L
),
new
ErrorMessage
(
"第"
+
(
i
+
2
)
+
"行身份证号+项目编码与第"
+
idCardMap
.
get
(
idCard
)
+
"行重复!"
));
errorM
essageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
"第"
+
(
excel
.
getRowIndex
()
)
+
"行身份证号+项目编码与第"
+
idCardMap
.
get
(
idCard
)
+
"行重复!"
));
}
else
{
}
else
{
idCardMap
.
put
(
idCard
.
concat
(
deptNo
),
i
+
2
);
idCardMap
.
put
(
idCard
.
concat
(
deptNo
),
i
+
2
);
}
}
...
@@ -368,19 +405,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
...
@@ -368,19 +405,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//档案有(离职库),项目(已减档)
//档案有(离职库),项目(已减档)
if
(
Common
.
isNotNull
(
tEmployeeInfo
)
&&
CommonConstants
.
dingleDigitIntArray
[
1
]
==
tEmployeeInfo
.
getFileStatus
()
if
(
Common
.
isNotNull
(
tEmployeeInfo
)
&&
CommonConstants
.
dingleDigitIntArray
[
1
]
==
tEmployeeInfo
.
getFileStatus
()
&&
Common
.
isNotNull
(
tEmployeeProject
)
&&
CommonConstants
.
dingleDigitIntArray
[
1
]
==
tEmployeeProject
.
getProjectStatus
())
{
&&
Common
.
isNotNull
(
tEmployeeProject
)
&&
CommonConstants
.
dingleDigitIntArray
[
1
]
==
tEmployeeProject
.
getProjectStatus
())
{
errorM
sg
.
add
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_EMP_PROJECT_ERROR
));
errorM
essageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_EMP_PROJECT_ERROR
)
));
}
else
if
(
Common
.
isNotNull
(
tEmployeeInfo
)
&&
CommonConstants
.
dingleDigitIntArray
[
1
]
==
tEmployeeInfo
.
getFileStatus
()
}
else
if
(
Common
.
isNotNull
(
tEmployeeInfo
)
&&
CommonConstants
.
dingleDigitIntArray
[
1
]
==
tEmployeeInfo
.
getFileStatus
()
&&
Common
.
isEmpty
(
tEmployeeProject
))
{
&&
Common
.
isEmpty
(
tEmployeeProject
))
{
errorM
sg
.
add
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_REDUCE_EMP_ERROR
));
errorM
essageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_REDUCE_EMP_ERROR
)
));
//档案有(在档人员),项目(已减档)
//档案有(在档人员),项目(已减档)
}
else
if
(
Common
.
isNotNull
(
tEmployeeInfo
)
&&
CommonConstants
.
dingleDigitIntArray
[
0
]
==
tEmployeeInfo
.
getFileStatus
()
}
else
if
(
Common
.
isNotNull
(
tEmployeeInfo
)
&&
CommonConstants
.
dingleDigitIntArray
[
0
]
==
tEmployeeInfo
.
getFileStatus
()
&&
Common
.
isNotNull
(
tEmployeeProject
)
&&
CommonConstants
.
dingleDigitIntArray
[
1
]
==
tEmployeeProject
.
getProjectStatus
()){
&&
Common
.
isNotNull
(
tEmployeeProject
)
&&
CommonConstants
.
dingleDigitIntArray
[
1
]
==
tEmployeeProject
.
getProjectStatus
()){
errorMsg
.
add
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_REDUCE_PROJECT_ERROR
));
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_REDUCE_PROJECT_ERROR
)));
}
}
}
if
(!
CollUtil
.
isEmpty
(
errorMsg
))
{
errorMessageList
.
add
(
new
ErrorMessage
((
long
)
(
i
+
2
),
errorMsg
));
}
}
}
}
...
@@ -400,32 +432,76 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
...
@@ -400,32 +432,76 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"数据更新异常"
,
e
);
log
.
error
(
"数据更新异常"
,
e
);
}
}
if
(
CollUtil
.
isNotEmpty
(
errorMessageList
))
{
return
R
.
failed
(
errorMessageList
);
}
}
return
R
.
ok
();
@Override
public
R
<
List
<
ErrorMessage
>>
importEmpProjectUpdate
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmployeeProjectVO
>
util1
=
new
ExcelUtil
<>(
EmployeeProjectVO
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
EmployeeProjectVO
.
class
,
new
ReadListener
<
EmployeeProjectVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmployeeProjectVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmployeeProjectVO
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
());
importEmpProjectUpdate
(
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 huyc
* @Author huyc
* @Description 批量更新项目档案信息
* @Description 批量更新项目档案信息
* @Date 19:25 2022/6/21
* @Date 19:25 2022/6/21
**/
**/
@Override
public
void
importEmpProjectUpdate
(
List
<
EmployeeProjectVO
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
public
R
<
List
<
ErrorMessage
>>
importEmpProjectUpdate
(
List
<
EmployeeProjectVO
>
excelVOList
,
BindingResult
bindingResult
)
{
// 通用校验获取失败的数据
// 通用校验获取失败的数据
List
<
ErrorMessage
>
errorMessageList
=
(
List
<
ErrorMessage
>)
bindingResult
.
getTarget
();
Map
<
Long
,
ErrorMessage
>
errorMsgMap
=
new
HashMap
<>();
Map
<
Long
,
ErrorMessage
>
errorMsgMap
=
new
HashMap
<>();
if
(
Common
.
isNotNull
(
errorMessageList
)){
errorMessageList
.
stream
().
forEach
(
errorMessage
->
errorMsgMap
.
put
(
errorMessage
.
getLineNum
(),
errorMessage
));
}
List
<
TEmployeeProject
>
updateList
=
new
ArrayList
<>();
List
<
TEmployeeProject
>
updateList
=
new
ArrayList
<>();
// 个性化校验逻辑
List
<
TEmployeeProject
>
list
=
this
.
list
();
Set
<
String
>
errorMsg
;
Map
<
String
,
Integer
>
checkCountMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
checkCountMap
=
new
HashMap
<>();
// 执行数据插入操作 组装
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
...
@@ -433,12 +509,11 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
...
@@ -433,12 +509,11 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if
(
Common
.
isNotNull
(
errorMsgMap
.
get
(
i
+
2
)))
{
if
(
Common
.
isNotNull
(
errorMsgMap
.
get
(
i
+
2
)))
{
continue
;
continue
;
}
}
errorMsg
=
new
HashSet
<>();
EmployeeProjectVO
excel
=
excelVOList
.
get
(
i
);
EmployeeProjectVO
excel
=
excelVOList
.
get
(
i
);
String
checkCount
=
excel
.
getEmpIdcard
().
concat
(
excel
.
getDeptNo
());
String
checkCount
=
excel
.
getEmpIdcard
().
concat
(
excel
.
getDeptNo
());
if
(
Common
.
isNotNull
(
checkCountMap
.
get
(
checkCount
)))
{
if
(
Common
.
isNotNull
(
checkCountMap
.
get
(
checkCount
)))
{
errorM
sgMap
.
put
((
i
+
2L
),
new
ErrorMessage
(
"第"
+
(
i
+
2
)
+
"行身份证号+项目编码与第"
+
checkCountMap
.
get
(
checkCount
)
+
"行重复!"
));
errorM
essageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
"第"
+
(
excel
.
getRowIndex
()
)
+
"行身份证号+项目编码与第"
+
checkCountMap
.
get
(
checkCount
)
+
"行重复!"
));
}
else
{
}
else
{
checkCountMap
.
put
(
checkCount
,
i
+
2
);
checkCountMap
.
put
(
checkCount
,
i
+
2
);
}
}
...
@@ -448,15 +523,12 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
...
@@ -448,15 +523,12 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.
eq
(
TEmployeeProject:
:
getDeptNo
,
excel
.
getDeptNo
())
.
eq
(
TEmployeeProject:
:
getDeptNo
,
excel
.
getDeptNo
())
.
eq
(
TEmployeeProject:
:
getDeleteFlag
,
CommonConstants
.
STATUS_NORMAL
));
.
eq
(
TEmployeeProject:
:
getDeleteFlag
,
CommonConstants
.
STATUS_NORMAL
));
if
(
Common
.
isEmpty
(
tEmployeeProject
))
{
if
(
Common
.
isEmpty
(
tEmployeeProject
))
{
errorM
sg
.
add
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_EMP_EXIT_ERROR
,
excel
.
getEmpName
(
)));
errorM
essageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_EMP_EXIT_ERROR
)));
}
}
// 数据合法情况
// 数据合法情况
if
(
CollUtil
.
isEmpty
(
errorM
sg
))
{
if
(
CollUtil
.
isEmpty
(
errorM
essageList
))
{
updateExcelPro
(
excel
,
updateList
,
tEmployeeProject
);
updateExcelPro
(
excel
,
updateList
,
tEmployeeProject
);
}
else
{
// 数据不合法
errorMessageList
.
add
(
new
ErrorMessage
((
long
)
(
i
+
2
),
errorMsg
));
}
}
}
}
try
{
try
{
...
@@ -466,26 +538,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
...
@@ -466,26 +538,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"数据更新异常"
,
e
);
log
.
error
(
"数据更新异常"
,
e
);
}
}
if
(
CollUtil
.
isNotEmpty
(
errorMessageList
))
{
return
R
.
failed
(
errorMessageList
);
}
return
R
.
ok
();
}
/**
* 插入excel Post
*/
private
void
insertExcelPost
(
EmployeeProjectVO
excel
,
List
<
TEmployeeInfo
>
insertList
)
{
TEmployeeInfo
insTEmployeeInfo
=
new
TEmployeeInfo
();
BeanUtil
.
copyProperties
(
excel
,
insTEmployeeInfo
);
insTEmployeeInfo
.
setFileStatus
(
CommonConstants
.
dingleDigitIntArray
[
0
]);
insTEmployeeInfo
.
setDeleteFlag
(
CommonConstants
.
STATUS_NORMAL
);
insTEmployeeInfo
.
setStatus
(
CommonConstants
.
dingleDigitIntArray
[
0
]);
insTEmployeeInfo
.
setEmpCode
(
this
.
getCode
());
YifuUser
user
=
SecurityUtils
.
getUser
();
insTEmployeeInfo
.
setCreateBy
(
user
.
getId
());
insTEmployeeInfo
.
setCreateName
(
user
.
getNickname
());
insertList
.
add
(
insTEmployeeInfo
);
}
}
/**
/**
...
@@ -567,18 +619,16 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
...
@@ -567,18 +619,16 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
int
i
=
0
;
int
i
=
0
;
for
(
TEmployeeProject
delProject
:
list
)
{
for
(
TEmployeeProject
delProject
:
list
)
{
++
i
;
++
i
;
Set
<
String
>
errorMsg
=
new
HashSet
<>();
try
{
try
{
if
(
CommonConstants
.
dingleDigitIntArray
[
0
]
==
delProject
.
getStatus
())
{
if
(
CommonConstants
.
dingleDigitIntArray
[
0
]
==
delProject
.
getStatus
())
{
delProject
.
setDeleteFlag
(
CommonConstants
.
ONE_STRING
);
delProject
.
setDeleteFlag
(
CommonConstants
.
ONE_STRING
);
baseMapper
.
updateById
(
delProject
);
baseMapper
.
updateById
(
delProject
);
}
else
{
}
else
{
errorMsg
.
add
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_PROJECT_DELETE_ERROR
));
errorList
.
add
(
new
ErrorMessage
(
i
,
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_PROJECT_DELETE_ERROR
)));
errorList
.
add
(
new
ErrorMessage
((
long
)
i
,
errorMsg
));
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"项目档案批量删除异常:"
+
e
.
getMessage
());
log
.
error
(
"项目档案批量删除异常:"
+
e
.
getMessage
());
errorList
.
add
(
new
ErrorMessage
(
MsgUtils
.
getMessage
(
"项目档案批量删除异常:"
,
e
.
getMessage
())));
errorList
.
add
(
new
ErrorMessage
(
i
,
MsgUtils
.
getMessage
(
"项目档案批量删除异常:"
,
e
.
getMessage
())));
return
R
.
failed
(
errorList
,
CommonConstants
.
RESULT_DATA_FAIL
);
return
R
.
failed
(
errorList
,
CommonConstants
.
RESULT_DATA_FAIL
);
}
}
}
}
...
...
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