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
30f19b8b
Commit
30f19b8b
authored
Jan 17, 2023
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP1.4-export里面的薪资导入人员
parent
050420e6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
244 additions
and
18 deletions
+244
-18
SalaryEmployeeImportVo.java
.../cloud/plus/v1/yifu/salary/vo/SalaryEmployeeImportVo.java
+21
-0
TSalaryEmployeeController.java
.../v1/yifu/salary/controller/TSalaryEmployeeController.java
+17
-0
TSalaryEmployeeService.java
...d/plus/v1/yifu/salary/service/TSalaryEmployeeService.java
+10
-0
TSalaryEmployeeServiceImpl.java
.../yifu/salary/service/impl/TSalaryEmployeeServiceImpl.java
+196
-18
No files found.
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/SalaryEmployeeImportVo.java
0 → 100644
View file @
30f19b8b
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
vo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
/**
* @author hgw
* @description 薪资人员导入vo
* @date 2023/1/17
*/
@Getter
@Setter
public
class
SalaryEmployeeImportVo
{
private
List
<
TSalaryEmployee
>
empList
;
private
TSettleDomain
dept
;
private
String
isUpdate
;
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/controller/TSalaryEmployeeController.java
View file @
30f19b8b
...
...
@@ -29,6 +29,7 @@ import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryEmployeeService
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryEmployeeImportVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeExportVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeSearchVo
;
import
io.swagger.v3.oas.annotations.Operation
;
...
...
@@ -180,4 +181,20 @@ public class TSalaryEmployeeController {
public
R
<
List
<
ErrorMessage
>>
batchUpdateSalaryEmployee
(
@RequestBody
MultipartFile
file
)
{
return
tSalaryEmployeeService
.
batchUpdateSalaryEmployee
(
file
.
getInputStream
());
}
/**
* @param vo
* @Description: 批量新增或更新人员
* @Author: hgw
* @Date: 2023/1/17 15:35
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/
@Operation
(
description
=
"批量新增或更新人员"
)
@SysLog
(
"批量新增或更新人员"
)
@PostMapping
(
"/importEmployee"
)
@PreAuthorize
(
"@pms.hasPermission('tsalaryemployee_import_employee')"
)
public
R
<
List
<
ErrorMessage
>>
importEmployee
(
@RequestBody
SalaryEmployeeImportVo
vo
)
{
return
tSalaryEmployeeService
.
importEmployee
(
vo
);
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TSalaryEmployeeService.java
View file @
30f19b8b
...
...
@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryEmployeeImportVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeExportVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeSearchVo
;
...
...
@@ -69,6 +70,15 @@ public interface TSalaryEmployeeService extends IService<TSalaryEmployee> {
**/
R
<
List
<
ErrorMessage
>>
batchUpdateSalaryEmployee
(
InputStream
inputStream
);
/**
* @param vo
* @Description: 批量新增或更新人员
* @Author: hgw
* @Date: 2023/1/17 15:38
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/
R
<
List
<
ErrorMessage
>>
importEmployee
(
SalaryEmployeeImportVo
vo
);
TSalaryEmployee
getByEmpIdCard
(
String
empIdCard
);
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryEmployeeServiceImpl.java
View file @
30f19b8b
...
...
@@ -32,8 +32,10 @@ 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.check.entity.TCheckBankNo
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckIdCard
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckMobile
;
import
com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
...
...
@@ -44,10 +46,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee;
import
com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryEmployeeMapper
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryEmployeeService
;
import
com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeExportVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeUpdateVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.*
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
...
...
@@ -283,15 +282,51 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
**/
@Override
public
String
saveNewSalaryEmployee
(
boolean
notLabour
,
TSalaryEmployee
employee
)
{
String
pre
=
this
.
checkNewEmpBankAndPhone
(
employee
,
false
);
if
(
pre
!=
null
)
return
pre
;
if
(
notLabour
)
{
this
.
save
(
employee
);
}
return
null
;
}
/**
* @param employee
* @Description: 校验卡号与手机号
* @Author: hgw
* @Date: 2023/1/17 16:27
* @return: java.lang.String
**/
private
String
checkNewEmpBankAndPhone
(
TSalaryEmployee
employee
,
boolean
isCheckIdCard
)
{
if
(
Common
.
isNotNull
(
employee
.
getEmpName
())
&&
Common
.
isNotNull
(
employee
.
getEmpIdcard
()))
{
// 身份证校验(薪资人员导入才需要)
if
(
isCheckIdCard
)
{
// 调用校验服务
String
pre
=
"姓名与身份证验证:"
;
TCheckIdCard
checkIdCard
=
new
TCheckIdCard
();
checkIdCard
.
setName
(
employee
.
getEmpName
());
checkIdCard
.
setIdCard
(
employee
.
getEmpIdcard
());
R
<
TCheckIdCard
>
checkListR
=
HttpDaprUtil
.
invokeMethodPost
(
checkProperties
.
getAppUrl
(),
checkProperties
.
getAppId
()
,
"/tcheckidcard/inner/checkIdCardSingle"
,
checkIdCard
,
TCheckIdCard
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
checkListR
!=
null
&&
checkListR
.
getData
()
!=
null
)
{
TCheckIdCard
check
=
checkListR
.
getData
();
if
(
check
==
null
||
Common
.
isEmpty
(
check
.
getIsTrue
()))
{
return
pre
+
"校验服务器未返回,请联系管理员!"
;
}
else
if
(
check
.
getIsTrue
()
==
CommonConstants
.
ZERO_INT
)
{
return
pre
+
check
.
getReason
();
}
}
else
{
return
pre
+
"校验服务器未返回,请联系管理员!"
;
}
}
// 银行卡
if
(
Common
.
isNotNull
(
employee
.
getBankNo
()))
{
// 调用校验服务
TCheckBankNo
check
IdCard
=
new
TCheckBankNo
();
check
IdCard
.
setName
(
employee
.
getEmpName
());
check
IdCard
.
setBankNo
(
employee
.
getBankNo
());
TCheckBankNo
check
BankNo
=
new
TCheckBankNo
();
check
BankNo
.
setName
(
employee
.
getEmpName
());
check
BankNo
.
setBankNo
(
employee
.
getBankNo
());
R
<
CheckBankNoVo
>
checkListR
=
HttpDaprUtil
.
invokeMethodPost
(
checkProperties
.
getAppUrl
(),
checkProperties
.
getAppId
()
,
"/tcheckbankno/inner/checkBankNo"
,
check
IdCard
,
CheckBankNoVo
.
class
,
SecurityConstants
.
FROM_IN
);
,
"/tcheckbankno/inner/checkBankNo"
,
check
BankNo
,
CheckBankNoVo
.
class
,
SecurityConstants
.
FROM_IN
);
String
pre
=
"姓名与卡号验证:"
;
if
(
checkListR
!=
null
&&
checkListR
.
getData
()
!=
null
)
{
CheckBankNoVo
vo
=
checkListR
.
getData
();
...
...
@@ -327,19 +362,9 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
}
}
}
if
(
notLabour
)
{
this
.
save
(
employee
);
}
return
null
;
}
/**
* @param inputStream
* @Description: 批量更新-薪资人员信息
* @Author: hgw
* @Date: 2022/10/10 17:17
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/
@Override
public
R
<
List
<
ErrorMessage
>>
batchUpdateSalaryEmployee
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
...
...
@@ -504,4 +529,157 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
return
baseMapper
.
getByEmpIdCard
(
empIdCard
);
}
/**
* @param vo
* @Description: 批量更新-薪资人员信息
* @Author: hgw
* @Date: 2022/10/10 17:17
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/
@Override
public
R
<
List
<
ErrorMessage
>>
importEmployee
(
SalaryEmployeeImportVo
vo
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
List
<
String
>
idCardList
=
new
ArrayList
<>();
// 执行数据插入操作 组装
List
<
TSalaryEmployee
>
excelVOList
=
vo
.
getEmpList
();
for
(
TSalaryEmployee
emp
:
excelVOList
)
{
idCardList
.
add
(
emp
.
getEmpIdcard
());
}
List
<
TSalaryEmployee
>
empList
=
baseMapper
.
getListByIdCard
(
idCardList
);
// 人员Map
Map
<
String
,
TSalaryEmployee
>
empMap
=
new
HashMap
<>();
for
(
TSalaryEmployee
e
:
empList
)
{
empMap
.
put
(
e
.
getEmpIdcard
(),
e
);
}
TSalaryEmployee
emp
;
// 开户行省市的区域暂存
String
areaStr
;
boolean
curTaxMonth
;
TSalaryEmployee
excel
;
// 是否可更新
boolean
canUpdate
=
Common
.
isNotNull
(
vo
.
getIsUpdate
())
&&
CommonConstants
.
ONE_STRING
.
equals
(
vo
.
getIsUpdate
());
List
<
TSalaryEmployee
>
saveList
=
new
ArrayList
<>();
List
<
TSalaryEmployee
>
updateList
=
new
ArrayList
<>();
TSettleDomain
dept
=
vo
.
getDept
();
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
excel
=
excelVOList
.
get
(
i
);
if
(
excel
!=
null
)
{
if
(
Common
.
isNotNull
(
excel
.
getEmpIdcard
()))
{
emp
=
empMap
.
get
(
excel
.
getEmpIdcard
());
if
(
Common
.
isNotNull
(
emp
))
{
if
(
canUpdate
)
{
curTaxMonth
=
false
;
if
(
Common
.
isNotNull
(
emp
.
getTaxMonth
())
&&
Common
.
isNotNull
(
excel
.
getTaxMonth
())
&&
emp
.
getTaxMonth
().
length
()
==
6
)
{
curTaxMonth
=
true
;
}
else
if
(
Common
.
isNotNull
(
excel
.
getTaxMonth
()))
{
emp
.
setTaxMonth
(
excel
.
getTaxMonth
());
}
if
(
Common
.
isNotNull
(
excel
.
getBankName
()))
{
emp
.
setBankName
(
excel
.
getBankName
());
}
if
(
Common
.
isNotNull
(
excel
.
getBankSubName
()))
{
emp
.
setBankSubName
(
excel
.
getBankSubName
());
}
if
(
Common
.
isNotNull
(
excel
.
getBankProvince
()))
{
areaStr
=
ExcelUtil
.
getRedisAreaValue
(
CacheConstants
.
AREA_VALUE
+
excel
.
getBankProvince
().
trim
());
if
(
Common
.
isNotNull
(
areaStr
))
{
emp
.
setBankProvince
(
areaStr
);
if
(
Common
.
isNotNull
(
excel
.
getBankCity
()))
{
areaStr
=
ExcelUtil
.
getRedisAreaValue
(
CacheConstants
.
AREA_VALUE
+
excel
.
getBankCity
().
trim
()
+
CommonConstants
.
DOWN_LINE_STRING
+
excel
.
getBankProvince
().
trim
());
if
(
Common
.
isNotNull
(
areaStr
))
{
emp
.
setBankCity
(
areaStr
);
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
((
i
+
2
),
SalaryConstants
.
CITY_ERROR
));
continue
;
}
}
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
((
i
+
2
),
SalaryConstants
.
PROVINCE_ERROR
));
continue
;
}
}
if
(
Common
.
isNotNull
(
excel
.
getBankNo
()))
{
emp
.
setBankNo
(
excel
.
getBankNo
());
}
if
(
Common
.
isNotNull
(
excel
.
getEmpPhone
()))
{
emp
.
setEmpPhone
(
excel
.
getEmpPhone
());
}
if
(
Common
.
isNotNull
(
excel
.
getEmpName
()))
{
emp
.
setEmpName
(
excel
.
getEmpName
());
}
updateList
.
add
(
emp
);
if
(
curTaxMonth
)
{
errorMessageList
.
add
(
new
ErrorMessage
((
i
+
2
),
SalaryConstants
.
CUR_TAX_INFO
));
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
((
i
+
2
),
CommonConstants
.
SAVE_SUCCESS
));
}
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
((
i
+
2
),
"已存在,不可更新"
));
}
}
else
{
// 新增人员
if
(
Common
.
isEmpty
(
excel
.
getEmpName
())
||
Common
.
isEmpty
(
excel
.
getEmpIdcard
())
||
Common
.
isEmpty
(
excel
.
getEmpPhone
())
||
Common
.
isEmpty
(
excel
.
getBankName
())
||
Common
.
isEmpty
(
excel
.
getBankNo
())
||
Common
.
isEmpty
(
excel
.
getBankProvince
())
||
Common
.
isEmpty
(
excel
.
getBankCity
())
||
Common
.
isEmpty
(
excel
.
getTaxMonth
()))
{
errorMessageList
.
add
(
new
ErrorMessage
((
i
+
2
),
"新增员工,除了支行,其他必填"
));
}
else
{
String
pre
=
this
.
checkNewEmpBankAndPhone
(
excel
,
true
);
if
(
pre
!=
null
)
{
errorMessageList
.
add
(
new
ErrorMessage
((
i
+
2
),
"新增员工,除了支行,其他必填"
));
}
else
{
areaStr
=
ExcelUtil
.
getRedisAreaValue
(
CacheConstants
.
AREA_VALUE
+
excel
.
getBankProvince
().
trim
());
if
(
Common
.
isNotNull
(
areaStr
))
{
emp
.
setBankProvince
(
areaStr
);
areaStr
=
ExcelUtil
.
getRedisAreaValue
(
CacheConstants
.
AREA_VALUE
+
excel
.
getBankCity
().
trim
()
+
CommonConstants
.
DOWN_LINE_STRING
+
excel
.
getBankProvince
().
trim
());
if
(
Common
.
isNotNull
(
areaStr
))
{
emp
.
setBankCity
(
areaStr
);
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
((
i
+
2
),
SalaryConstants
.
CITY_ERROR
));
continue
;
}
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
((
i
+
2
),
SalaryConstants
.
PROVINCE_ERROR
));
continue
;
}
excel
.
setUnitId
(
dept
.
getCustomerId
());
excel
.
setUnitName
(
dept
.
getCustomerName
());
excel
.
setUnitNo
(
dept
.
getCustomerNo
());
excel
.
setDeptId
(
dept
.
getId
());
excel
.
setDeptName
(
dept
.
getDepartName
());
excel
.
setDeptNo
(
dept
.
getDepartNo
());
saveList
.
add
(
excel
);
errorMessageList
.
add
(
new
ErrorMessage
((
i
+
2
),
CommonConstants
.
SAVE_SUCCESS
));
}
}
}
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
((
i
+
2
),
SalaryConstants
.
ID_CARD_MUST
));
}
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
(
CommonConstants
.
ZERO_INT
,
SalaryConstants
.
DATA_MUST
));
}
}
if
(!
updateList
.
isEmpty
())
{
this
.
updateBatchById
(
updateList
);
}
if
(!
saveList
.
isEmpty
())
{
this
.
saveBatch
(
saveList
);
}
boolean
isTrue
=
true
;
for
(
ErrorMessage
message
:
errorMessageList
)
{
if
(!
CommonConstants
.
SAVE_SUCCESS
.
equals
(
message
.
getMessage
()))
{
isTrue
=
false
;
break
;
}
}
if
(
isTrue
)
{
return
R
.
ok
();
}
else
{
return
R
.
ok
(
errorMessageList
);
}
}
}
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