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
f942dabe
Commit
f942dabe
authored
Jun 28, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
1f0a60ad
05ea5991
Show whitespace changes
Inline
Side-by-side
Showing
49 changed files
with
1398 additions
and
588 deletions
+1398
-588
TEmpEducation.java
...ifu/cloud/plus/v1/yifu/archives/entity/TEmpEducation.java
+13
-3
TEmployeeInfo.java
...ifu/cloud/plus/v1/yifu/archives/entity/TEmployeeInfo.java
+3
-2
CertifySearchVo.java
.../yifu/cloud/plus/v1/yifu/archives/vo/CertifySearchVo.java
+0
-1
DisabilitySearchVo.java
...fu/cloud/plus/v1/yifu/archives/vo/DisabilitySearchVo.java
+0
-1
EducationSearchVo.java
...ifu/cloud/plus/v1/yifu/archives/vo/EducationSearchVo.java
+0
-1
EmpDisabilityExcelVO.java
.../cloud/plus/v1/yifu/archives/vo/EmpDisabilityExcelVO.java
+7
-7
EmpEducationExcelVO.java
...u/cloud/plus/v1/yifu/archives/vo/EmpEducationExcelVO.java
+1
-1
EmpEducationUpdateExcelVo.java
...d/plus/v1/yifu/archives/vo/EmpEducationUpdateExcelVo.java
+13
-13
EmpWorkRecordExcelVO.java
.../cloud/plus/v1/yifu/archives/vo/EmpWorkRecordExcelVO.java
+5
-5
EmployeeExportVO.java
...yifu/cloud/plus/v1/yifu/archives/vo/EmployeeExportVO.java
+0
-1
EmployeeProjectExportVO.java
...oud/plus/v1/yifu/archives/vo/EmployeeProjectExportVO.java
+16
-3
EmployeeVO.java
...a/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeVO.java
+3
-2
FamilySearchVO.java
...m/yifu/cloud/plus/v1/yifu/archives/vo/FamilySearchVO.java
+0
-1
TCertRecordVo.java
...om/yifu/cloud/plus/v1/yifu/archives/vo/TCertRecordVo.java
+194
-0
WorkRecordSearchVO.java
...fu/cloud/plus/v1/yifu/archives/vo/WorkRecordSearchVO.java
+0
-1
FileUploadController.java
...lus/v1/yifu/archives/controller/FileUploadController.java
+6
-77
TCertRecordController.java
...us/v1/yifu/archives/controller/TCertRecordController.java
+11
-0
TElecEmployeeInfoController.java
...yifu/archives/controller/TElecEmployeeInfoController.java
+2
-13
TEmpDisabilityInfoController.java
...ifu/archives/controller/TEmpDisabilityInfoController.java
+4
-65
TEmpEducationController.java
.../v1/yifu/archives/controller/TEmpEducationController.java
+5
-117
TEmpFamilyController.java
...lus/v1/yifu/archives/controller/TEmpFamilyController.java
+3
-61
TEmpProfessionalQualificationController.java
...s/controller/TEmpProfessionalQualificationController.java
+3
-62
TEmpWorkRecordingController.java
...yifu/archives/controller/TEmpWorkRecordingController.java
+3
-63
TEmployeeProjectController.java
.../yifu/archives/controller/TEmployeeProjectController.java
+2
-2
FileUploadService.java
...loud/plus/v1/yifu/archives/service/FileUploadService.java
+18
-0
TCertRecordService.java
...oud/plus/v1/yifu/archives/service/TCertRecordService.java
+3
-0
TElecEmployeeInfoService.java
...us/v1/yifu/archives/service/TElecEmployeeInfoService.java
+10
-0
TEmpDisabilityInfoService.java
...s/v1/yifu/archives/service/TEmpDisabilityInfoService.java
+5
-0
TEmpEducationService.java
...d/plus/v1/yifu/archives/service/TEmpEducationService.java
+6
-0
TEmpFamilyService.java
...loud/plus/v1/yifu/archives/service/TEmpFamilyService.java
+3
-0
TEmpProfessionalQualificationService.java
...rchives/service/TEmpProfessionalQualificationService.java
+3
-0
TEmpWorkRecordingService.java
...us/v1/yifu/archives/service/TEmpWorkRecordingService.java
+3
-0
FileUploadServiceImpl.java
.../v1/yifu/archives/service/impl/FileUploadServiceImpl.java
+105
-0
TCertRecordServiceImpl.java
...v1/yifu/archives/service/impl/TCertRecordServiceImpl.java
+48
-0
TElecEmployeeInfoServiceImpl.java
...u/archives/service/impl/TElecEmployeeInfoServiceImpl.java
+210
-41
TEmpChangeInfoServiceImpl.java
...yifu/archives/service/impl/TEmpChangeInfoServiceImpl.java
+4
-1
TEmpDisabilityInfoServiceImpl.java
.../archives/service/impl/TEmpDisabilityInfoServiceImpl.java
+92
-4
TEmpEducationServiceImpl.java
.../yifu/archives/service/impl/TEmpEducationServiceImpl.java
+148
-7
TEmpFamilyServiceImpl.java
.../v1/yifu/archives/service/impl/TEmpFamilyServiceImpl.java
+67
-4
TEmpProfessionalQualificationServiceImpl.java
...ervice/impl/TEmpProfessionalQualificationServiceImpl.java
+68
-4
TEmpWorkRecordingServiceImpl.java
...u/archives/service/impl/TEmpWorkRecordingServiceImpl.java
+68
-4
TEmployeeProjectServiceImpl.java
...fu/archives/service/impl/TEmployeeProjectServiceImpl.java
+8
-1
TEmployeeProjectMapper.xml
...-biz/src/main/resources/mapper/TEmployeeProjectMapper.xml
+8
-4
CommonConstants.java
...ud.plus.v1/yifu/common/core/constant/CommonConstants.java
+1
-0
ExcelAttribute.java
...oud.plus.v1/yifu/common/core/constant/ExcelAttribute.java
+1
-1
ExcelUtil.java
...m/yifu.cloud.plus.v1/yifu/common/core/util/ExcelUtil.java
+205
-9
messages_zh_CN.properties
...on-core/src/main/resources/i18n/messages_zh_CN.properties
+4
-4
DictController.java
...u.cloud.plus.v1/yifu/admin/controller/DictController.java
+1
-1
DictItemRedisInit.java
...yifu/cloud/plus/v1/yifu/admin/init/DictItemRedisInit.java
+15
-1
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TEmpEducation.java
View file @
f942dabe
...
...
@@ -22,7 +22,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.time.LocalDate
;
import
javax.validation.constraints.Max
;
import
java.util.Date
;
/**
* 员工学历信息表
...
...
@@ -46,12 +47,14 @@ public class TEmpEducation extends BaseEntity {
/**
* 员工ID
*/
@Max
(
value
=
20
)
@Schema
(
description
=
"员工ID"
)
private
String
empId
;
/**
* 员工姓名
*/
@Max
(
value
=
20
)
@Schema
(
description
=
"员工姓名"
)
private
String
empName
;
...
...
@@ -64,6 +67,7 @@ public class TEmpEducation extends BaseEntity {
/**
* 身份证号
*/
@Max
(
value
=
20
)
@Schema
(
description
=
"身份证号"
)
private
String
empIdcard
;
...
...
@@ -71,11 +75,12 @@ public class TEmpEducation extends BaseEntity {
* 入学时间
*/
@Schema
(
description
=
"入学时间"
)
private
Local
Date
entryDate
;
private
Date
entryDate
;
/**
* 学历名称
*/
@Max
(
value
=
50
)
@Schema
(
description
=
"学历名称"
)
private
String
educationName
;
...
...
@@ -83,11 +88,12 @@ public class TEmpEducation extends BaseEntity {
* 结业日期
*/
@Schema
(
description
=
"结业日期"
)
private
Local
Date
gradutionDate
;
private
Date
gradutionDate
;
/**
* 学校名称
*/
@Max
(
value
=
50
)
@Schema
(
description
=
"学校名称"
)
private
String
school
;
...
...
@@ -112,6 +118,7 @@ public class TEmpEducation extends BaseEntity {
/**
* 院系名称
*/
@Max
(
value
=
50
)
@Schema
(
description
=
"院系名称"
)
private
String
collageSystem
;
...
...
@@ -131,18 +138,21 @@ public class TEmpEducation extends BaseEntity {
/**
* 证书名称
*/
@Max
(
value
=
50
)
@Schema
(
description
=
"证书名称"
)
private
String
certificationName
;
/**
* 备注
*/
@Max
(
value
=
200
)
@Schema
(
description
=
"备注"
)
private
String
remark
;
/**
* 专业
*/
@Max
(
value
=
50
)
@Schema
(
description
=
"专业"
)
private
String
major
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TEmployeeInfo.java
View file @
f942dabe
...
...
@@ -30,6 +30,7 @@ import javax.validation.constraints.NotNull;
import
javax.validation.constraints.Size
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -217,13 +218,13 @@ public class TEmployeeInfo extends BaseEntity {
* 入学时间
*/
@Schema
(
description
=
"入学时间"
)
private
Local
Date
admissionDate
;
private
Date
admissionDate
;
/**
* 毕业时间
*/
@Schema
(
description
=
"毕业时间"
)
private
Local
Date
gradutionDate
;
private
Date
gradutionDate
;
/**
* 备注
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/CertifySearchVo.java
View file @
f942dabe
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
cn.hutool.core.date.DateTime
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpProfessionalQualification
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/DisabilitySearchVo.java
View file @
f942dabe
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
cn.hutool.core.date.DateTime
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpDisabilityInfo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EducationSearchVo.java
View file @
f942dabe
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
cn.hutool.core.date.DateTime
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmpDisabilityExcelVO.java
View file @
f942dabe
...
...
@@ -26,7 +26,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@ExcelAttribute
(
name
=
"员工姓名"
,
errorInfo
=
"员工姓名不可为空"
,
maxLength
=
20
)
@ExcelAttribute
(
name
=
"员工姓名"
,
isNotEmpty
=
true
,
errorInfo
=
"员工姓名不可为空"
,
maxLength
=
20
)
@NotNull
(
message
=
"员工姓名不能为空"
)
@ExcelProperty
(
value
=
"员工姓名"
)
private
String
empName
;
...
...
@@ -34,7 +34,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 员工身份证
*/
@ExcelAttribute
(
name
=
"身份证号"
,
errorInfo
=
"员工身份证不能为空"
,
maxLength
=
20
)
@ExcelAttribute
(
name
=
"身份证号"
,
isNotEmpty
=
true
,
errorInfo
=
"员工身份证不能为空"
,
maxLength
=
20
)
@NotNull
(
message
=
"员工身份证不能为空"
)
@ExcelProperty
(
value
=
"身份证号"
)
private
String
empIdcard
;
...
...
@@ -42,7 +42,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 伤残病名称
*/
@ExcelAttribute
(
name
=
"伤残病名称"
,
errorInfo
=
"伤残病名称不能为空"
,
maxLength
=
50
)
@ExcelAttribute
(
name
=
"伤残病名称"
,
isNotEmpty
=
true
,
errorInfo
=
"伤残病名称不能为空"
,
maxLength
=
50
)
@NotNull
(
message
=
"伤残病名称不能为空"
)
@ExcelProperty
(
value
=
"伤残病名称"
)
private
String
disabilityName
;
...
...
@@ -57,7 +57,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 伤残等级
*/
@ExcelAttribute
(
name
=
"伤残等级"
,
errorInfo
=
"伤残等级不能为空"
,
isDataId
=
true
,
dataType
=
"disability_grade"
)
@ExcelAttribute
(
name
=
"伤残等级"
,
isNotEmpty
=
true
,
errorInfo
=
"伤残等级不能为空"
,
isDataId
=
true
,
dataType
=
"disability_grade"
)
@NotNull
(
message
=
"伤残等级不能为空"
)
@ExcelProperty
(
value
=
"伤残等级"
)
private
String
disabilityLevel
;
...
...
@@ -65,7 +65,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 伤残开始日期
*/
@ExcelAttribute
(
name
=
"伤残开始日期"
,
errorInfo
=
"伤残开始日期不能为空"
,
isDate
=
true
)
@ExcelAttribute
(
name
=
"伤残开始日期"
,
isNotEmpty
=
true
,
errorInfo
=
"伤残开始日期不能为空"
,
isDate
=
true
)
@NotNull
(
message
=
"伤残开始日期不能为空"
)
@Past
@DateTimeFormat
(
"YYYY-MM-dd"
)
...
...
@@ -75,7 +75,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 伤残结束日期
*/
@ExcelAttribute
(
name
=
"伤残结束日期"
,
errorInfo
=
"伤残结束日期不能为空"
,
isDate
=
true
)
@ExcelAttribute
(
name
=
"伤残结束日期"
,
isNotEmpty
=
true
,
errorInfo
=
"伤残结束日期不能为空"
,
isDate
=
true
)
@NotNull
(
message
=
"伤残结束日期不能为空"
)
@Past
@DateTimeFormat
(
"YYYY-MM-dd"
)
...
...
@@ -85,7 +85,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 是否工伤标识0是/1否
*/
@ExcelAttribute
(
name
=
"是否工伤"
,
errorInfo
=
"是否工伤不可为空"
,
readConverterExp
=
"0:是,1:
否"
)
@ExcelAttribute
(
name
=
"是否工伤"
,
isNotEmpty
=
true
,
errorInfo
=
"是否工伤不可为空"
,
readConverterExp
=
"0=是,1=
否"
)
@NotNull
(
message
=
"是否工伤标识(0是/1否)不能为空"
)
@ExcelProperty
(
value
=
"是否工伤"
)
private
String
injuryIdentification
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmpEducationExcelVO.java
View file @
f942dabe
...
...
@@ -79,7 +79,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable {
/**
* 最高学历标识0是/1否
*/
@ExcelAttribute
(
name
=
"最高学历"
,
errorInfo
=
"最高学历不可为空"
,
readConverterExp
=
"
是:0,否:1
"
)
@ExcelAttribute
(
name
=
"最高学历"
,
errorInfo
=
"最高学历不可为空"
,
readConverterExp
=
"
0=是,1=否
"
)
@NotNull
(
message
=
"最高学历标识不可为空"
)
@ExcelProperty
(
value
=
"最高学历"
)
private
String
highIdentification
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmpEducationUpdateExcelVo.java
View file @
f942dabe
...
...
@@ -20,15 +20,15 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
* @Author fxj
* @Description 主键
**/
@ExcelAttribute
(
name
=
"
主键"
,
errorInfo
=
"主键
不可为空"
)
@NotNull
(
message
=
"
主键
不可为空"
)
@ExcelProperty
(
value
=
"
主键
"
)
@ExcelAttribute
(
name
=
"
唯一标识"
,
isNotEmpty
=
true
,
errorInfo
=
"唯一标识
不可为空"
)
@NotNull
(
message
=
"
唯一标识
不可为空"
)
@ExcelProperty
(
value
=
"
唯一标识
"
)
private
String
id
;
/**
* 学校名称
*/
@ExcelAttribute
(
name
=
"学校"
,
errorInfo
=
"学校不可为空"
)
@ExcelAttribute
(
name
=
"学校"
,
isNotEmpty
=
true
,
errorInfo
=
"学校不可为空"
)
@NotNull
(
message
=
"学校不可为空"
)
@ExcelProperty
(
value
=
"学校"
)
private
String
school
;
...
...
@@ -44,7 +44,7 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
/**
* 专业
*/
@ExcelAttribute
(
name
=
"专业"
,
errorInfo
=
"专业不可为空"
)
@ExcelAttribute
(
name
=
"专业"
,
isNotEmpty
=
true
,
errorInfo
=
"专业不可为空"
)
@NotNull
(
message
=
"专业不可为空"
)
@ExcelProperty
(
value
=
"专业"
)
private
String
major
;
...
...
@@ -52,7 +52,7 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
/**
* 学历名称
*/
@ExcelAttribute
(
name
=
"学历"
,
errorInfo
=
"学历不可为空
"
)
@ExcelAttribute
(
name
=
"学历"
,
isNotEmpty
=
true
,
errorInfo
=
"学历不可为空"
,
isDataId
=
true
,
dataType
=
"education
"
)
@NotNull
(
message
=
"学历不可为空"
)
@ExcelProperty
(
value
=
"学历"
)
private
String
educationName
;
...
...
@@ -60,14 +60,14 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
/**
* 学历类型:全日制、自考、函授等
*/
@ExcelAttribute
(
name
=
"学历类型"
)
@ExcelAttribute
(
name
=
"学历类型"
,
isDataId
=
true
,
dataType
=
"education_type"
)
@ExcelProperty
(
value
=
"学历类型"
)
private
String
type
;
/**
* 最高学历标识0是/1否
*/
@ExcelAttribute
(
name
=
"最高学历"
,
errorInfo
=
"最高学历标识不可为空"
,
readConverterExp
=
"0:是,1:
否"
)
@ExcelAttribute
(
name
=
"最高学历"
,
isNotEmpty
=
true
,
errorInfo
=
"最高学历标识不可为空"
,
readConverterExp
=
"0=是,1=
否"
)
@NotNull
(
message
=
"最高学历标识不可为空"
)
@ExcelProperty
(
value
=
"最高学历"
)
private
String
highIdentification
;
...
...
@@ -75,25 +75,25 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
/**
* 学制类型:四年、三年、五年、二年
*/
@ExcelAttribute
(
name
=
"学制类型"
)
@ExcelAttribute
(
name
=
"学制类型"
,
isDataId
=
true
,
dataType
=
"education_system"
)
@ExcelProperty
(
value
=
"学制类型"
)
private
String
educationSystem
;
/**
* 入学时间
*/
@ExcelAttribute
(
name
=
"入学时间"
,
errorInfo
=
"入学时间不可为空"
,
isDate
=
true
)
@ExcelAttribute
(
name
=
"入学时间"
,
isNotEmpty
=
true
,
errorInfo
=
"入学时间不可为空"
,
isDate
=
true
)
@NotNull
(
message
=
"入学时间不可为空"
)
@DateTimeFormat
(
"
YYYY
-MM-dd"
)
@DateTimeFormat
(
"
yyyy
-MM-dd"
)
@ExcelProperty
(
value
=
"入学时间"
)
private
Date
entryDate
;
/**
* 结业日期
*/
@ExcelAttribute
(
name
=
"毕业时间"
,
errorInfo
=
"毕业时间不可为空"
,
isDate
=
true
)
@ExcelAttribute
(
name
=
"毕业时间"
,
isNotEmpty
=
true
,
errorInfo
=
"毕业时间不可为空"
,
isDate
=
true
)
@NotNull
(
message
=
"毕业时间不可为空"
)
@DateTimeFormat
(
"
YYYY
-MM-dd"
)
@DateTimeFormat
(
"
yyyy
-MM-dd"
)
@ExcelProperty
(
value
=
"毕业时间"
)
private
Date
gradutionDate
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmpWorkRecordExcelVO.java
View file @
f942dabe
...
...
@@ -25,14 +25,14 @@ public class EmpWorkRecordExcelVO extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@ExcelAttribute
(
name
=
"员工姓名"
,
errorInfo
=
"员工姓名不可为空"
,
maxLength
=
20
)
@ExcelAttribute
(
name
=
"员工姓名"
,
isNotEmpty
=
true
,
errorInfo
=
"员工姓名不可为空"
,
maxLength
=
20
)
@NotNull
(
message
=
"员工姓名不可为空"
)
@ExcelProperty
(
value
=
"员工姓名"
)
private
String
empName
;
/**
* 员工身份证
*/
@ExcelAttribute
(
name
=
"身份证号"
,
errorInfo
=
"员工身份证不可为空"
,
maxLength
=
20
)
@ExcelAttribute
(
name
=
"身份证号"
,
isNotEmpty
=
true
,
errorInfo
=
"员工身份证不可为空"
,
maxLength
=
20
)
@NotNull
(
message
=
"员工身份证不可为空"
)
@ExcelProperty
(
value
=
"身份证号"
)
private
String
empIdcard
;
...
...
@@ -40,7 +40,7 @@ public class EmpWorkRecordExcelVO extends RowIndex implements Serializable {
/**
* 工作单位
*/
@ExcelAttribute
(
name
=
"工作单位"
,
errorInfo
=
"工作单位不可为空"
,
maxLength
=
100
)
@ExcelAttribute
(
name
=
"工作单位"
,
isNotEmpty
=
true
,
errorInfo
=
"工作单位不可为空"
,
maxLength
=
100
)
@NotNull
(
message
=
"工作单位不可为空"
)
@ExcelProperty
(
value
=
"工作单位"
)
private
String
workUnit
;
...
...
@@ -48,7 +48,7 @@ public class EmpWorkRecordExcelVO extends RowIndex implements Serializable {
/**
* 工作部门
*/
@ExcelAttribute
(
name
=
"工作部门"
,
errorInfo
=
"工作部门不可为空"
,
maxLength
=
100
)
@ExcelAttribute
(
name
=
"工作部门"
,
isNotEmpty
=
true
,
errorInfo
=
"工作部门不可为空"
,
maxLength
=
100
)
@NotNull
(
message
=
"工作部门不可为空"
)
@ExcelProperty
(
value
=
"工作部门"
)
private
String
workDepart
;
...
...
@@ -70,7 +70,7 @@ public class EmpWorkRecordExcelVO extends RowIndex implements Serializable {
/**
* 是否在岗:0是/1否
*/
@ExcelAttribute
(
name
=
"在职状态"
,
errorInfo
=
"在职状态不可为空"
,
isDataId
=
true
,
readConverterExp
=
"0:是,1:否
"
)
@ExcelAttribute
(
name
=
"在职状态"
,
isNotEmpty
=
true
,
errorInfo
=
"在职状态不可为空"
,
isDataId
=
true
,
readConverterExp
=
"0=在职,1=离职
"
)
@NotNull
(
message
=
"是否在岗不可为空"
)
@ExcelProperty
(
value
=
"在职状态"
)
private
String
workingStatus
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeExportVO.java
View file @
f942dabe
...
...
@@ -19,7 +19,6 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeProjectExportVO.java
View file @
f942dabe
...
...
@@ -18,6 +18,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
javax.validation.constraints.Past
;
...
...
@@ -309,10 +310,22 @@ public class EmployeeProjectExportVO{
private
Integer
contractStatus
;
/**
* 业务类型
* 业务类型
一级分类
*/
@ExcelProperty
(
value
=
"业务类型"
)
private
String
businessType
;
@ExcelProperty
(
value
=
"业务类型一级分类"
)
private
String
businessPrimaryType
;
/**
* 业务类型二级分类
*/
@ExcelProperty
(
value
=
"业务类型二级分类"
)
private
String
businessSecondType
;
/**
* 业务类型三级分类
*/
@ExcelProperty
(
value
=
"业务类型三级分类"
)
private
String
businessThirdType
;
/**
* 商险状态(字典)
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeVO.java
View file @
f942dabe
...
...
@@ -24,6 +24,7 @@ import javax.validation.constraints.NotNull;
import
javax.validation.constraints.Size
;
import
java.io.Serializable
;
import
java.time.LocalDate
;
import
java.util.Date
;
/**
* 项目档案表excel对应的实体
...
...
@@ -189,13 +190,13 @@ public class EmployeeVO implements Serializable {
* 入学时间
*/
@ExcelProperty
(
value
=
"入学时间"
)
private
Local
Date
admissionDate
;
private
Date
admissionDate
;
/**
* 毕业时间
*/
@ExcelProperty
(
value
=
"毕业时间"
)
private
Local
Date
gradutionDate
;
private
Date
gradutionDate
;
/**
* 备注
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/FamilySearchVO.java
View file @
f942dabe
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
cn.hutool.core.date.DateTime
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpFamily
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/TCertRecordVo.java
0 → 100644
View file @
f942dabe
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* @Author fxj
* @Date 2022/6/27
* @Description
* @Version 1.0
*/
@Data
public
class
TCertRecordVo
implements
Serializable
{
/**
* 员工ID
*/
@ExcelAttribute
(
name
=
"员工ID"
)
@Schema
(
description
=
"员工ID"
)
private
String
empId
;
/**
* 员工姓名
*/
@ExcelAttribute
(
name
=
"员工姓名"
)
@Schema
(
description
=
"员工姓名"
)
private
String
empName
;
/**
* 员工身份证
*/
@ExcelAttribute
(
name
=
"员工身份证"
)
@Schema
(
description
=
"员工身份证"
)
private
String
empIdcard
;
/**
* 项目名称
*/
@ExcelAttribute
(
name
=
"项目名称"
)
@Schema
(
description
=
"项目名称"
)
private
String
projectName
;
/**
* 项目编码
*/
@ExcelAttribute
(
name
=
"项目编码"
)
@Schema
(
description
=
"项目编码"
)
private
String
projectCode
;
/**
* 岗位
*/
@ExcelAttribute
(
name
=
"岗位"
)
@Schema
(
description
=
"岗位"
)
private
String
post
;
/**
* 合同开始时间
*/
@ExcelAttribute
(
name
=
"合同开始时间"
)
@Schema
(
description
=
"合同开始时间"
)
private
LocalDateTime
contractStart
;
/**
* 合同截止时间
*/
@ExcelAttribute
(
name
=
"合同截止时间"
)
@Schema
(
description
=
"合同截止时间"
)
private
LocalDateTime
contractEnd
;
/**
* 开具当天时间
*/
@ExcelAttribute
(
name
=
"开具当天时间"
)
@Schema
(
description
=
"开具当天时间"
)
private
LocalDateTime
openCurTime
;
/**
* 印章名称
*/
@ExcelAttribute
(
name
=
"印章名称"
)
@Schema
(
description
=
"印章名称"
)
private
String
seal
;
/**
* 创建者
*/
@ExcelAttribute
(
name
=
"创建者"
)
@Schema
(
description
=
"创建者"
)
private
String
createBy
;
/**
* 更新人
*/
@ExcelAttribute
(
name
=
"更新人"
)
@Schema
(
description
=
"更新人"
)
private
String
updateBy
;
/**
* 创建人姓名
*/
@ExcelAttribute
(
name
=
"创建人姓名"
)
@Schema
(
description
=
"创建人姓名"
)
private
String
createName
;
/**
* 创建时间
*/
@ExcelAttribute
(
name
=
"创建时间"
)
@Schema
(
description
=
"创建时间"
)
private
LocalDateTime
createTime
;
/**
* 更新时间
*/
@ExcelAttribute
(
name
=
"更新时间"
)
@Schema
(
description
=
"更新时间"
)
private
LocalDateTime
updateTime
;
/**
* 证明类型:0 在职 1 离职2劳动合同解除 3调档函4.代缴证明
*/
@ExcelAttribute
(
name
=
"证明类型:0 在职 1 离职2劳动合同解除 3调档函4.代缴证明"
)
@Schema
(
description
=
"证明类型:0 在职 1 离职2劳动合同解除 3调档函4.代缴证明"
)
private
String
type
;
/**
* 离职时间
*/
@ExcelAttribute
(
name
=
"离职时间"
)
@Schema
(
description
=
"离职时间"
)
private
LocalDateTime
leaveTime
;
/**
* 派减原因
*/
@ExcelAttribute
(
name
=
"派减原因"
)
@Schema
(
description
=
"派减原因"
)
private
String
leaveReason
;
/**
* 性别:0男 1女
*/
@ExcelAttribute
(
name
=
"性别:0男 1女"
)
@Schema
(
description
=
"性别:0男 1女"
)
private
String
sex
;
/**
* 入职时间(来我单位时间)
*/
@ExcelAttribute
(
name
=
"入职时间(来我单位时间)"
)
@Schema
(
description
=
"入职时间(来我单位时间)"
)
private
LocalDateTime
entryTime
;
/**
* 签订合同时间-第一次
*/
@ExcelAttribute
(
name
=
"签订合同时间-第一次"
)
@Schema
(
description
=
"签订合同时间-第一次"
)
private
LocalDateTime
firstContractTime
;
/**
* 开具人
*/
@ExcelAttribute
(
name
=
"开具人"
)
@Schema
(
description
=
"开具人"
)
private
String
opener
;
/**
* 开具时间
*/
@ExcelAttribute
(
name
=
"开具时间"
)
@Schema
(
description
=
"开具时间"
)
private
LocalDateTime
openTime
;
/**
* 介绍单位
*/
@ExcelAttribute
(
name
=
"介绍单位"
)
@Schema
(
description
=
"介绍单位"
)
private
String
introductionUnit
;
/**
* 参保时间
*/
@ExcelAttribute
(
name
=
"参保时间"
)
@Schema
(
description
=
"参保时间"
)
private
LocalDateTime
socialTime
;
}
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/WorkRecordSearchVO.java
View file @
f942dabe
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
cn.hutool.core.date.DateTime
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpWorkRecording
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/FileUploadController.java
View file @
f942dabe
...
...
@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FileUploadService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TAttaInfoService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil
;
...
...
@@ -17,7 +18,6 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.IOException
;
import
java.net.URL
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
...
...
@@ -36,6 +36,9 @@ public class FileUploadController {
@Autowired
private
TAttaInfoService
tAttaInfoService
;
@Autowired
private
FileUploadService
fileUploadService
;
/**
* @Author fxj
* @Description
...
...
@@ -52,60 +55,12 @@ public class FileUploadController {
/*@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "Form文件上传", required = true, dataType = "__file", paramType = "form"),
@ApiImplicitParam(name = "filePath", value = "文件上传路径", required = false, dataType = "String", paramType = "form"),
@ApiImplicitParam(name = "type", value = "关系类型(0客户附件1联系人附件2跟进记录附件3合同附件4合同归档附件5报价单6招标信息7业务评估)", required = true, dataType = "int", paramType = "form"),
@ApiImplicitParam(name = "type", value = "关系类型(0客户附件1联系人附件2跟进记录附件3合同附件4合同归档附件5报价单6招标信息7业务评估
8电子档案
)", required = true, dataType = "int", paramType = "form"),
@ApiImplicitParam(name = "domain", value = "实体id(传入就插入对应关系,用于编辑)", required = false, paramType = "form")
})*/
@PostMapping
(
value
=
"/ossUploadFile"
)
public
R
<
FileVo
>
uploadImg
(
@RequestBody
MultipartFile
file
,
String
filePath
,
Integer
type
,
String
domain
)
throws
IOException
{
if
(
null
==
file
)
{
return
R
.
failed
(
"文件删除异常,请重新上传!"
);
}
String
fileName
=
file
.
getOriginalFilename
();
if
(
Common
.
isEmpty
(
fileName
))
{
return
R
.
failed
(
"文件名不能为空!"
);
}
if
(
fileName
.
length
()
>
100
)
{
return
R
.
failed
(
"文件名不能超过100个字符!"
);
}
//filePath不传默认存储空间的根目录
//jpg,jpeg,png,bmp
String
key
=
""
;
if
(
Common
.
isNotNull
(
filePath
))
{
key
=
filePath
+
"/"
+
System
.
currentTimeMillis
()
+
fileName
;
}
else
{
key
=
System
.
currentTimeMillis
()
+
fileName
;
}
if
(!
Common
.
checkFile
(
key
))
{
return
R
.
failed
(
"非法上传类型!"
);
}
boolean
flag
=
ossUtil
.
uploadFileByStream
(
file
.
getInputStream
(),
key
,
null
);
FileVo
fileVo
;
TAttaInfo
attaInfo
;
URL
url
;
if
(
flag
)
{
log
.
info
(
"文件:"
+
fileName
+
"上传至存储空间"
+
ossUtil
.
getBucketName
()
+
"成功!"
);
attaInfo
=
initUnitAttaForInsert
(
fileName
,
key
,
file
.
getSize
());
attaInfo
.
setRelationType
(
String
.
valueOf
(
type
));
try
{
attaInfo
.
setDomainId
(
domain
);
attaInfo
=
tAttaInfoService
.
add
(
attaInfo
);
}
catch
(
Exception
e
)
{
log
.
error
(
"OSS文件上传接口异常:"
+
e
.
getMessage
());
ossUtil
.
deleteObject
(
null
,
key
);
return
R
.
failed
(
"fail:"
+
e
.
getMessage
());
}
//有实体id则插入关系,用于编辑
if
(
Common
.
isNotNull
(
domain
))
{
url
=
ossUtil
.
getObjectUrl
(
null
,
attaInfo
.
getAttaSrc
());
fileVo
=
new
FileVo
(
attaInfo
.
getId
(),
attaInfo
.
getAttaName
(),
url
.
toString
());
return
R
.
ok
(
fileVo
,
"success"
);
}
url
=
ossUtil
.
getObjectUrl
(
null
,
attaInfo
.
getAttaSrc
());
fileVo
=
new
FileVo
(
attaInfo
.
getId
(),
attaInfo
.
getAttaName
(),
url
.
toString
());
return
R
.
ok
(
fileVo
,
"success"
);
}
else
{
return
R
.
failed
(
"fail:上传失败"
);
}
return
fileUploadService
.
uploadImg
(
file
,
filePath
,
type
,
domain
);
}
...
...
@@ -137,32 +92,6 @@ public class FileUploadController {
return
R
.
ok
(
null
,
"删除失败!"
);
}
/**
* 对象初始化
* @param fileName
* @param key
* @param fileSize
* @return
*/
private
TAttaInfo
initUnitAttaForInsert
(
String
fileName
,
String
key
,
long
fileSize
)
{
TAttaInfo
unitAtta
=
new
TAttaInfo
();
char
slash
=
'/'
;
char
point
=
'.'
;
if
(
fileName
.
lastIndexOf
(
slash
)
>=
0
)
{
unitAtta
.
setAttaName
(
fileName
.
substring
(
fileName
.
lastIndexOf
(
slash
)));
}
else
{
unitAtta
.
setAttaName
(
fileName
);
}
unitAtta
.
setAttaSize
(
fileSize
);
unitAtta
.
setAttaSrc
(
key
);
if
(
key
.
lastIndexOf
(
point
)
>=
0
)
{
unitAtta
.
setAttaType
(
key
.
substring
(
key
.
lastIndexOf
(
point
)));
}
unitAtta
.
setCreateTime
(
LocalDateTime
.
now
());
return
unitAtta
;
}
/**
* 获取附件下载地址
*
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TCertRecordController.java
View file @
f942dabe
...
...
@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TCertRecordService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TCertRecordVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
...
...
@@ -86,6 +87,16 @@ public class TCertRecordController {
return
R
.
ok
(
tCertRecordService
.
getById
(
id
));
}
/**
* 通过员工ID查询证明开具记录相关信息
* @param id 项目档案ID
* @return R
*/
@GetMapping
(
"/getCertRecordInfo"
)
public
R
<
TCertRecordVo
>
getCertRecordInfo
(
@RequestParam
(
value
=
"id"
)
String
id
)
{
return
tCertRecordService
.
getCertRecordInfo
(
id
);
}
/**
* 新增证明开具记录表
* @param tCertRecord 证明开具记录表
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TElecEmployeeInfoController.java
View file @
f942dabe
...
...
@@ -17,13 +17,9 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
controller
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TElecEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TElecEmployeeInfoService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
...
...
@@ -50,8 +46,6 @@ public class TElecEmployeeInfoController {
private
final
TElecEmployeeInfoService
tElecEmployeeInfoService
;
private
final
TEmployeeInfoService
tEmployeeInfoService
;
/**
* 分页查询
* @param page 分页对象
...
...
@@ -126,12 +120,7 @@ public class TElecEmployeeInfoController {
@SysLog
(
"通过身份证号查询人员档案"
)
@PostMapping
(
"/getEmpInfo"
)
public
R
getEmpInfoByCard
(
@RequestParam
String
idCard
)
{
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getOne
((
Wrappers
.<
TEmployeeInfo
>
query
().
lambda
()
.
eq
(
TEmployeeInfo:
:
getEmpIdcard
,
idCard
)));
if
(
Common
.
isNotNull
(
tEmployeeInfo
))
{
return
R
.
ok
(
tEmployeeInfo
);
}
return
R
.
failed
(
"未找到身份证号对应的档案信息"
);
return
R
.
ok
(
tElecEmployeeInfoService
.
getEmpInfoByCard
(
idCard
));
}
/**
...
...
@@ -142,7 +131,7 @@ public class TElecEmployeeInfoController {
@PostMapping
(
"/importZip"
)
@Operation
(
summary
=
"批量导入电子档案"
,
description
=
"批量导入电子档案"
)
@SysLog
(
"批量导入电子档案"
)
public
R
<
Boolean
>
importZip
(
@Request
Param
(
"file"
)
MultipartFile
file
)
{
public
R
<
Boolean
>
importZip
(
@Request
Body
MultipartFile
file
)
{
return
this
.
tElecEmployeeInfoService
.
importZip
(
file
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmpDisabilityInfoController.java
View file @
f942dabe
...
...
@@ -17,32 +17,24 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
controller
;
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.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpDisabilityInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmpDisabilityInfoService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.DisabilitySearchVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpDisabilityExcelVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.SneakyThrows
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -120,7 +112,7 @@ public class TEmpDisabilityInfoController {
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('archives_tempdisabilityinfo_edit')"
)
public
R
<
Boolean
>
updateById
(
@RequestBody
TEmpDisabilityInfo
tEmpDisabilityInfo
)
{
return
R
.
ok
(
tEmpDisabilityInfoService
.
updateById
(
tEmpDisabilityInfo
)
);
return
tEmpDisabilityInfoService
.
updateByIdDiy
(
tEmpDisabilityInfo
);
}
/**
...
...
@@ -158,66 +150,13 @@ public class TEmpDisabilityInfoController {
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation
(
description
=
"批量新增员工伤残信息 hasPermission('archives_tempdisabilityinfo_importListAdd')"
)
@SysLog
(
"批量新增员工伤残信息"
)
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('archives_tempdisabilityinfo_importListAdd')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@RequestBody
MultipartFile
file
){
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmpDisabilityExcelVO
>
util1
=
new
ExcelUtil
<>(
EmpDisabilityExcelVO
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
file
.
getInputStream
(),
EmpDisabilityExcelVO
.
class
,
new
ReadListener
<
EmpDisabilityExcelVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmpDisabilityExcelVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmpDisabilityExcelVO
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
());
tEmpDisabilityInfoService
.
importTmpDisability
(
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
);
return
tEmpDisabilityInfoService
.
importTmpDisabilityDiy
(
file
.
getInputStream
());
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmpEducationController.java
View file @
f942dabe
...
...
@@ -17,32 +17,25 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
controller
;
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.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmpEducationService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EducationSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.SneakyThrows
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -159,66 +152,13 @@ public class TEmpEducationController {
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation
(
description
=
"批量新增员工学历信息 hasPermission('archives_education_importListAdd')"
)
@SysLog
(
"批量新增员工学历信息"
)
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('archives_education_importListAdd')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@RequestBody
MultipartFile
file
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmpEducationUpdateExcelVo
>
util1
=
new
ExcelUtil
<>(
EmpEducationUpdateExcelVo
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
file
.
getInputStream
(),
EmpEducationUpdateExcelVo
.
class
,
new
ReadListener
<
EmpEducationUpdateExcelVo
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmpEducationUpdateExcelVo
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmpEducationUpdateExcelVo
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
());
tEmpEducationService
.
importEmpEducationUpdate
(
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
);
return
tEmpEducationService
.
importEmpEducationDiy
(
file
.
getInputStream
());
}
/**
...
...
@@ -229,64 +169,12 @@ public class TEmpEducationController {
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation
(
description
=
"批量更新员工学历信息 hasPermission('archives_education_importListUpdate')"
)
@SysLog
(
"批量更新员工学历信息"
)
@PostMapping
(
"/importListUpate"
)
@PreAuthorize
(
"@pms.hasPermission('archives_education_importListUpdate')"
)
public
R
<
List
<
ErrorMessage
>>
importListUpate
(
@RequestBody
MultipartFile
file
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmpEducationUpdateExcelVo
>
util1
=
new
ExcelUtil
<>(
EmpEducationUpdateExcelVo
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
file
.
getInputStream
(),
EmpEducationUpdateExcelVo
.
class
,
new
ReadListener
<
EmpEducationUpdateExcelVo
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmpEducationUpdateExcelVo
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmpEducationUpdateExcelVo
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
());
tEmpEducationService
.
importEmpEducationUpdate
(
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
);
return
tEmpEducationService
.
importEmpEducationUpdateDiy
(
file
.
getInputStream
());
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmpFamilyController.java
View file @
f942dabe
...
...
@@ -17,32 +17,25 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
controller
;
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.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpFamily
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmpFamilyService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpFamilyExcelVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.FamilySearchVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.SneakyThrows
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -183,63 +176,12 @@ public class TEmpFamilyController {
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation
(
description
=
"批量新增员工家庭信息 hasPermission('archives-family-batch-import')"
)
@SysLog
(
"批量新增员工家庭信息"
)
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('archives-family-batch-import')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@RequestBody
MultipartFile
file
){
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmpFamilyExcelVO
>
util1
=
new
ExcelUtil
<>(
EmpFamilyExcelVO
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
file
.
getInputStream
(),
EmpFamilyExcelVO
.
class
,
new
ReadListener
<
EmpFamilyExcelVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmpFamilyExcelVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmpFamilyExcelVO
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
());
tEmpFamilyService
.
importEmpFamily
(
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
);
return
tEmpFamilyService
.
importEmpFamilyDiy
(
file
.
getInputStream
());
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmpProfessionalQualificationController.java
View file @
f942dabe
...
...
@@ -17,32 +17,24 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
controller
;
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.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpProfessionalQualification
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmpProfessionalQualificationService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.CertifySearchVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpCertificateExcelVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.SneakyThrows
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -155,63 +147,12 @@ public class TEmpProfessionalQualificationController {
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation
(
description
=
"批量新增员工证书信息 hasPermission('archives-professionalqualification-batch-import')"
)
@SysLog
(
"批量新增员工证书信息"
)
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('archives-professionalqualification-batch-import')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@RequestBody
MultipartFile
file
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmpCertificateExcelVO
>
util1
=
new
ExcelUtil
<>(
EmpCertificateExcelVO
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
file
.
getInputStream
(),
EmpCertificateExcelVO
.
class
,
new
ReadListener
<
EmpCertificateExcelVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmpCertificateExcelVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmpCertificateExcelVO
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
());
qualificationService
.
importEmpCertificate
(
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
);
return
qualificationService
.
importEmpCertificateDiy
(
file
.
getInputStream
());
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmpWorkRecordingController.java
View file @
f942dabe
...
...
@@ -17,32 +17,25 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
controller
;
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.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpWorkRecording
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmpWorkRecordingService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpWorkRecordExcelVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.WorkRecordSearchVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.SneakyThrows
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -156,65 +149,12 @@ public class TEmpWorkRecordingController {
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation
(
description
=
"批量新增员工工作信息 hasPermission('archives_tempworkrecording_importListAdd')"
)
@SysLog
(
"批量新增员工工作信息"
)
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('archives_tempworkrecording_importListAdd')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@RequestBody
MultipartFile
file
)
{
List
<
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
util
.
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmpWorkRecordExcelVO
>
util1
=
new
ExcelUtil
<>(
EmpWorkRecordExcelVO
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
file
.
getInputStream
(),
EmpWorkRecordExcelVO
.
class
,
new
ReadListener
<
EmpWorkRecordExcelVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmpWorkRecordExcelVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmpWorkRecordExcelVO
data
,
AnalysisContext
context
)
{
ReadRowHolder
readRowHolder
=
context
.
readRowHolder
();
Integer
rowIndex
=
readRowHolder
.
getRowIndex
();
data
.
setRowIndex
(
rowIndex
+
1
);
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
util
.
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
());
tEmpWorkRecordingService
.
importEmpWorkRecord
(
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
);
return
tEmpWorkRecordingService
.
importEmpWorkRecordDiy
(
file
.
getInputStream
());
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeProjectController.java
View file @
f942dabe
...
...
@@ -230,8 +230,8 @@ public class TEmployeeProjectController {
* @Date 2022-06-21
**/
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
EmployeeProjectExportVO
projectDTO
,
@RequestParam
(
name
=
"idstr"
,
required
=
false
)
String
idstr
,
@RequestBody
List
<
String
>
exportFields
)
{
public
void
export
(
HttpServletResponse
response
,
@RequestParam
(
name
=
"idstr"
,
required
=
false
)
String
idstr
,
@RequestBody
List
<
String
>
exportFields
,
EmployeeProjectExportVO
projectDTO
)
{
tEmployeeProjectService
.
listExportProject
(
response
,
projectDTO
,
idstr
,
exportFields
);
}
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/FileUploadService.java
0 → 100644
View file @
f942dabe
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.FileVo
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
/**
* 文件上传
*
* @author pwang
* @date 2022-07-27 16:16:07
*/
public
interface
FileUploadService
{
R
<
FileVo
>
uploadImg
(
MultipartFile
file
,
String
filePath
,
Integer
type
,
String
domain
)
throws
IOException
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TCertRecordService.java
View file @
f942dabe
...
...
@@ -19,6 +19,8 @@ package com.yifu.cloud.plus.v1.yifu.archives.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TCertRecordVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
/**
* 证明开具记录表
...
...
@@ -28,4 +30,5 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord;
*/
public
interface
TCertRecordService
extends
IService
<
TCertRecord
>
{
R
<
TCertRecordVo
>
getCertRecordInfo
(
String
id
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TElecEmployeeInfoService.java
View file @
f942dabe
...
...
@@ -42,4 +42,14 @@ public interface TElecEmployeeInfoService extends IService<TElecEmployeeInfo> {
* @date: 2022/6/24
*/
R
<
Boolean
>
importZip
(
MultipartFile
file
);
/**
* @description: 通过身份证号查询人员档案
* @param idCard 身份证号
* @return: R
* @author: huyc
* @date: 2022/6/27
*/
R
getEmpInfoByCard
(
String
idCard
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmpDisabilityInfoService.java
View file @
f942dabe
...
...
@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpDisabilityExcelVO;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
java.io.InputStream
;
import
java.util.List
;
/**
...
...
@@ -43,4 +44,8 @@ public interface TEmpDisabilityInfoService extends IService<TEmpDisabilityInfo>
IPage
<
TEmpDisabilityInfo
>
pageDiy
(
Page
page
,
DisabilitySearchVo
searchVo
);
List
<
TEmpDisabilityInfo
>
getTEmpDisabilityInfoNoPage
(
DisabilitySearchVo
searchVo
);
R
<
Boolean
>
updateByIdDiy
(
TEmpDisabilityInfo
tEmpDisabilityInfo
);
R
<
List
<
ErrorMessage
>>
importTmpDisabilityDiy
(
InputStream
inputStream
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmpEducationService.java
View file @
f942dabe
...
...
@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
java.io.InputStream
;
import
java.util.List
;
/**
...
...
@@ -50,4 +51,9 @@ public interface TEmpEducationService extends IService<TEmpEducation> {
IPage
<
TEmpEducation
>
pageDiy
(
Page
page
,
EducationSearchVo
tEmpEducation
);
List
<
TEmpEducation
>
getTEmpEducationNoPage
(
EducationSearchVo
searchVo
);
R
<
List
<
ErrorMessage
>>
importEmpEducationDiy
(
InputStream
inputStream
);
R
<
List
<
ErrorMessage
>>
importEmpEducationUpdateDiy
(
InputStream
inputStream
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmpFamilyService.java
View file @
f942dabe
...
...
@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.FamilySearchVO;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
java.io.InputStream
;
import
java.util.List
;
/**
...
...
@@ -45,4 +46,6 @@ public interface TEmpFamilyService extends IService<TEmpFamily> {
IPage
<
TEmpFamily
>
pageDiy
(
Page
page
,
FamilySearchVO
tEmpFamily
);
List
<
TEmpFamily
>
getTEmpFamilyNoPage
(
FamilySearchVO
family
);
R
<
List
<
ErrorMessage
>>
importEmpFamilyDiy
(
InputStream
fileInputStream
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmpProfessionalQualificationService.java
View file @
f942dabe
...
...
@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpCertificateExcelVO;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
java.io.InputStream
;
import
java.util.List
;
/**
...
...
@@ -43,4 +44,6 @@ public interface TEmpProfessionalQualificationService extends IService<TEmpProfe
List
<
TEmpProfessionalQualification
>
getDataNoPage
(
CertifySearchVo
searchVo
);
IPage
<
TEmpProfessionalQualification
>
pageDiy
(
Page
page
,
CertifySearchVo
searchVo
);
R
<
List
<
ErrorMessage
>>
importEmpCertificateDiy
(
InputStream
inputStream
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmpWorkRecordingService.java
View file @
f942dabe
...
...
@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.WorkRecordSearchVO;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
java.io.InputStream
;
import
java.util.List
;
/**
...
...
@@ -45,4 +46,6 @@ public interface TEmpWorkRecordingService extends IService<TEmpWorkRecording> {
IPage
<
TEmpWorkRecording
>
pageDiy
(
Page
page
,
WorkRecordSearchVO
tEmpWorkRecording
);
List
<
TEmpWorkRecording
>
getTEmpWorkRecordingNoPage
(
WorkRecordSearchVO
searchVo
);
R
<
List
<
ErrorMessage
>>
importEmpWorkRecordDiy
(
InputStream
inputStream
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/FileUploadServiceImpl.java
0 → 100644
View file @
f942dabe
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
.
impl
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FileUploadService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TAttaInfoService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.FileVo
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.time.LocalDateTime
;
@Service
@RequiredArgsConstructor
@Slf4j
public
class
FileUploadServiceImpl
implements
FileUploadService
{
private
final
OSSUtil
ossUtil
;
private
final
TAttaInfoService
tAttaInfoService
;
@Override
public
R
<
FileVo
>
uploadImg
(
MultipartFile
file
,
String
filePath
,
Integer
type
,
String
domain
)
throws
IOException
{
if
(
null
==
file
)
{
return
R
.
failed
(
"文件删除异常,请重新上传!"
);
}
String
fileName
=
file
.
getOriginalFilename
();
if
(
Common
.
isEmpty
(
fileName
))
{
return
R
.
failed
(
"文件名不能为空!"
);
}
if
(
fileName
.
length
()
>
100
)
{
return
R
.
failed
(
"文件名不能超过100个字符!"
);
}
//filePath不传默认存储空间的根目录
//jpg,jpeg,png,bmp
String
key
=
""
;
if
(
Common
.
isNotNull
(
filePath
))
{
key
=
filePath
+
"/"
+
System
.
currentTimeMillis
()
+
fileName
;
}
else
{
key
=
System
.
currentTimeMillis
()
+
fileName
;
}
if
(!
Common
.
checkFile
(
key
))
{
return
R
.
failed
(
"非法上传类型!"
);
}
boolean
flag
=
ossUtil
.
uploadFileByStream
(
file
.
getInputStream
(),
key
,
null
);
FileVo
fileVo
;
TAttaInfo
attaInfo
;
URL
url
;
if
(
flag
)
{
log
.
info
(
"文件:"
+
fileName
+
"上传至存储空间"
+
ossUtil
.
getBucketName
()
+
"成功!"
);
attaInfo
=
initUnitAttaForInsert
(
fileName
,
key
,
file
.
getSize
());
attaInfo
.
setRelationType
(
String
.
valueOf
(
type
));
try
{
attaInfo
.
setDomainId
(
domain
);
attaInfo
=
tAttaInfoService
.
add
(
attaInfo
);
}
catch
(
Exception
e
)
{
log
.
error
(
"OSS文件上传接口异常:"
+
e
.
getMessage
());
ossUtil
.
deleteObject
(
null
,
key
);
return
R
.
failed
(
"fail:"
+
e
.
getMessage
());
}
//有实体id则插入关系,用于编辑
if
(
Common
.
isNotNull
(
domain
))
{
url
=
ossUtil
.
getObjectUrl
(
null
,
attaInfo
.
getAttaSrc
());
fileVo
=
new
FileVo
(
attaInfo
.
getId
(),
attaInfo
.
getAttaName
(),
url
.
toString
());
return
R
.
ok
(
fileVo
,
"success"
);
}
url
=
ossUtil
.
getObjectUrl
(
null
,
attaInfo
.
getAttaSrc
());
fileVo
=
new
FileVo
(
attaInfo
.
getId
(),
attaInfo
.
getAttaName
(),
url
.
toString
());
return
R
.
ok
(
fileVo
,
"success"
);
}
else
{
return
R
.
failed
(
"fail:上传失败"
);
}
}
/**
* 对象初始化
* @param fileName
* @param key
* @param fileSize
* @return
*/
private
TAttaInfo
initUnitAttaForInsert
(
String
fileName
,
String
key
,
long
fileSize
)
{
TAttaInfo
unitAtta
=
new
TAttaInfo
();
char
slash
=
'/'
;
char
point
=
'.'
;
if
(
fileName
.
lastIndexOf
(
slash
)
>=
0
)
{
unitAtta
.
setAttaName
(
fileName
.
substring
(
fileName
.
lastIndexOf
(
slash
)));
}
else
{
unitAtta
.
setAttaName
(
fileName
);
}
unitAtta
.
setAttaSize
(
fileSize
);
unitAtta
.
setAttaSrc
(
key
);
if
(
key
.
lastIndexOf
(
point
)
>=
0
)
{
unitAtta
.
setAttaType
(
key
.
substring
(
key
.
lastIndexOf
(
point
)));
}
unitAtta
.
setCreateTime
(
LocalDateTime
.
now
());
return
unitAtta
;
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TCertRecordServiceImpl.java
View file @
f942dabe
...
...
@@ -18,8 +18,17 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord
;
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.mapper.TCertRecordMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TCertRecordService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TCertRecordVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
/**
...
...
@@ -28,7 +37,46 @@ import org.springframework.stereotype.Service;
* @author fxj
* @date 2022-06-25 11:05:11
*/
@RequiredArgsConstructor
@Service
public
class
TCertRecordServiceImpl
extends
ServiceImpl
<
TCertRecordMapper
,
TCertRecord
>
implements
TCertRecordService
{
private
final
TEmployeeProjectMapper
projectMapper
;
private
final
TEmployeeInfoMapper
employeeInfoMapper
;
@Override
public
R
<
TCertRecordVo
>
getCertRecordInfo
(
String
id
)
{
TEmployeeProject
project
=
projectMapper
.
selectById
(
id
);
if
(!
Common
.
isNotNull
(
project
)){
return
R
.
failed
(
CommonConstants
.
PARAM_IS_NOT_ERROR
);
}
TEmployeeInfo
employeeInfo
=
employeeInfoMapper
.
selectById
(
project
.
getEmpId
());
if
(!
Common
.
isNotNull
(
employeeInfo
)){
return
R
.
failed
(
CommonConstants
.
PARAM_IS_NOT_ERROR
);
}
TCertRecordVo
vo
=
new
TCertRecordVo
();
vo
.
setEmpIdcard
(
project
.
getEmpIdcard
());
vo
.
setEmpId
(
project
.
getEmpId
());
vo
.
setEmpName
(
project
.
getEmpName
());
vo
.
setPost
(
project
.
getPost
());
vo
.
setProjectName
(
project
.
getDeptName
());
vo
.
setProjectCode
(
project
.
getDeptNo
());
// TODO 最新合同时间
vo
.
setContractStart
(
null
);
vo
.
setContractEnd
(
null
);
// TODO 派减离职时间和原因
vo
.
setLeaveTime
(
employeeInfo
.
getLeaveTime
());
vo
.
setLeaveReason
(
employeeInfo
.
getLeaveReason
());
// TODO 第一次合同开始截止时间
vo
.
setEntryTime
(
employeeInfo
.
getCreateTime
());
vo
.
setFirstContractTime
(
null
);
vo
.
setSex
(
employeeInfo
.
getEmpSex
());
vo
.
setIntroductionUnit
(
CommonConstants
.
EMPTY_STRING
);
vo
.
setSeal
(
"安徽皖信人力资源管理有限公司"
);
// TODO 参保时间
vo
.
setSocialTime
(
null
);
return
R
.
ok
(
vo
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TElecEmployeeInfoServiceImpl.java
View file @
f942dabe
...
...
@@ -16,30 +16,38 @@
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
.
impl
;
import
cn.hutool.core.io.FileTypeUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.CharsetUtil
;
import
cn.hutool.core.util.ZipUtil
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TElecEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TElecEmployeeInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FileUploadService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TElecEmployeeInfoService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService
;
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.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.apache.commons.compress.archivers.zip.ZipArchiveEntry
;
import
org.apache.commons.compress.archivers.zip.ZipFile
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.FileVo
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.fileupload.FileItem
;
import
org.apache.commons.fileupload.FileItemFactory
;
import
org.apache.commons.fileupload.disk.DiskFileItemFactory
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
import
java.io.*
;
import
java.util.*
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.util.ArrayList
;
import
java.util.Enumeration
;
import
java.util.List
;
import
java.util.UUID
;
/**
* 电子档案信息表
...
...
@@ -48,8 +56,16 @@ import java.util.UUID;
* @date 2022-06-18 09:39:46
*/
@Service
@RequiredArgsConstructor
@EnableConfigurationProperties
(
DaprUpmsProperties
.
class
)
public
class
TElecEmployeeInfoServiceImpl
extends
ServiceImpl
<
TElecEmployeeInfoMapper
,
TElecEmployeeInfo
>
implements
TElecEmployeeInfoService
{
private
final
TEmployeeInfoService
tEmployeeInfoService
;
private
final
FileUploadService
fileUploadService
;
private
final
DaprUpmsProperties
daprUpmsProperties
;
@Override
public
boolean
save
(
TElecEmployeeInfo
entity
)
{
return
super
.
save
(
entity
);
...
...
@@ -62,53 +78,206 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
/**
* @description: 解析zip文件包中的多个附件,并生成结算记录
* @param
f
ile zip文件包
* @param
zipF
ile zip文件包
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author:
wangweiguo
* @date: 202
1/8/19
* @author:
huyc
* @date: 202
2/6/27
*/
@Override
public
R
<
Boolean
>
importZip
(
MultipartFile
file
)
{
public
R
<
Boolean
>
importZip
(
MultipartFile
zipFile
)
{
//C:\Users\登录用户~1\AppData\Local\Temp\
String
pathName
=
System
.
getProperty
(
"java.io.tmpdir"
)
+
"shpFileCache/"
;
String
dec
=
System
.
getProperty
(
"java.io.tmpdir"
)
+
"shpFileCache/"
;
File
unzip
=
null
;
File
etractFile
=
null
;
//获取文件名(包括后缀)
String
pname
=
zipFile
.
getOriginalFilename
();
pathName
=
pathName
+
pname
;
try
{
String
fileType
=
FileTypeUtil
.
getType
(
file
.
getInputStream
());
// if (!StringUtils.equalsIgnoreCase(fileType, CommonConstants.ZIP_TYPE)) {
// return R.failed(ErrorCodes.IMPORT_FILE_TYPE_ERROR);
// }
List
list
=
new
ArrayList
();
File
file
=
new
File
(
pathName
);
zipFile
.
transferTo
(
file
);
// 获取解压出来的文件名 不带后缀
unZip
(
file
,
dec
);
//解析完成删除本次解析中生成的文件 删除此目录下的所有文件
deleteFile
(
dec
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
R
.
ok
();
}
etractFile
=
new
File
(
UUID
.
randomUUID
().
toString
());
unzip
=
ZipUtil
.
unzip
(
file
.
getInputStream
(),
etractFile
,
CharsetUtil
.
CHARSET_GBK
);
@Override
public
R
getEmpInfoByCard
(
String
idCard
)
{
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getOne
((
Wrappers
.<
TEmployeeInfo
>
query
().
lambda
()
.
eq
(
TEmployeeInfo:
:
getEmpIdcard
,
idCard
)));
if
(
Common
.
isNotNull
(
tEmployeeInfo
))
{
return
R
.
ok
(
tEmployeeInfo
);
}
return
R
.
failed
(
"未找到身份证号对应的档案信息"
);
}
ZipFile
zipFile
=
new
ZipFile
(
unzip
);
/**
* zip解压
* @param srcFile zip源文件
* @throws RuntimeException 解压失败会抛出运行时异常
*/
private
R
unZip
(
File
srcFile
,
String
destDirPath
)
throws
RuntimeException
{
for
(
Enumeration
<?
extends
ZipArchiveEntry
>
e
=
zipFile
.
getEntries
();
e
.
hasMoreElements
();)
{
ZipArchiveEntry
entry
=
e
.
nextElement
();
// 调用字典服务,渲染字典值
R
<
Map
<
String
,
Map
<
String
,
Map
<
String
,
String
>>>>
dictR
=
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
(),
daprUpmsProperties
.
getAppId
()
,
"/dict/inner/getDictToLable"
,
null
,
Map
.
class
,
SecurityConstants
.
FROM_IN
);
Map
<
String
,
Map
<
String
,
Map
<
String
,
String
>>>
dictMap
;
// 电子档案类型
Map
<
String
,
Map
<
String
,
String
>>
elecTypeMapData
;
Map
<
String
,
String
>
elecTypeMap
;
if
(
dictR
==
null
)
{
return
R
.
failed
(
"获取字典失败!"
);
}
else
{
dictMap
=
dictR
.
getData
();
elecTypeMapData
=
dictMap
.
get
(
"data"
);
elecTypeMap
=
elecTypeMapData
.
get
(
"elec_archives_type"
);
}
//记录解压出来的所有文件名
List
<
String
>
filesName
=
new
ArrayList
<>();
// 判断源文件是否存在
if
(!
srcFile
.
exists
())
{
throw
new
RuntimeException
(
srcFile
.
getPath
()
+
"所指文件不存在"
);
}
// 开始解压
ZipFile
zipFile
=
null
;
try
{
zipFile
=
new
ZipFile
(
srcFile
,
CharsetUtil
.
CHARSET_GBK
);
Enumeration
<?>
entries
=
zipFile
.
entries
();
if
(!
entry
.
isDirectory
()){
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
zipFile
.
getInputStream
(
entry
)));
while
(
entries
.
hasMoreElements
())
{
ZipEntry
entry
=
(
ZipEntry
)
entries
.
nextElement
();
//添加进filesName
String
empInfo
=
entry
.
getName
();
// 如果是文件夹,就创建个文件夹
if
(
entry
.
isDirectory
())
{
String
dirPath
=
destDirPath
+
"/"
+
entry
.
getName
();
File
dir
=
new
File
(
dirPath
);
dir
.
mkdirs
();
}
else
{
// 如果是文件,就先创建一个文件,然后用io流把内容copy过去
File
targetFile
=
new
File
(
destDirPath
+
"/"
+
entry
.
getName
());
String
line
=
""
;
// 保证这个文件的父文件夹必须要存在
if
(!
targetFile
.
getParentFile
().
exists
())
{
targetFile
.
getParentFile
().
mkdirs
();
}
targetFile
.
createNewFile
();
// 将压缩文件内容写入到这个文件中
InputStream
is
=
zipFile
.
getInputStream
(
entry
);
FileOutputStream
fos
=
new
FileOutputStream
(
targetFile
);
int
len
;
byte
[]
buf
=
new
byte
[
1024
];
while
((
len
=
is
.
read
(
buf
))
!=
-
1
)
{
fos
.
write
(
buf
,
0
,
len
);
}
while
((
line
=
br
.
readLine
())
!=
null
){
if
(
line
.
length
()
>
0
){
list
.
add
(
line
);
R
<
FileVo
>
fileVo
=
fileUploadService
.
uploadImg
(
fileCovertMultipartFile
(
targetFile
),
""
,
CommonConstants
.
EIGHT_INT
,
""
);
if
(
empInfo
.
length
()
>
empInfo
.
lastIndexOf
(
"/"
)
+
1
)
{
String
idCard
=
empInfo
.
substring
(
0
,
empInfo
.
indexOf
(
"/"
));
String
dataType
=
empInfo
.
substring
(
empInfo
.
indexOf
(
"/"
)
+
1
,
empInfo
.
lastIndexOf
(
"/"
));
String
empName
=
""
;
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getOne
((
Wrappers
.<
TEmployeeInfo
>
query
().
lambda
()
.
eq
(
TEmployeeInfo:
:
getEmpIdcard
,
idCard
)));
if
(
Common
.
isNotNull
(
tEmployeeInfo
))
{
empName
=
tEmployeeInfo
.
getEmpName
();
}
String
attachInfo
=
empInfo
.
substring
(
empInfo
.
lastIndexOf
(
"/"
)+
1
,
empInfo
.
length
());
TElecEmployeeInfo
tElecEmployeeInfo
=
new
TElecEmployeeInfo
();
tElecEmployeeInfo
.
setEmpIdcard
(
idCard
);
tElecEmployeeInfo
.
setEmpName
(
empName
);
tElecEmployeeInfo
.
setAttaInfo
(
attachInfo
);
if
(
Common
.
isNotNull
(
elecTypeMap
))
{
tElecEmployeeInfo
.
setDataType
(
elecTypeMap
.
get
(
dataType
));
}
tElecEmployeeInfo
.
setFileId
(
fileVo
.
getData
().
getUid
());
this
.
save
(
tElecEmployeeInfo
);
}
br
.
close
();
// 关流顺序,先打开的后关闭
fos
.
close
();
is
.
close
();
}
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"unzip error from ZipUtils"
,
e
);
}
finally
{
if
(
zipFile
!=
null
)
{
try
{
zipFile
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
etractFile
!=
null
)
{
FileUtil
.
del
(
etractFile
);
}
}
}
return
R
.
ok
();
}
/**
* File转MultipartFile
* @description: File转MultipartFile
* @param file 需要转换的文件
* @return: org.springframework.web.multipart.MultipartFile
* @author: huyc
* @date: 2022/6/27
*/
private
MultipartFile
fileCovertMultipartFile
(
File
file
)
{
FileItemFactory
factory
=
new
DiskFileItemFactory
(
16
,
null
);
FileItem
item
=
factory
.
createItem
(
file
.
getName
(),
"text/plain"
,
true
,
file
.
getName
());
int
bytesRead
=
0
;
byte
[]
buffer
=
new
byte
[
8192
];
try
{
FileInputStream
fis
=
new
FileInputStream
(
file
);
OutputStream
os
=
item
.
getOutputStream
();
while
((
bytesRead
=
fis
.
read
(
buffer
,
0
,
8192
))
!=
-
1
)
{
os
.
write
(
buffer
,
0
,
bytesRead
);
}
os
.
close
();
fis
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
MultipartFile
multipartFile
=
new
CommonsMultipartFile
(
item
);
return
multipartFile
;
}
/**
* 删除文件
*
* @param filePath
* @return
*/
public
static
boolean
deleteFile
(
String
filePath
)
{
boolean
flag
=
false
;
File
file
=
new
File
(
filePath
);
if
(!
file
.
exists
())
{
return
flag
;
}
if
(!
file
.
isDirectory
())
{
return
flag
;
}
String
[]
tempList
=
file
.
list
();
File
temp
;
for
(
int
i
=
0
;
i
<
tempList
.
length
;
i
++)
{
if
(
filePath
.
endsWith
(
File
.
separator
))
{
temp
=
new
File
(
filePath
+
tempList
[
i
]);
}
else
{
temp
=
new
File
(
filePath
+
File
.
separator
+
tempList
[
i
]);
}
if
(
temp
.
isFile
())
{
temp
.
delete
();
}
if
(
temp
.
isDirectory
())
{
// 先删除文件夹里面的文件
deleteFile
(
filePath
+
"/"
+
tempList
[
i
]);
// 再删除空文件夹
deleteFile
(
filePath
+
"/"
+
tempList
[
i
]);
flag
=
true
;
}
}
return
flag
;
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmpChangeInfoServiceImpl.java
View file @
f942dabe
...
...
@@ -20,7 +20,10 @@ import cn.hutool.core.collection.CollUtil;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.pig4cloud.plugin.excel.vo.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpChangeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpChangeInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TCustomerInfoService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmpChangeInfoService
;
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmpDisabilityInfoServiceImpl.java
View file @
f942dabe
...
...
@@ -18,6 +18,11 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.ArrayUtil
;
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.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
...
...
@@ -33,14 +38,14 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.DisabilitySearchVo;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpDisabilityExcelVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -49,6 +54,7 @@ import java.util.List;
* @author fxj
* @date 2022-06-18 09:39:46
*/
@Log4j2
@RequiredArgsConstructor
@Service
public
class
TEmpDisabilityInfoServiceImpl
extends
ServiceImpl
<
TEmpDisabilityInfoMapper
,
TEmpDisabilityInfo
>
implements
TEmpDisabilityInfoService
{
...
...
@@ -115,6 +121,14 @@ public class TEmpDisabilityInfoServiceImpl extends ServiceImpl<TEmpDisabilityInf
}
@Override
public
R
<
Boolean
>
saveDiy
(
TEmpDisabilityInfo
tEmpDisabilityInfo
)
{
TEmpDisabilityInfo
exist
=
baseMapper
.
selectOne
(
Wrappers
.<
TEmpDisabilityInfo
>
query
().
lambda
()
.
eq
(
TEmpDisabilityInfo:
:
getEmpIdcard
,
tEmpDisabilityInfo
.
getEmpIdcard
())
.
eq
(
TEmpDisabilityInfo:
:
getDisabilityName
,
tEmpDisabilityInfo
.
getDisabilityName
())
.
eq
(
TEmpDisabilityInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
)
.
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
Common
.
isNotNull
(
exist
)){
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
ARCHIVES_EMP_DISABILITY_NAME_EXISTING
));
}
tEmpDisabilityInfo
.
setDeleteFlag
(
CommonConstants
.
ZERO_STRING
);
int
res
=
baseMapper
.
insert
(
tEmpDisabilityInfo
);
if
(
res
>
CommonConstants
.
ZERO_INT
){
...
...
@@ -147,6 +161,80 @@ public class TEmpDisabilityInfoServiceImpl extends ServiceImpl<TEmpDisabilityInf
return
baseMapper
.
selectList
(
wrapper
);
}
@Override
public
R
<
Boolean
>
updateByIdDiy
(
TEmpDisabilityInfo
tEmpDisabilityInfo
)
{
TEmpDisabilityInfo
exist
=
baseMapper
.
selectOne
(
Wrappers
.<
TEmpDisabilityInfo
>
query
().
lambda
()
.
eq
(
TEmpDisabilityInfo:
:
getEmpIdcard
,
tEmpDisabilityInfo
.
getEmpIdcard
())
.
ne
(
TEmpDisabilityInfo:
:
getId
,
tEmpDisabilityInfo
.
getId
())
.
eq
(
TEmpDisabilityInfo:
:
getDisabilityName
,
tEmpDisabilityInfo
.
getDisabilityName
())
.
eq
(
TEmpDisabilityInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
)
.
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
Common
.
isNotNull
(
exist
)){
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
ARCHIVES_EMP_DISABILITY_NAME_EXISTING
));
}
baseMapper
.
updateById
(
tEmpDisabilityInfo
);
return
R
.
ok
();
}
@Override
public
R
<
List
<
ErrorMessage
>>
importTmpDisabilityDiy
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmpDisabilityExcelVO
>
util1
=
new
ExcelUtil
<>(
EmpDisabilityExcelVO
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
EmpDisabilityExcelVO
.
class
,
new
ReadListener
<
EmpDisabilityExcelVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmpDisabilityExcelVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmpDisabilityExcelVO
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
());
importTmpDisability
(
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
);
}
private
LambdaQueryWrapper
buildQueryWrapper
(
DisabilitySearchVo
entity
){
LambdaQueryWrapper
<
TEmpDisabilityInfo
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
TEmpDisabilityInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
);
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmpEducationServiceImpl.java
View file @
f942dabe
...
...
@@ -18,6 +18,11 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.ArrayUtil
;
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.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
...
...
@@ -35,15 +40,15 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -52,6 +57,7 @@ import java.util.List;
* @author fxj
* @date 2022-06-18 09:39:46
*/
@Log4j2
@RequiredArgsConstructor
@Service
public
class
TEmpEducationServiceImpl
extends
ServiceImpl
<
TEmpEducationMapper
,
TEmpEducation
>
implements
TEmpEducationService
{
...
...
@@ -157,30 +163,46 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
@Override
public
void
importEmpEducationUpdate
(
List
<
EmpEducationUpdateExcelVo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
List
<
TEmpEducation
>
list
=
this
.
list
();
TEmp
loyeeInfo
emp
;
TEmp
Education
t
emp
;
TEmpEducation
exist
;
ErrorMessage
errorMsg
;
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
// 已有验证报错直接下一个
EmpEducationUpdateExcelVo
excel
=
excelVOList
.
get
(
i
);
temp
=
baseMapper
.
selectOne
(
Wrappers
.<
TEmpEducation
>
query
().
lambda
()
.
eq
(
TEmpEducation:
:
getId
,
excel
.
getId
())
.
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
Common
.
isEmpty
(
temp
)){
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
PARAM_IS_NOT_ERROR
));
continue
;
}
exist
=
baseMapper
.
selectOne
(
Wrappers
.<
TEmpEducation
>
query
().
lambda
()
.
ne
(
TEmpEducation:
:
getId
,
excel
.
getId
())
.
eq
(
TEmpEducation:
:
getEmpIdcard
,
temp
.
getEmpIdcard
())
.
eq
(
TEmpEducation:
:
getEducationName
,
excel
.
getEducationName
())
.
eq
(
TEmpEducation:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
)
.
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
Common
.
isNotNull
(
exist
)){
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
MsgUtils
.
getMessage
(
ErrorCodes
.
ARCHIVES_EMP_EDUCATION_EXISTING
)));
continue
;
}
// 数据合法情况
updateExcel
(
excel
);
updateExcel
(
excel
,
temp
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
UPDATE_SUCCESS
));
}
}
private
void
updateExcel
(
EmpEducationUpdateExcelVo
excel
)
{
private
void
updateExcel
(
EmpEducationUpdateExcelVo
excel
,
TEmpEducation
temp
)
{
TEmpEducation
update
=
new
TEmpEducation
();
BeanUtil
.
copyProperties
(
excel
,
update
);
if
(
Common
.
isNotNull
(
temp
)){
update
.
setEmpId
(
temp
.
getEmpId
());
update
.
setEmpIdcard
(
temp
.
getEmpIdcard
());
update
.
setEmpName
(
temp
.
getEmpName
());
update
.
setEmpCode
(
temp
.
getEmpCode
());
}
// 更新档案学历信息
updateEducationOfEmp
(
update
);
this
.
updateById
(
update
);
...
...
@@ -213,6 +235,8 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
updateVo
.
setIsCollege
(
CommonConstants
.
ONE_INT
);
}
employeeInfoMapper
.
updateEducationOfEmp
(
updateVo
);
// 所有学历更新为非最高学历
baseMapper
.
updateHighIdentification
(
education
.
getEmpIdcard
());
}
}
...
...
@@ -277,6 +301,123 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
}
return
baseMapper
.
selectList
(
wrapper
);
}
@Override
public
R
<
List
<
ErrorMessage
>>
importEmpEducationDiy
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmpEducationExcelVO
>
util1
=
new
ExcelUtil
<>(
EmpEducationExcelVO
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
EmpEducationExcelVO
.
class
,
new
ReadListener
<
EmpEducationExcelVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmpEducationExcelVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmpEducationExcelVO
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
());
importEmpEducation
(
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
);
}
@Override
public
R
<
List
<
ErrorMessage
>>
importEmpEducationUpdateDiy
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmpEducationUpdateExcelVo
>
util1
=
new
ExcelUtil
<>(
EmpEducationUpdateExcelVo
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
EmpEducationUpdateExcelVo
.
class
,
new
ReadListener
<
EmpEducationUpdateExcelVo
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmpEducationUpdateExcelVo
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmpEducationUpdateExcelVo
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
());
importEmpEducationUpdate
(
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
);
}
private
LambdaQueryWrapper
buildQueryWrapper
(
EducationSearchVo
entity
){
LambdaQueryWrapper
<
TEmpEducation
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
TEmpEducation:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
);
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmpFamilyServiceImpl.java
View file @
f942dabe
...
...
@@ -19,6 +19,11 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.ArrayUtil
;
import
cn.hutool.core.util.StrUtil
;
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.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
...
...
@@ -35,15 +40,15 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpFamilyExcelVO;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.FamilySearchVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -52,6 +57,7 @@ import java.util.List;
* @author fxj
* @date 2022-06-18 09:39:46
*/
@Log4j2
@RequiredArgsConstructor
@Service
public
class
TEmpFamilyServiceImpl
extends
ServiceImpl
<
TEmpFamilyMapper
,
TEmpFamily
>
implements
TEmpFamilyService
{
...
...
@@ -161,6 +167,63 @@ public class TEmpFamilyServiceImpl extends ServiceImpl<TEmpFamilyMapper, TEmpFam
return
baseMapper
.
selectList
(
wrapper
);
}
@Override
public
R
<
List
<
ErrorMessage
>>
importEmpFamilyDiy
(
InputStream
fileInputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmpFamilyExcelVO
>
util1
=
new
ExcelUtil
<>(
EmpFamilyExcelVO
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
fileInputStream
,
EmpFamilyExcelVO
.
class
,
new
ReadListener
<
EmpFamilyExcelVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmpFamilyExcelVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmpFamilyExcelVO
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
());
importEmpFamily
(
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
);
}
private
LambdaQueryWrapper
buildQueryWrapper
(
FamilySearchVO
entity
){
LambdaQueryWrapper
<
TEmpFamily
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
TEmpFamily:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
);
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmpProfessionalQualificationServiceImpl.java
View file @
f942dabe
...
...
@@ -18,6 +18,11 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.ArrayUtil
;
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.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
...
...
@@ -33,14 +38,14 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.CertifySearchVo;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpCertificateExcelVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -49,6 +54,7 @@ import java.util.List;
* @author fxj
* @date 2022-06-18 09:39:46
*/
@Log4j2
@RequiredArgsConstructor
@Service
public
class
TEmpProfessionalQualificationServiceImpl
extends
ServiceImpl
<
TEmpProfessionalQualificationMapper
,
TEmpProfessionalQualification
>
implements
TEmpProfessionalQualificationService
{
...
...
@@ -151,6 +157,64 @@ public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpPr
wrapper
.
orderByDesc
(
BaseEntity:
:
getCreateTime
);
return
baseMapper
.
selectPage
(
page
,
wrapper
);
}
@Override
public
R
<
List
<
ErrorMessage
>>
importEmpCertificateDiy
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmpCertificateExcelVO
>
util1
=
new
ExcelUtil
<>(
EmpCertificateExcelVO
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
EmpCertificateExcelVO
.
class
,
new
ReadListener
<
EmpCertificateExcelVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmpCertificateExcelVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmpCertificateExcelVO
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
());
importEmpCertificate
(
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
);
}
private
LambdaQueryWrapper
buildQueryWrapper
(
CertifySearchVo
entity
){
LambdaQueryWrapper
<
TEmpProfessionalQualification
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
TEmpProfessionalQualification:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
);
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmpWorkRecordingServiceImpl.java
View file @
f942dabe
...
...
@@ -19,6 +19,11 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.ArrayUtil
;
import
cn.hutool.core.util.StrUtil
;
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.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
...
...
@@ -34,14 +39,14 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpWorkRecordExcelVO;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.WorkRecordSearchVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -50,6 +55,7 @@ import java.util.List;
* @author fxj
* @date 2022-06-18 09:39:46
*/
@Log4j2
@RequiredArgsConstructor
@Service
public
class
TEmpWorkRecordingServiceImpl
extends
ServiceImpl
<
TEmpWorkRecordingMapper
,
TEmpWorkRecording
>
implements
TEmpWorkRecordingService
{
...
...
@@ -185,6 +191,64 @@ public class TEmpWorkRecordingServiceImpl extends ServiceImpl<TEmpWorkRecordingM
return
baseMapper
.
selectList
(
wrapper
);
}
@Override
public
R
<
List
<
ErrorMessage
>>
importEmpWorkRecordDiy
(
InputStream
inputStream
)
{
List
<
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
util
.
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmpWorkRecordExcelVO
>
util1
=
new
ExcelUtil
<>(
EmpWorkRecordExcelVO
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
EmpWorkRecordExcelVO
.
class
,
new
ReadListener
<
EmpWorkRecordExcelVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmpWorkRecordExcelVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmpWorkRecordExcelVO
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
());
importEmpWorkRecord
(
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
);
}
private
LambdaQueryWrapper
buildQueryWrapper
(
WorkRecordSearchVO
entity
){
LambdaQueryWrapper
<
TEmpWorkRecording
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
TEmpWorkRecording:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
);
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeProjectServiceImpl.java
View file @
f942dabe
...
...
@@ -572,6 +572,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//获取记录
list
=
gettEmpProInfoExportVos
(
idstr
,
projectDTO
);
if
(
Common
.
isNotNull
(
list
)){
ExcelUtil
<
EmployeeProjectExportVO
>
util
=
new
ExcelUtil
<>(
EmployeeProjectExportVO
.
class
);
for
(
EmployeeProjectExportVO
vo:
list
){
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
}
ServletOutputStream
out
=
null
;
try
{
if
(
list
.
size
()>
0
)
{
...
...
@@ -580,7 +587,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename*=utf-8'zh_cn'"
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel
.
write
(
fileName
,
EmployeeProjectExportVO
.
class
).
includeColumnFiledNames
(
includeColumnFiledNames
).
sheet
(
"项目档案"
)
EasyExcel
.
write
(
out
,
EmployeeProjectExportVO
.
class
).
includeColumnFiledNames
(
includeColumnFiledNames
).
sheet
(
"项目档案"
)
.
doWrite
(
list
);
out
.
flush
();
}
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TEmployeeProjectMapper.xml
View file @
f942dabe
...
...
@@ -88,7 +88,9 @@
<result
property=
"unitNo"
column=
"UNIT_NO"
/>
<result
property=
"deptName"
column=
"DEPT_NAME"
/>
<result
property=
"deptNo"
column=
"DEPT_NO"
/>
<result
property=
"businessType"
column=
"BUSINESS_TYPE"
/>
<result
property=
"businessPrimaryType"
column=
"BUSINESS_PRIMARY_TYPE"
/>
<result
property=
"businessSecondType"
column=
"BUSINESS_SECOND_TYPE"
/>
<result
property=
"businessThirdType"
column=
"BUSINESS_THIRD_TYPE"
/>
<result
property=
"contractType"
column=
"CONTRACT_TYPE"
/>
<result
property=
"workingHours"
column=
"WORKING_HOURS"
/>
<result
property=
"post"
column=
"POST"
/>
...
...
@@ -175,7 +177,9 @@
a.UNIT_NO,
a.DEPT_NAME,
a.DEPT_NO,
concat(a.BUSINESS_PRIMARY_TYPE,'/',BUSINESS_SECOND_TYPE,'/',a.BUSINESS_THIRD_TYPE) AS BUSINESS_TYPE,
a.BUSINESS_PRIMARY_TYPE,
a.BUSINESS_SECOND_TYPE,
a.BUSINESS_THIRD_TYPE,
a.CONTRACT_TYPE,
a.WORKING_HOURS,
a.POST,
...
...
@@ -462,9 +466,9 @@
<if
test=
"tEmployeeProject.fileTown != null"
>
AND b.FILE_TOWN = #{tEmployeeProject.fileTown}
</if>
<if
test=
"tEmployee
Info
.idList != null"
>
<if
test=
"tEmployee
Project
.idList != null"
>
AND a.id in
<foreach
item=
"idStr"
index=
"index"
collection=
"tEmployee
Info
.idList"
open=
"("
separator=
","
close=
")"
>
<foreach
item=
"idStr"
index=
"index"
collection=
"tEmployee
Project
.idList"
open=
"("
separator=
","
close=
")"
>
#{idStr}
</foreach>
</if>
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/CommonConstants.java
View file @
f942dabe
...
...
@@ -255,4 +255,5 @@ public interface CommonConstants {
String
IMPORT_DATA_ANALYSIS_ERROR
=
"数据导入解析异常,请检查表数据格式"
;
String
CREATE_TIME
=
"create_time"
;
String
ID
=
"ID"
;
String
PARAM_IS_NOT_ERROR
=
"传参异常,请检查参数"
;
}
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/ExcelAttribute.java
View file @
f942dabe
...
...
@@ -153,7 +153,7 @@ public @interface ExcelAttribute {
* 日期格式化字符串
* @return
*/
public
abstract
String
dateFormat
()
default
"
YYYY
-MM-dd"
;
public
abstract
String
dateFormat
()
default
"
yyyy
-MM-dd"
;
/**
* 日期格式化字符串
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/util/ExcelUtil.java
View file @
f942dabe
...
...
@@ -13,10 +13,7 @@ import java.math.BigDecimal;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
/**
* @Author fxj
...
...
@@ -41,6 +38,155 @@ public class ExcelUtil <T> implements Serializable {
}
private
Field
[]
fields
;
public
void
convertEntity
(
T
vo
,
String
[]
exportFields
,
Map
<
String
,
String
>
diyDicMap
,
String
dateFormat
)
{
// 得到所有定义字段
Field
[]
allFields
=
clazz
.
getDeclaredFields
();
List
<
Field
>
fields
=
new
ArrayList
<
Field
>();
Class
<?>
superClazz
=
clazz
.
getSuperclass
();
// 得到所有field并存放到一个list中
for
(
Field
field
:
allFields
)
{
if
(
field
.
isAnnotationPresent
(
ExcelAttribute
.
class
))
{
fields
.
add
(
field
);
}
}
if
(
superClazz
!=
null
)
{
Field
[]
superFields
=
superClazz
.
getDeclaredFields
();
for
(
Field
field
:
superFields
)
{
if
(
field
.
isAnnotationPresent
(
ExcelAttribute
.
class
))
{
fields
.
add
(
field
);
}
}
}
fields
=
getFiledsByParamFiled
(
fields
,
exportFields
);
ExcelAttribute
attr
;
Field
field
;
//分割符
String
divider
;
for
(
int
j
=
0
;
j
<
fields
.
size
();
j
++)
{
// 获得field
field
=
fields
.
get
(
j
);
// 设置实体类私有属性可访问
field
.
setAccessible
(
true
);
attr
=
field
.
getAnnotation
(
ExcelAttribute
.
class
);
if
(
attr
.
isExport
())
{
// 如果数据存在就填入,不存在填入空格
Class
<?>
classType
=
field
.
getType
();
String
value
=
null
;
Date
date
;
try
{
if
(
field
.
get
(
vo
)
!=
null
&&
(
classType
.
isAssignableFrom
(
Date
.
class
)
||
classType
.
isAssignableFrom
(
LocalDateTime
.
class
)
||
classType
.
isAssignableFrom
(
LocalDate
.
class
)))
{
if
(
Common
.
isNotNull
(
attr
.
dateFormatExport
()))
{
date
=
DateUtil
.
stringToDate2
(
String
.
valueOf
(
field
.
get
(
vo
)),
attr
.
dateFormatExport
());
if
(
classType
.
isAssignableFrom
(
LocalDateTime
.
class
)){
value
=
LocalDateTimeUtils
.
formatTime
((
LocalDateTime
)
field
.
get
(
vo
),
attr
.
dateFormatExport
());
}
else
{
value
=
DateUtil
.
dateToString
(
date
,
attr
.
dateFormatExport
());
}
}
else
{
date
=
DateUtil
.
stringToDate2
(
String
.
valueOf
(
field
.
get
(
vo
)),
!
Common
.
isNotNull
(
dateFormat
)
?
DateUtil
.
ISO_EXPANDED_DATE_FORMAT
:
dateFormat
);
if
(
classType
.
isAssignableFrom
(
LocalDateTime
.
class
)){
value
=
LocalDateTimeUtils
.
formatTime
((
LocalDateTime
)
field
.
get
(
vo
),!
Common
.
isNotNull
(
dateFormat
)
?
DateUtil
.
ISO_EXPANDED_DATE_FORMAT
:
dateFormat
);
}
else
{
value
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
date
,
!
Common
.
isNotNull
(
dateFormat
)
?
DateUtil
.
ISO_EXPANDED_DATE_FORMAT
:
dateFormat
);
}
}
}
//如果有默认字典数据直接取值
if
(
Common
.
isNotNull
(
attr
.
readConverterExp
()))
{
value
=
convertByExp
(
field
.
get
(
vo
)
==
null
?
""
:
String
.
valueOf
(
field
.
get
(
vo
)),
attr
.
readConverterExp
());
}
else
if
(
attr
.
isDataId
())
{
//加入分割符逻辑
divider
=
attr
.
divider
();
if
(!
""
.
equals
(
divider
)
&&
field
.
get
(
vo
)
!=
null
)
{
//如果是字典数据ID或区域ID 去dicMap(包含了区域) 取值 取不到返回空
value
=
getLableById
(
attr
,
diyDicMap
,
field
.
get
(
vo
)
==
null
?
""
:
String
.
valueOf
(
field
.
get
(
vo
)));
}
}
else
if
(
attr
.
isArea
()){
//区域字段处理 TODO
if
(!
Common
.
isNotNull
(
attr
.
parentField
()))
{
value
=
getAreaLabel
(
"area_"
+
field
.
get
(
vo
)
+
"_0"
,
attr
);
}
else
{
// TODO
value
=
getAreaLabel
(
"area_"
+
field
.
get
(
vo
)+
"_"
+
getFieldValueByName
(
attr
.
parentField
(),
vo
,
null
),
attr
);
}
}
field
.
set
(
vo
,
Common
.
isNotNull
(
value
)?
value:
field
.
get
(
vo
));
}
catch
(
Exception
e
){
log
.
error
(
"字典数据解析异常"
);
}
}
}
}
/**
* 通过标志_字典ID的方式去dicMap 取值
*
* @param attr
* @param dicMap 字典值 key: 类型标识_ID value:实际要导出的内容
* @param value 对应字段的ID值
* @return
* @Author fxj
* @Date 2019-08-06
**/
private
String
getLableById
(
ExcelAttribute
attr
,
Map
<
String
,
String
>
dicMap
,
String
value
)
{
String
tempValue
=
null
;
if
(
null
!=
dicMap
&&
dicMap
.
size
()
>
0
&&
Common
.
isNotNull
(
value
))
{
if
(
Common
.
isNotNull
(
attr
.
dataType
()))
{
tempValue
=
dicMap
.
get
(
attr
.
dataType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
value
);
if
(
Common
.
isEmpty
(
tempValue
)){
tempValue
=
dicMap
.
get
(
attr
.
dataType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
"id"
+
CommonConstants
.
DOWN_LINE_STRING
+
value
);
}
}
else
{
tempValue
=
dicMap
.
get
(
value
);
}
}
// 默认字典获取不到 去 缓存获取
if
(
Common
.
isEmpty
(
tempValue
)){
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
())){
tempValue
=
entry
.
getValue
();
break
;
}
}
}
return
tempValue
;
}
/**
* 返回传参对应的fileds
*
* @param fields
* @param paramFields
* @return
* @Author fxj
* @Date 2019-08-05
**/
private
List
<
Field
>
getFiledsByParamFiled
(
List
<
Field
>
fields
,
String
[]
paramFields
)
{
List
<
Field
>
fieldsTemp
=
new
ArrayList
<
Field
>();
List
<
String
>
attrName
=
new
ArrayList
();
//存中文名 wangan修改
if
(
null
!=
paramFields
&&
paramFields
.
length
>
0
)
{
ExcelAttribute
attr
;
Field
field
;
for
(
int
j
=
0
;
j
<
paramFields
.
length
;
j
++)
{
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
field
=
fields
.
get
(
i
);
attr
=
field
.
getAnnotation
(
ExcelAttribute
.
class
);
//如果有同样的中文名数据字段,后面不再添加。 wangan修改
if
(!
attrName
.
contains
(
attr
.
name
()))
{
if
(
attr
.
name
().
equals
(
paramFields
[
j
]))
{
fieldsTemp
.
add
(
field
);
attrName
.
add
(
attr
.
name
());
break
;
}
}
}
}
}
else
{
return
fields
;
}
return
fieldsTemp
;
}
public
ErrorMessage
checkEntity
(
T
data
,
Integer
rowNum
)
{
if
(!
Common
.
isNotNull
(
fields
)){
return
null
;
...
...
@@ -85,7 +231,7 @@ public class ExcelUtil <T> implements Serializable {
//如果是需要从字典表取值数据的话在这里处理即可
if
(
Common
.
isNotNull
(
attr
.
readConverterExp
()))
{
tempStr
=
reverseByExp
(
c
,
attr
.
readConverterExp
());
c
=
reverseByExp
(
c
,
attr
.
readConverterExp
());
}
else
if
(
attr
.
isDataId
())
{
if
(
Common
.
isNotNull
(
attr
.
dataType
()))
{
//非区域字段处理 TODO
...
...
@@ -100,7 +246,7 @@ public class ExcelUtil <T> implements Serializable {
if
(
attr
.
isArea
())
{
//区域字段处理 TODO
if
(!
Common
.
isNotNull
(
attr
.
parentField
()))
{
tempStr
=
getDicValue
(
"area_"
+
c
.
trim
()
+
"_0"
,
tempStr
,
attr
,
rowNum
,
errorTemp
);
tempStr
=
getDicValue
(
"area_"
+
c
.
trim
(),
tempStr
,
attr
,
rowNum
,
errorTemp
);
}
else
{
// TODO
tempStr
=
getDicValue
(
"area_"
+
c
.
trim
()+
"_"
+
getFieldValueByName
(
attr
.
parentField
(),
data
,
DateUtil
.
ISO_EXPANDED_DATE_FORMAT
),
tempStr
,
attr
,
rowNum
,
errorTemp
);
...
...
@@ -124,7 +270,8 @@ public class ExcelUtil <T> implements Serializable {
}
}
continue
;
}
else
{
}
if
(
Common
.
isNotNull
(
tempStr
)){
c
=
tempStr
;
}
}
...
...
@@ -139,7 +286,7 @@ public class ExcelUtil <T> implements Serializable {
c
=
c
.
indexOf
(
'%'
)
!=
-
1
?
c
.
replace
(
"%"
,
""
)
:
c
;
field
.
set
(
data
,
BigDecimal
.
valueOf
(
Double
.
valueOf
(
c
)));
}
else
if
(
Date
.
class
==
fieldType
&&
Common
.
isNotNull
(
c
.
trim
()))
{
field
.
set
(
data
,
DateUtil
.
stringTo
Date
(
c
.
trim
(),
Common
.
isEmpty
(
attr
.
dateFormat
())
?
DateUtil
.
ISO_EXPANDED_DATE_FORMAT
:
attr
.
dateFormat
()));
field
.
set
(
data
,
DateUtil
.
parse
Date
(
c
.
trim
(),
Common
.
isEmpty
(
attr
.
dateFormat
())
?
DateUtil
.
ISO_EXPANDED_DATE_FORMAT
:
attr
.
dateFormat
()));
}
else
if
((
Integer
.
TYPE
==
fieldType
)
||
(
Integer
.
class
==
fieldType
))
{
field
.
set
(
data
,
Integer
.
parseInt
(
c
));
}
else
if
((
Long
.
TYPE
==
fieldType
)
||
(
Long
.
class
==
fieldType
))
{
...
...
@@ -194,7 +341,7 @@ public class ExcelUtil <T> implements Serializable {
return
errorMessageHashMap
.
get
(
rowNum
);
}
/**
* 例如:解析值 0=男,1=女,2=未知
* 例如:解析值 0=男,1=女,2=未知
传参 男解析为 0
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
...
...
@@ -202,6 +349,46 @@ public class ExcelUtil <T> implements Serializable {
* @throws Exception
*/
public
static
String
reverseByExp
(
String
propertyValue
,
String
converterExp
)
throws
Exception
{
try
{
String
[]
convertSource
=
converterExp
.
split
(
","
);
if
(
propertyValue
.
contains
(
","
)){
String
[]
valueSource
=
propertyValue
.
split
(
","
);
propertyValue
=
""
;
for
(
String
value:
valueSource
){
for
(
String
item
:
convertSource
)
{
String
[]
itemArray
=
item
.
split
(
"="
);
if
(
itemArray
[
1
].
equals
(
value
))
{
propertyValue
+=
itemArray
[
0
]
+
","
;
break
;
}
}
}
if
(
propertyValue
.
endsWith
(
","
)){
propertyValue
=
propertyValue
.
substring
(
CommonConstants
.
dingleDigitIntArray
[
0
],
propertyValue
.
length
()-
1
);
}
}
else
{
for
(
String
item
:
convertSource
)
{
String
[]
itemArray
=
item
.
split
(
"="
);
if
(
itemArray
[
1
].
equals
(
propertyValue
))
{
return
itemArray
[
0
];
}
}
}
}
catch
(
Exception
e
)
{
throw
e
;
}
return
propertyValue
;
}
/**
* 例如:解析值 0=男,1=女,2=未知 传参 0解析为 男
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @return 解析后值
* @throws Exception
*/
public
static
String
convertByExp
(
String
propertyValue
,
String
converterExp
)
throws
Exception
{
try
{
String
[]
convertSource
=
converterExp
.
split
(
","
);
if
(
propertyValue
.
contains
(
","
)){
...
...
@@ -232,6 +419,15 @@ public class ExcelUtil <T> implements Serializable {
}
return
propertyValue
;
}
private
String
getAreaLabel
(
String
c
,
ExcelAttribute
attr
)
{
Map
<
String
,
String
>
dicObj
=
(
Map
<
String
,
String
>)
RedisUtil
.
redis
.
opsForValue
().
get
(
attr
.
dataType
());
for
(
Map
.
Entry
<
String
,
String
>
entry:
dicObj
.
entrySet
()){
if
(
Common
.
isNotNull
(
entry
.
getValue
())
&&
entry
.
getValue
().
equals
(
c
.
trim
())){
return
entry
.
getKey
();
}
}
return
null
;
}
private
String
getDicValue
(
String
c
,
String
tempStr
,
ExcelAttribute
attr
,
Integer
rowNum
,
ErrorMessage
errorTemp
)
{
Map
<
String
,
String
>
dicObj
=
(
Map
<
String
,
String
>)
RedisUtil
.
redis
.
opsForValue
().
get
(
attr
.
dataType
());
boolean
flag
=
true
;
...
...
yifu-common/yifu-common-core/src/main/resources/i18n/messages_zh_CN.properties
View file @
f942dabe
...
...
@@ -39,14 +39,14 @@ sys.role.update.error.code.exist="\u5DF2\u5B58\u5728\u5BF9\u5E94\u6807\u8BC6\u76
sys.role.delete.existing.user
=
\u
8BE5
\u
89D2
\u8272\u
4E0B
\u
8FD8
\u6709\u5173\u8054\u7684\u7528\u6237\u
FF0C
\u
8BF7
\u5148\u
5C06
\u7528\u6237\u
8F6C
\u
79FB
\u5230\u5176\u
4ED6
\u
89D2
\u8272
!
archives.emp.disability.name.existing
=
\u
5DF2
\u
5B58
\u5728\u
5BF9
\u
5E94
\u
4F24
\u
6B8B
\u
75C5
\u
540D
\u
79F0
\u7684\u6570\u
636E
archives.emp.disability.name.existing
=
\u
8BE5
\u5458\u
5DE5
\u
5DF2
\u
5B58
\u5728\u
5BF9
\u
5E94
\u
4F24
\u
6B8B
\u
75C5
\u
540D
\u
79F0
\u7684\u6570\u
636E
archives.emp.family.name.existing
=
\u
5DF2
\u
5B58
\u5728\u
5BF9
\u
5E94
\u
8EAB
\u
4EFD
\u
8BC1
\u7684\u
5BB6
\u
5EAD
\u6210\u5458\u
4FE1
\u
606F
archives.emp.family.name.existing
=
\u
8BE5
\u5458\u
5DE5
\u
5DF2
\u
5B58
\u5728\u
5BF9
\u
5E94
\u
8EAB
\u
4EFD
\u
8BC1
\u7684\u
5BB6
\u
5EAD
\u6210\u5458\u
4FE1
\u
606F
archives.emp.not.exist
=
\u
65E0
\u
5BF9
\u
5E94
\u
8EAB
\u
4EFD
\u
8BC1
\u7684\u5458\u
5DE5
\u
4FE1
\u
606F
archives.emp.reduced
=
\u5458\u
5DE5
\u
5DF2
\u
51CF
\u6863
archives.emp.work.record.existing
=
\u
5DF2
\u
5B58
\u5728\u
5BF9
\u
5E94
\u
8EAB
\u
4EFD
\u
8BC1
\u7684\u
5DE5
\u
4F5C
\u
8BB0
\u
5F55
\u
4FE1
\u
606F
archives.emp.education.existing
=
\u
5DF2
\u
5B58
\u5728\u
8BE5
\u5458\u
5DE5
\u
5BF9
\u
5E94
\u
5B66
\u5386\u
540D
\u
79F0
\u7684\u
5B66
\u5386\u
4FE1
\u
606F
archives.emp.work.record.existing
=
\u
8BE5
\u5458\u
5DE5
\u
5DF2
\u
5B58
\u5728\u
5BF9
\u
5E94
\u
8EAB
\u
4EFD
\u
8BC1
\u7684\u
5DE5
\u
4F5C
\u
8BB0
\u
5F55
\u
4FE1
\u
606F
archives.emp.education.existing
=
\u
8BE5
\u5458\u
5DE5
\u
5DF2
\u
5B58
\u5728\u
8BE5
\u5458\u
5DE5
\u
5BF9
\u
5E94
\u
5B66
\u5386\u
540D
\u
79F0
\u7684\u
5B66
\u5386\u
4FE1
\u
606F
param.not.empty
=
\u
53C2
\u6570\u
4E0D
\u
53EF
\u
4E3A
\u
7A7A
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/controller/DictController.java
View file @
f942dabe
...
...
@@ -311,7 +311,7 @@ public class DictController {
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.String, java.util.Map < java.lang.String, java.lang.String>>>
**/
@Inner
@
Ge
tMapping
(
"/inner/getDictToLable"
)
@
Pos
tMapping
(
"/inner/getDictToLable"
)
public
R
<
Map
<
String
,
Map
<
String
,
String
>>>
getDictToLable
()
{
return
sysDictItemService
.
getDictToLable
();
}
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/init/DictItemRedisInit.java
View file @
f942dabe
...
...
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -46,10 +47,23 @@ public class DictItemRedisInit {
log
.
info
(
"区域数据加入缓存初始化开始..."
);
List
<
SysArea
>
allAreas
=
sysAreaService
.
getAllArea
();
if
(
Common
.
isNotNull
(
allAreas
)){
Map
<
String
,
SysArea
>
areaMap
=
new
HashMap
<>();
for
(
SysArea
area:
allAreas
){
redisUtil
.
set
(
"area_"
+
area
.
getId
()
+
CommonConstants
.
DOWN_LINE_STRING
+(
Common
.
isEmpty
(
area
.
getParentId
())?
"0"
:
area
.
getParentId
()),
area
.
getId
());
+(
Common
.
isEmpty
(
area
.
getParentId
())?
"0"
:
area
.
getParentId
()),
area
.
getAreaName
());
areaMap
.
put
(
area
.
getId
().
toString
(),
area
);
}
SysArea
temp
;
for
(
SysArea
area:
allAreas
){
if
(
Common
.
isNotNull
(
area
.
getParentId
())
&&
area
.
getParentId
().
intValue
()
>
0
){
temp
=
areaMap
.
get
(
area
.
getParentId
());
redisUtil
.
set
(
"area_"
+
area
.
getAreaName
()
+
CommonConstants
.
DOWN_LINE_STRING
+(
Common
.
isNotNull
(
temp
)?
temp
.
getAreaName
():
""
),
area
.
getId
());
}
else
{
redisUtil
.
set
(
"area_"
+
area
.
getAreaName
(),
area
.
getId
());
}
}
}
log
.
info
(
"区域数据加入缓存初始化结束..."
);
...
...
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