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
38d802ac
Commit
38d802ac
authored
Mar 12, 2026
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
入离职模版导入调整-fxj
parent
e14919cd
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
342 additions
and
3 deletions
+342
-3
ArchivesDaprUtil.java
...cloud/plus/v1/yifu/common/dapr/util/ArchivesDaprUtil.java
+2
-2
EmployeeRegistrationNewVo.java
.../yifu/cloud/plus/v1/csp/vo/EmployeeRegistrationNewVo.java
+98
-0
EmployeeRegistrationController.java
...lus/v1/csp/controller/EmployeeRegistrationController.java
+15
-0
EmployeeRegistrationService.java
...loud/plus/v1/csp/service/EmployeeRegistrationService.java
+7
-0
EmployeeRegistrationServiceImpl.java
.../v1/csp/service/impl/EmployeeRegistrationServiceImpl.java
+220
-1
No files found.
yifu-common/yifu-common-dapr/src/main/java/com/yifu/cloud/plus/v1/yifu/common/dapr/util/ArchivesDaprUtil.java
View file @
38d802ac
...
@@ -111,9 +111,9 @@ public class ArchivesDaprUtil {
...
@@ -111,9 +111,9 @@ public class ArchivesDaprUtil {
* @Param
* @Param
* @return
* @return
**/
**/
public
R
<
TSettleDomainSelectVo
>
getSettleDomainSelectVoById
(
String
depart
Id
){
public
R
<
TSettleDomainSelectVo
>
getSettleDomainSelectVoById
(
String
depart
No
){
TSettleDomainSelectVo
settleDomainSelectVo
=
new
TSettleDomainSelectVo
();
TSettleDomainSelectVo
settleDomainSelectVo
=
new
TSettleDomainSelectVo
();
settleDomainSelectVo
.
setDepartNo
(
depart
Id
);
settleDomainSelectVo
.
setDepartNo
(
depart
No
);
R
<
TSettleDomainSelectVo
>
res
=
HttpDaprUtil
.
invokeMethodPost
(
daprArchivesProperties
.
getAppUrl
(),
daprArchivesProperties
.
getAppId
(),
"/tsettledomain/getSettleDomainSelectVoById"
,
settleDomainSelectVo
,
TSettleDomainSelectVo
.
class
,
SecurityConstants
.
FROM_IN
);
R
<
TSettleDomainSelectVo
>
res
=
HttpDaprUtil
.
invokeMethodPost
(
daprArchivesProperties
.
getAppUrl
(),
daprArchivesProperties
.
getAppId
(),
"/tsettledomain/getSettleDomainSelectVoById"
,
settleDomainSelectVo
,
TSettleDomainSelectVo
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
Common
.
isEmpty
(
res
)){
if
(
Common
.
isEmpty
(
res
)){
return
R
.
failed
(
"获取派单校验需要的档案信息失败!"
);
return
R
.
failed
(
"获取派单校验需要的档案信息失败!"
);
...
...
yifu-csp/yifu-csp-api/src/main/java/com/yifu/cloud/plus/v1/csp/vo/EmployeeRegistrationNewVo.java
0 → 100644
View file @
38d802ac
package
com
.
yifu
.
cloud
.
plus
.
v1
.
csp
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.HeadFontStyle
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 入离职登记表
*
* @author huych
* @date 2025-02-25 14:48:11
*/
@Data
public
class
EmployeeRegistrationNewVo
extends
RowIndex
implements
Serializable
{
/**
* 项目名称
*/
@ExcelAttribute
(
name
=
"项目名称"
,
isNotEmpty
=
false
,
errorInfo
=
"项目名称不能为空"
,
maxLength
=
20
)
@ExcelProperty
(
value
=
"项目名称"
)
@Schema
(
name
=
"项目名称"
)
private
String
deptName
;
/**
* 项目编码
*/
@ExcelAttribute
(
name
=
"项目编码"
,
isNotEmpty
=
true
,
errorInfo
=
"项目编码不能为空"
,
maxLength
=
20
)
@ExcelProperty
(
value
=
"项目编码"
)
@Schema
(
name
=
"项目编码"
)
private
String
deptNo
;
/**
* 员工姓名
*/
@NotBlank
(
message
=
"员工姓名 不能为空"
)
@Length
(
max
=
20
,
message
=
"员工姓名 不能超过20个字符"
)
@ExcelAttribute
(
name
=
"员工姓名"
,
isNotEmpty
=
true
,
errorInfo
=
"员工姓名不能为空"
,
maxLength
=
20
)
@Schema
(
description
=
"员工姓名"
)
@ExcelProperty
(
"员工姓名"
)
private
String
employeeName
;
/**
* 身份证号
*/
@NotBlank
(
message
=
"身份证号不能为空"
)
@Length
(
max
=
18
,
message
=
"身份证号不能超过18个字符"
)
@ExcelAttribute
(
name
=
"身份证号"
,
isNotEmpty
=
true
,
errorInfo
=
"身份证号不能为空"
,
maxLength
=
18
)
@Schema
(
description
=
"身份证号"
)
@ExcelProperty
(
"身份证号"
)
private
String
empIdcard
;
/**
* 员工手机号
*/
@NotBlank
(
message
=
"员工手机号 不能为空"
)
@Length
(
max
=
11
,
message
=
"员工手机号不能超过11个字符"
)
@ExcelAttribute
(
name
=
"员工手机号"
,
isNotEmpty
=
true
,
errorInfo
=
"员工手机号不能为空"
,
maxLength
=
11
)
@Schema
(
description
=
"员工手机号"
)
@ExcelProperty
(
"员工手机号"
)
private
String
empPhone
;
/**
* 岗位
*/
@Length
(
max
=
50
,
message
=
"岗位不能超过50个字符"
)
@NotBlank
(
message
=
"岗位不能为空"
)
@ExcelAttribute
(
name
=
"岗位"
,
maxLength
=
50
,
isNotEmpty
=
true
,
errorInfo
=
"岗位不能为空"
)
@Schema
(
description
=
"岗位"
)
@ExcelProperty
(
"岗位"
)
private
String
position
;
/**
* 反馈类型 1入职 2离职
*/
@NotBlank
(
message
=
"登记类型不能为空"
)
@ExcelAttribute
(
name
=
"登记类型"
,
readConverterExp
=
"1=入职,2=离职"
,
isNotEmpty
=
true
,
errorInfo
=
"登记类型不能为空"
)
@Schema
(
description
=
"登记类型"
)
@ExcelProperty
(
"登记类型"
)
private
String
feedbackType
;
/**
* 入/离职日期
*/
@NotBlank
(
message
=
"入/离职日期不能为空"
)
@ExcelAttribute
(
name
=
"入/离职日期"
,
isNotEmpty
=
true
,
errorInfo
=
"入/离职日期不能为空"
,
isDate
=
true
)
@Schema
(
description
=
"入/离职日期"
)
@ExcelProperty
(
"入/离职日期"
)
private
Date
joinLeaveDate
;
}
yifu-csp/yifu-csp-biz/src/main/java/com/yifu/cloud/plus/v1/csp/controller/EmployeeRegistrationController.java
View file @
38d802ac
...
@@ -406,4 +406,19 @@ public class EmployeeRegistrationController {
...
@@ -406,4 +406,19 @@ public class EmployeeRegistrationController {
public
EkpDeptContractInfoVo
selectContractInfoByDetptNo
(
@RequestBody
EkpDeptContractInfoVo
vo
)
{
public
EkpDeptContractInfoVo
selectContractInfoByDetptNo
(
@RequestBody
EkpDeptContractInfoVo
vo
)
{
return
employeeRegistrationService
.
selectContractInfoByDetptNo
(
vo
);
return
employeeRegistrationService
.
selectContractInfoByDetptNo
(
vo
);
}
}
/**
* @Author fxj
* @Description 入离职登记表 批量导入 --新 MVP端专用
* @Date 9:39 2026/3/12
* @Param
* @return
**/
@SneakyThrows
@Operation
(
description
=
"批量新增入离职登记表MVP端专用"
)
@SysLog
(
"批量新增入离职登记表MVP端专用"
)
@PostMapping
(
"/importListAddNew"
)
public
R
<
List
<
ErrorMessage
>>
importListAddNew
(
@RequestBody
MultipartFile
file
)
{
return
employeeRegistrationService
.
importDiyNew
(
file
.
getInputStream
());
}
}
}
yifu-csp/yifu-csp-biz/src/main/java/com/yifu/cloud/plus/v1/csp/service/EmployeeRegistrationService.java
View file @
38d802ac
...
@@ -60,6 +60,13 @@ public interface EmployeeRegistrationService extends IService<EmployeeRegistrati
...
@@ -60,6 +60,13 @@ public interface EmployeeRegistrationService extends IService<EmployeeRegistrati
*/
*/
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
,
String
deptId
,
String
dataSource
);
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
,
String
deptId
,
String
dataSource
);
/**
* 入离职登记表导入
* @param inputStream 文件流
* @return
*/
R
<
List
<
ErrorMessage
>>
importDiyNew
(
InputStream
inputStream
);
/**
/**
* 入离职登记新增
* 入离职登记新增
* @param registration 入离职登记
* @param registration 入离职登记
...
...
yifu-csp/yifu-csp-biz/src/main/java/com/yifu/cloud/plus/v1/csp/service/impl/EmployeeRegistrationServiceImpl.java
View file @
38d802ac
...
@@ -520,7 +520,9 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
...
@@ -520,7 +520,9 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
}
insert
.
setDeptNo
(
selectVo
.
getDepartNo
());
insert
.
setDeptNo
(
selectVo
.
getDepartNo
());
// 1.9.8:新增校验
// 1.9.8:新增校验
if
(
CommonConstants
.
TWO_STRING
.
equals
(
dataSource
)
&&
Common
.
isNotNull
(
postConfigList
)
&&
!
postConfigList
.
contains
(
insert
.
getPosition
())){
if
(
CommonConstants
.
TWO_STRING
.
equals
(
dataSource
)
&&
Common
.
isNotNull
(
postConfigList
)
&&
!
postConfigList
.
contains
(
insert
.
getPosition
())){
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
"岗位不在项目配置的岗位配置项里"
,
excel
));
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
"岗位不在项目配置的岗位配置项里"
,
excel
));
continue
;
continue
;
}
}
...
@@ -2420,4 +2422,221 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
...
@@ -2420,4 +2422,221 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
baseMapper
.
updateById
(
registrationNow
);
baseMapper
.
updateById
(
registrationNow
);
return
R
.
ok
();
return
R
.
ok
();
}
}
@Override
public
R
<
List
<
ErrorMessage
>>
importDiyNew
(
InputStream
inputStream
)
{
// 验证输入参数
if
(
inputStream
==
null
)
{
return
R
.
failed
(
"导入文件流不能为空"
);
}
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmployeeRegistrationNewVo
>
excelUtil
=
new
ExcelUtil
<>(
EmployeeRegistrationNewVo
.
class
);
YifuUser
user
=
SecurityUtils
.
getUser
();
// 获取当前登录人拥有的项目权限--非管理员获取
List
<
String
>
deptNos
=
new
ArrayList
<>();
if
(
Common
.
isNotNull
(
user
)
&&
!
CommonConstants
.
ZERO_STRING
.
equals
(
user
.
getSystemFlag
()))
{
R
<
TSettleDomainListVo
>
haveDomainR
=
archivesDaprUtil
.
getSettleDomainIdsByUserId
(
user
.
getId
());
if
(
null
==
haveDomainR
||
null
==
haveDomainR
.
getData
())
{
return
R
.
failed
(
"未获取到客服项目权限!"
);
}
TSettleDomainListVo
haveDomain
=
haveDomainR
.
getData
();
// 添加空值检查,避免 NPE
if
(
haveDomain
.
getDeptNos
()
!=
null
)
{
deptNos
=
haveDomain
.
getDeptNos
();
}
}
// 临时存储已查询的项目信息
Map
<
String
,
TSettleDomainSelectVo
>
domainMap
=
new
HashMap
<>(
16
);
// 存储项目对应的岗位配置信息
Map
<
String
,
List
<
String
>>
postConfigMap
=
new
HashMap
<>(
16
);
// 验证重复存储(修正拼写错误:exitMap -> existMap)
Map
<
String
,
String
>
existMap
=
new
HashMap
<>(
16
);
// 写法 2:
// 匿名内部类 不用额外写一个 DemoDataListener
// 这里 需要指定读用哪个 class 去读,然后读取第一个 sheet 文件流会自动关闭
try
{
List
<
String
>
finalDeptNos
=
deptNos
;
EasyExcel
.
read
(
inputStream
,
EmployeeRegistrationNewVo
.
class
,
new
ReadListener
<
EmployeeRegistrationNewVo
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT1
;
/**
* 临时存储
*/
private
List
<
EmployeeRegistrationNewVo
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmployeeRegistrationNewVo
data
,
AnalysisContext
context
)
{
ReadRowHolder
readRowHolder
=
context
.
readRowHolder
();
Integer
rowIndex
=
readRowHolder
.
getRowIndex
();
data
.
setRowIndex
(
rowIndex
+
1
);
ErrorMessage
errorMessage
=
excelUtil
.
checkEntity
(
data
,
data
.
getRowIndex
());
if
(
Common
.
isNotNull
(
errorMessage
))
{
errorMessage
.
setData
(
data
);
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
());
importEmployeeRegistrationNew
(
cachedDataList
,
errorMessageList
,
user
,
domainMap
,
postConfigMap
,
finalDeptNos
,
existMap
);
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
void
importEmployeeRegistrationNew
(
List
<
EmployeeRegistrationNewVo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
,
YifuUser
user
,
Map
<
String
,
TSettleDomainSelectVo
>
domainMap
,
Map
<
String
,
List
<
String
>>
postConfigMap
,
List
<
String
>
deptNos
,
Map
<
String
,
String
>
exitMap
)
{
//来源为 MVP 端专用
String
dataSource
=
CommonConstants
.
TWO_STRING
;
//判断当前用户是否为管理员
boolean
isAdmin
=
Common
.
isNotNull
(
user
)
&&
CommonConstants
.
ZERO_STRING
.
equals
(
user
.
getSystemFlag
());
int
inNum
=
0
;
int
outNum
=
0
;
List
<
EmployeeRegistration
>
insertList
=
new
ArrayList
<>();
TSettleDomainSelectVo
selectVo
=
null
;
R
<
SysAutoDictItemVo
>
domainDictR
=
null
;
List
<
String
>
postConfigList
=
null
;
for
(
EmployeeRegistrationNewVo
excel
:
excelVOList
)
{
//非管理员判断是否有项目权限
if
(!
isAdmin
){
if
(!
deptNos
.
contains
(
excel
.
getDeptNo
())){
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
"无项目权限!"
));
continue
;
}
}
selectVo
=
domainMap
.
get
(
excel
.
getDeptNo
());
if
(
null
==
selectVo
){
//获取项目信息
R
<
TSettleDomainSelectVo
>
domainR
=
archivesDaprUtil
.
getSettleDomainSelectVoById
(
excel
.
getDeptNo
());
if
(
null
==
domainR
||
!
CommonConstants
.
SUCCESS
.
equals
(
domainR
.
getCode
()))
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
"访问员工基础服务异常:"
+((
null
==
domainR
||
null
==
domainR
.
getMsg
())?
""
:
domainR
.
getMsg
())));
continue
;
}
if
(
null
==
domainR
.
getData
()){
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
"未查询到具体项目信息"
));
continue
;
}
selectVo
=
domainR
.
getData
();
domainMap
.
put
(
excel
.
getDeptNo
(),
selectVo
);
}
//判断项目是否可用 (务状态:0 正常 1 停止服务 2 冻结)
if
(!
CommonConstants
.
ZERO_STRING
.
equals
(
selectVo
.
getStopFlag
()))
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
"项目不可用!"
));
continue
;
}
//获取项目配置的字典值
postConfigList
=
postConfigMap
.
get
(
excel
.
getDeptNo
());
if
(
null
==
postConfigList
){
postConfigList
=
new
ArrayList
<>();
domainDictR
=
archivesDaprUtil
.
getDictListByDeptNo
(
excel
.
getDeptNo
());
if
(
Common
.
isNotNull
(
domainDictR
)
&&
Common
.
isNotNull
(
domainDictR
.
getData
())
&&
Common
.
isNotNull
(
domainDictR
.
getData
().
getSysAutoDictItemList
()))
{
List
<
SysAutoDictItem
>
dictItemList
=
domainDictR
.
getData
().
getSysAutoDictItemList
();
for
(
SysAutoDictItem
sysAutoDictItem
:
dictItemList
){
if
(
"post_type"
.
equals
(
sysAutoDictItem
.
getType
())){
postConfigList
.
add
(
sysAutoDictItem
.
getLabel
());
}
}
postConfigMap
.
put
(
excel
.
getDeptNo
(),
postConfigList
);
}
}
// 插入
EmployeeRegistration
insert
=
new
EmployeeRegistration
();
BeanUtil
.
copyProperties
(
excel
,
insert
);
//表数据验重
//表内数据重复 员工姓名、员工身份证号码、反馈类型
StringBuilder
errorTempBuilder
=
new
StringBuilder
();
errorTempBuilder
.
append
(
Common
.
isNullToString
(
excel
.
getDeptNo
()))
.
append
(
"_"
)
.
append
(
Common
.
isNullToString
(
excel
.
getEmployeeName
()))
.
append
(
"_"
)
.
append
(
Common
.
isNullToString
(
excel
.
getEmpIdcard
()))
.
append
(
"_"
)
.
append
(
Common
.
isNullToString
(
excel
.
getFeedbackType
()));
String
duplicateKey
=
errorTempBuilder
.
toString
();
//修正拼写错误:exitMap -> existMap
if
(
null
==
exitMap
.
get
(
duplicateKey
))
{
exitMap
.
put
(
duplicateKey
,
"1"
);
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
RegistConstants
.
IMPORT_EXIT_CHECK
,
excel
));
continue
;
}
insert
.
setDeptNo
(
selectVo
.
getDepartNo
());
// 1.9.8:新增校验
if
(
CommonConstants
.
TWO_STRING
.
equals
(
dataSource
)
&&
Common
.
isNotNull
(
postConfigList
)
&&
!
postConfigList
.
contains
(
insert
.
getPosition
())){
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
"岗位不在项目配置的岗位配置项里"
,
excel
));
continue
;
}
String
error
=
registCheck
(
insert
);
if
(
null
!=
error
)
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
error
,
excel
));
continue
;
}
// 1.9.8:新增赋值
insert
.
setDataSource
(
dataSource
);
initRegistInfo
(
insert
,
user
,
selectVo
);
insertList
.
add
(
insert
);
//新增记录,新增操作记录
baseMapper
.
insert
(
insert
);
if
(
Common
.
isNotNull
(
insert
.
getFeedbackType
())
&&
CommonConstants
.
TWO_STRING
.
equals
(
insert
.
getFeedbackType
()))
{
// 生成离职待办
employeeRegistrationLeaveService
.
saveLeaveInfo
(
insert
);
}
if
(
CommonConstants
.
ONE_STRING
.
equals
(
insert
.
getFeedbackType
()))
{
inNum
++;
}
else
{
outNum
++;
}
logService
.
saveLog
(
insert
.
getId
(),
CommonConstants
.
ZERO_STRING
,
RegistConstants
.
MESSAGE_REGIST
,
LocalDateTime
.
now
(),
insert
.
getRegistorUsername
(),
null
);
}
if
(!
Common
.
isEmpty
(
insertList
))
{
insertList
.
clear
();
//发送企业微信待办
EmployeeRegistration
msgRegistration
=
new
EmployeeRegistration
();
msgRegistration
.
setInNum
(
inNum
);
msgRegistration
.
setOutNum
(
outNum
);
msgRegistration
.
setCustomerUserLoginname
(
selectVo
.
getCsLoginName
());
msgRegistration
.
setDeptName
(
selectVo
.
getDepartName
());
msgRegistration
.
setDeptNo
(
selectVo
.
getDepartNo
());
//企业微信消息提醒
sendMessageToWx
(
msgRegistration
,
CommonConstants
.
THREE_STRING
);
}
}
}
}
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