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
30ba8d1f
Commit
30ba8d1f
authored
Jul 04, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合同-批量更新
parent
1753507b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
217 additions
and
2 deletions
+217
-2
EmployeeContractUpdateVO.java
...ud/plus/v1/yifu/archives/vo/EmployeeContractUpdateVO.java
+73
-0
TEmployeeContractInfoController.java
.../archives/controller/TEmployeeContractInfoController.java
+18
-2
TEmployeeContractInfoMapper.java
.../v1/yifu/archives/mapper/TEmployeeContractInfoMapper.java
+2
-0
TEmployeeContractInfoService.java
...1/yifu/archives/service/TEmployeeContractInfoService.java
+18
-0
TEmployeeContractInfoServiceImpl.java
...chives/service/impl/TEmployeeContractInfoServiceImpl.java
+97
-0
TEmployeeContractInfoMapper.xml
...src/main/resources/mapper/TEmployeeContractInfoMapper.xml
+9
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeContractUpdateVO.java
0 → 100644
View file @
30ba8d1f
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
com.alibaba.excel.annotation.format.DateTimeFormat
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.Size
;
import
java.io.Serializable
;
import
java.time.LocalDate
;
/**
* 员工合同-批量更新的VO
*
* @author hgw
* @date 2022-7-1 17:40:40
*/
@Data
@Schema
(
description
=
"员工合同-批量更新的VO"
)
public
class
EmployeeContractUpdateVO
extends
RowIndex
implements
Serializable
{
/**
* 合同申请编码
*/
@Length
(
max
=
50
,
message
=
"合同申请编码不能超过50个字符"
)
@ExcelAttribute
(
name
=
"合同申请编码"
,
isNotEmpty
=
true
,
maxLength
=
50
,
needExport
=
true
)
@Schema
(
description
=
"合同申请编码"
,
name
=
"applyNo"
)
private
String
applyNo
;
/**
* 员工姓名
*/
@Length
(
max
=
20
,
message
=
"员工姓名不能超过20个字符"
)
@ExcelAttribute
(
name
=
"员工姓名"
,
isNotEmpty
=
true
,
maxLength
=
20
,
needExport
=
true
)
@Schema
(
description
=
"员工姓名"
,
name
=
"empName"
)
private
String
empName
;
/**
* 合同编号
*/
@NotBlank
(
message
=
"合同编号不能为空"
)
@Length
(
max
=
50
,
message
=
"合同编号不能超过50个字符"
)
@ExcelAttribute
(
name
=
"合同编号"
,
maxLength
=
50
)
@Schema
(
description
=
"合同编号"
,
name
=
"contractNo"
)
private
String
contractNo
;
/**
* 档案柜号
*/
@Length
(
max
=
50
,
message
=
"档案柜号不能超过50个字符"
)
@ExcelAttribute
(
name
=
"档案柜号"
,
maxLength
=
50
)
@Schema
(
description
=
"档案柜号"
,
name
=
"fileCabinetNo"
)
private
String
fileCabinetNo
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeContractInfoController.java
View file @
30ba8d1f
...
@@ -51,7 +51,7 @@ import java.util.List;
...
@@ -51,7 +51,7 @@ import java.util.List;
*/
*/
@RestController
@RestController
@RequiredArgsConstructor
@RequiredArgsConstructor
@RequestMapping
(
"/
getListByParam
"
)
@RequestMapping
(
"/
temployeecontractinfo
"
)
@Tag
(
name
=
"员工合同管理"
)
@Tag
(
name
=
"员工合同管理"
)
@SecurityRequirement
(
name
=
HttpHeaders
.
AUTHORIZATION
)
@SecurityRequirement
(
name
=
HttpHeaders
.
AUTHORIZATION
)
public
class
TEmployeeContractInfoController
{
public
class
TEmployeeContractInfoController
{
...
@@ -112,7 +112,7 @@ public class TEmployeeContractInfoController {
...
@@ -112,7 +112,7 @@ public class TEmployeeContractInfoController {
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo>>
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo>>
**/
**/
@Operation
(
summary
=
"根据参数返回list"
,
description
=
"根据参数返回list"
)
@Operation
(
summary
=
"根据参数返回list"
,
description
=
"根据参数返回list"
)
@
Ge
tMapping
(
"/getListByParam"
)
@
Pos
tMapping
(
"/getListByParam"
)
public
R
<
List
<
TEmployeeContractInfo
>>
getListByParam
(
TEmployeeContractInfo
tEmployeeContractInfo
)
{
public
R
<
List
<
TEmployeeContractInfo
>>
getListByParam
(
TEmployeeContractInfo
tEmployeeContractInfo
)
{
return
new
R
<>(
tEmployeeContractInfoService
.
getTEmployeeContractList
(
tEmployeeContractInfo
));
return
new
R
<>(
tEmployeeContractInfoService
.
getTEmployeeContractList
(
tEmployeeContractInfo
));
}
}
...
@@ -235,4 +235,20 @@ public class TEmployeeContractInfoController {
...
@@ -235,4 +235,20 @@ public class TEmployeeContractInfoController {
return
tEmployeeContractInfoService
.
batchImport
(
file
.
getInputStream
());
return
tEmployeeContractInfoService
.
batchImport
(
file
.
getInputStream
());
}
}
/**
* 批量更新-合同
* @param file
* @return
* @Author hgw
* @Date 2022-7-1 18:45:22
**/
@SneakyThrows
@Operation
(
description
=
"批量更新-合同 hasPermission('temployeecontractinfo_batch_update')"
)
@SysLog
(
"批量更新-合同"
)
@PostMapping
(
"/batchUpdate"
)
@PreAuthorize
(
"@pms.hasPermission('temployeecontractinfo_batch_update')"
)
public
R
<
List
<
ErrorMessage
>>
batchUpdate
(
@RequestBody
MultipartFile
file
)
{
return
tEmployeeContractInfoService
.
batchUpdate
(
file
.
getInputStream
());
}
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TEmployeeContractInfoMapper.java
View file @
30ba8d1f
...
@@ -46,6 +46,8 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac
...
@@ -46,6 +46,8 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac
List
<
TEmployeeContractInfo
>
getTEmployeeContractList
(
@Param
(
"tEmployeeContractInfo"
)
TEmployeeContractInfo
tEmployeeContractInfo
);
List
<
TEmployeeContractInfo
>
getTEmployeeContractList
(
@Param
(
"tEmployeeContractInfo"
)
TEmployeeContractInfo
tEmployeeContractInfo
);
TEmployeeContractInfo
getOneContractByApplyNo
(
@Param
(
"applyNo"
)
String
applyNo
);
/**
/**
* 更新项目内的其他的合同在用状态
* 更新项目内的其他的合同在用状态
* @Author fxj
* @Author fxj
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeContractInfoService.java
View file @
30ba8d1f
...
@@ -104,6 +104,24 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
...
@@ -104,6 +104,24 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
**/
**/
R
<
String
>
filingContract
(
TEmployeeContractInfo
tEmployeeContractInfo
);
R
<
String
>
filingContract
(
TEmployeeContractInfo
tEmployeeContractInfo
);
/**
* @param inputStream
* @Description: 批量导入
* @Author: hgw
* @Date: 2022/7/4 17:16
* @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
>>
batchImport
(
InputStream
inputStream
);
R
<
List
<
ErrorMessage
>>
batchImport
(
InputStream
inputStream
);
/**
* @param inputStream
* @Description: 批量更新
* @Author: hgw
* @Date: 2022/7/4 17:16
* @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
>>
batchUpdate
(
InputStream
inputStream
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeContractInfoServiceImpl.java
View file @
30ba8d1f
...
@@ -30,6 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.Constants.EmployeeContractConstants;
...
@@ -30,6 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.Constants.EmployeeContractConstants;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractUpdateVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
...
@@ -51,7 +52,9 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -51,7 +52,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 员工合同
* 员工合同
...
@@ -458,6 +461,100 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
...
@@ -458,6 +461,100 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
return
R
.
failed
(
"参数不可为空"
);
return
R
.
failed
(
"参数不可为空"
);
}
}
@Override
public
R
<
List
<
ErrorMessage
>>
batchUpdate
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
EmployeeContractUpdateVO
>
util1
=
new
ExcelUtil
<>(
EmployeeContractUpdateVO
.
class
);
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
EmployeeContractUpdateVO
.
class
,
new
ReadListener
<
EmployeeContractUpdateVO
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
EmployeeContractUpdateVO
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
EmployeeContractUpdateVO
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
());
updateContract
(
cachedDataList
,
errorMessageList
);
log
.
info
(
"存储数据库成功!"
);
}
}).
sheet
().
doRead
();
}
catch
(
Exception
e
)
{
log
.
error
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
,
e
);
return
R
.
failed
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
);
}
return
R
.
ok
(
errorMessageList
);
}
/**
* @Author hgw
* @Description 批量导入
* @Date 2022-7-1 18:48:01
**/
@Transactional
public
void
updateContract
(
List
<
EmployeeContractUpdateVO
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
/// 个性化校验逻辑
EmployeeContractUpdateVO
excel
;
TEmployeeContractInfo
contractInfo
;
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
excel
=
excelVOList
.
get
(
i
);
if
(
excel
!=
null
)
{
if
(
Common
.
isNotNull
(
excel
.
getContractNo
())
||
Common
.
isNotNull
(
excel
.
getFileCabinetNo
()))
{
if
(
Common
.
isNotNull
(
excel
.
getApplyNo
()))
{
// 存储
contractInfo
=
baseMapper
.
getOneContractByApplyNo
(
excel
.
getApplyNo
());
if
(
contractInfo
!=
null
&&
Common
.
isNotNull
(
contractInfo
.
getId
()))
{
contractInfo
.
setContractNo
(
excel
.
getContractNo
());
contractInfo
.
setFileCabinetNo
(
excel
.
getFileCabinetNo
());
this
.
updateById
(
contractInfo
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_SUCCESS
));
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
EmployeeContractConstants
.
NO_INFO
));
}
}
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
EmployeeContractConstants
.
NO_INFO
));
}
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
EmployeeContractConstants
.
NO_INFO
));
}
}
}
@Override
@Override
public
R
<
List
<
ErrorMessage
>>
batchImport
(
InputStream
inputStream
)
{
public
R
<
List
<
ErrorMessage
>>
batchImport
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TEmployeeContractInfoMapper.xml
View file @
30ba8d1f
...
@@ -330,6 +330,15 @@
...
@@ -330,6 +330,15 @@
</where>
</where>
</select>
</select>
<!--tEmployeeContractInfo简单分页查询-->
<select
id=
"getOneContractByApplyNo"
resultMap=
"tEmployeeContrctInfoMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM t_employee_contract_info a
where a.DELETE_FLAG = 0 and a.APPLY_NO = #{applyNo}
limit 1
</select>
<!-- 根据员工ID更新合同在用状态 -->
<!-- 根据员工ID更新合同在用状态 -->
<update
id=
"updateInUseStatusById"
>
<update
id=
"updateInUseStatusById"
>
update t_employee_contract_info
update t_employee_contract_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