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
bf1affd1
Commit
bf1affd1
authored
Jul 15, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合同优化
parent
673f9ae0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
21 deletions
+87
-21
TEmployeeContractInfo.java
...d/plus/v1/yifu/archives/entity/TEmployeeContractInfo.java
+5
-3
EmployeeConstants.java
...ud/plus/v1/yifu/archives/constants/EmployeeConstants.java
+6
-0
TEmployeeContractInfoServiceImpl.java
...chives/service/impl/TEmployeeContractInfoServiceImpl.java
+58
-18
DateUtil.java
...om/yifu.cloud.plus.v1/yifu/common/core/util/DateUtil.java
+18
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TEmployeeContractInfo.java
View file @
bf1affd1
...
...
@@ -210,14 +210,14 @@ public class TEmployeeContractInfo extends BaseEntity {
* 合同岗位
*/
@Length
(
max
=
32
,
message
=
"合同岗位不能超过32个字符"
)
@ExcelAttribute
(
name
=
"合同岗位"
,
maxLength
=
32
,
needExport
=
true
)
@ExcelAttribute
(
name
=
"合同岗位"
,
isNotEmpty
=
true
,
errorInfo
=
"合同岗位不能为空"
,
maxLength
=
32
,
needExport
=
true
)
@Schema
(
description
=
"合同岗位"
,
name
=
"post"
)
private
String
post
;
/**
* 工时制(数据字典) 1标准工时 2 综合工时 3不定时工时制
*/
@Length
(
max
=
32
,
message
=
"工时制不能超过32个字符"
)
@ExcelAttribute
(
name
=
"工时制"
,
maxLength
=
32
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
WORKING_HOURS
)
@ExcelAttribute
(
name
=
"工时制"
,
isNotEmpty
=
true
,
errorInfo
=
"工时制不能为空"
,
maxLength
=
32
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
WORKING_HOURS
)
@Schema
(
description
=
"工时制(数据字典) 1标准工时 2 综合工时 3不定时工时制"
,
name
=
"workingHours"
)
private
String
workingHours
;
/**
...
...
@@ -411,7 +411,9 @@ public class TEmployeeContractInfo extends BaseEntity {
/**
* 合同甲方
*/
@ExcelAttribute
(
name
=
"合同甲方"
)
@NotBlank
(
message
=
"合同甲方不能为空"
)
@Length
(
max
=
50
,
message
=
"合同甲方不能超过50个字符"
)
@ExcelAttribute
(
name
=
"合同甲方"
,
isNotEmpty
=
true
,
errorInfo
=
"合同甲方不能为空"
,
maxLength
=
50
,
needExport
=
true
)
@Schema
(
description
=
"合同甲方"
)
@Size
(
max
=
50
,
message
=
"合同甲方不可超过50位"
)
private
String
contractParty
;
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/constants/EmployeeConstants.java
View file @
bf1affd1
...
...
@@ -34,6 +34,12 @@ public class EmployeeConstants {
public
static
final
String
CHECK_NO_RESPONSE
=
"校验服务器未返回,请联系管理员!"
;
public
static
final
String
SITUATION_SIX
=
"作废"
;
public
static
final
String
SITUATION_SEVEN
=
"终止"
;
public
static
final
String
EMPID_NOT_EMPTY
=
"员工ID、项目ID不可为空;"
;
public
static
final
String
OTHERS
=
"其他"
;
public
static
final
String
SUB_MUST
=
"业务细分必填"
;
public
static
final
String
CONTRACT_END_MUST
=
"合同到期时间必填"
;
public
static
final
String
CONTRACT_TYPE_TWO
=
"2"
;
public
static
final
String
CONTRACT_NO_IN_USE
=
"暂无可操作的合同"
;
/**
* 无数据可更新
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeContractInfoServiceImpl.java
View file @
bf1affd1
...
...
@@ -42,6 +42,7 @@ import lombok.RequiredArgsConstructor;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.support.SimpleValueWrapper
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -51,10 +52,13 @@ import javax.servlet.ServletOutputStream;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 员工合同
...
...
@@ -68,7 +72,6 @@ import java.util.List;
public
class
TEmployeeContractInfoServiceImpl
extends
ServiceImpl
<
TEmployeeContractInfoMapper
,
TEmployeeContractInfo
>
implements
TEmployeeContractInfoService
{
private
static
final
String
ID_NOT_EMPTY
=
"ID,EMP_ID不可为空"
;
private
static
final
String
EMPID_NOT_EMPTY
=
"员工ID、项目ID不可为空"
;
private
static
final
String
EMPINFO_IS_NOT_EXITS_BYID
=
"未找到人员档案与项目档案!"
;
...
...
@@ -113,7 +116,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
public
R
<
List
<
ErrorMessage
>>
saveNewContract
(
TEmployeeContractInfo
tEmployeeContractInfo
)
{
try
{
if
(
Common
.
isEmpty
(
tEmployeeContractInfo
.
getEmpId
())
||
Common
.
isEmpty
(
tEmployeeContractInfo
.
getSettleDomain
()))
{
return
R
.
failed
(
EMPID_NOT_EMPTY
);
return
R
.
failed
(
E
mployeeConstants
.
E
MPID_NOT_EMPTY
);
}
return
this
.
setBaseInfo
(
tEmployeeContractInfo
);
}
catch
(
Exception
e
)
{
...
...
@@ -154,7 +157,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
if
(
this
.
saveContractAndAtta
(
tEmployeeContractInfo
))
{
return
R
.
ok
();
return
R
.
ok
(
null
,
"保存成功"
);
}
else
{
return
R
.
failed
();
}
...
...
@@ -200,6 +203,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
private
void
initEmployeeContract
(
TEmployeeContractInfo
tEmployeeContractInfo
,
TEmployeeInfo
tEmployeeInfo
,
TEmployeeProject
tEmployeeProject
,
YifuUser
user
)
{
tEmployeeContractInfo
.
setEmpId
(
tEmployeeInfo
.
getId
());
tEmployeeContractInfo
.
setEmpNatrue
(
tEmployeeInfo
.
getEmpNatrue
());
tEmployeeContractInfo
.
setEmpIdcard
(
tEmployeeInfo
.
getEmpIdcard
());
tEmployeeContractInfo
.
setEmpName
(
tEmployeeInfo
.
getEmpName
());
tEmployeeContractInfo
.
setEmpNo
(
tEmployeeInfo
.
getEmpCode
());
...
...
@@ -684,10 +688,16 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
@Transactional
public
void
importContract
(
List
<
EmployeeContractVO
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
/// 个性化校验逻辑
ErrorMessage
errorMsg
;
Map
<
Integer
,
Integer
>
errorMsgMap
=
new
HashMap
<>();
if
(
Common
.
isNotNull
(
errorMessageList
))
{
errorMessageList
.
forEach
(
errorMessage
->
errorMsgMap
.
put
(
errorMessage
.
getLineNum
(),
CommonConstants
.
ONE_INT
));
}
EmployeeContractVO
excel
;
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
if
(
errorMsgMap
.
get
(
i
+
2
)
!=
null
)
{
continue
;
}
excel
=
excelVOList
.
get
(
i
);
// 存储
this
.
insertExcel
(
excel
,
errorMessageList
);
...
...
@@ -702,9 +712,28 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
BeanUtil
.
copyProperties
(
excel
,
insert
);
try
{
StringBuilder
errorInfo
=
new
StringBuilder
();
if
(
EmployeeConstants
.
OTHERS
.
equals
(
insert
.
getContractName
())
&&
Common
.
isEmpty
(
insert
.
getContractSubName
()))
{
errorInfo
.
append
(
EmployeeConstants
.
SUB_MUST
);
}
if
(!
EmployeeConstants
.
CONTRACT_TYPE_TWO
.
equals
(
insert
.
getContractType
())
&&
Common
.
isEmpty
(
insert
.
getContractEnd
()))
{
errorInfo
.
append
(
EmployeeConstants
.
CONTRACT_END_MUST
);
}
if
(
Common
.
isEmpty
(
insert
.
getEmpIdcard
())
||
Common
.
isEmpty
(
insert
.
getDeptNo
()))
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
EMPID_NOT_EMPTY
));
errorInfo
.
append
(
EmployeeConstants
.
EMPID_NOT_EMPTY
);
}
else
{
TEmployeeContractInfo
contractInfo
=
this
.
getOne
(
Wrappers
.<
TEmployeeContractInfo
>
query
().
lambda
()
.
eq
(
TEmployeeContractInfo:
:
getEmpIdcard
,
insert
.
getEmpIdcard
())
.
eq
(
TEmployeeContractInfo:
:
getDeptNo
,
insert
.
getDeptNo
())
.
eq
(
TEmployeeContractInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TEmployeeContractInfo:
:
getInUse
,
CommonConstants
.
ZERO_STRING
).
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
contractInfo
==
null
)
{
errorInfo
.
append
(
EmployeeConstants
.
CONTRACT_NO_IN_USE
);
}
}
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
errorInfo
.
toString
()));
if
(
Common
.
isEmpty
(
errorInfo
.
toString
()))
{
TEmployeeProject
project
=
tEmployeeProjectService
.
getOne
(
Wrappers
.<
TEmployeeProject
>
query
().
lambda
()
.
eq
(
TEmployeeProject:
:
getEmpIdcard
,
insert
.
getEmpIdcard
())
.
eq
(
TEmployeeProject:
:
getDeptNo
,
insert
.
getDeptNo
())
...
...
@@ -715,10 +744,21 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
else
{
insert
.
setEmpId
(
project
.
getEmpId
());
insert
.
setSettleDomain
(
project
.
getDeptId
());
// 批量直接待审核
insert
.
setAuditStatus
(
CommonConstants
.
ONE_INT
);
if
(
Common
.
isEmpty
(
insert
.
getContractTerm
())
&&
Common
.
isNotNull
(
insert
.
getContractStart
())
&&
Common
.
isNotNull
(
insert
.
getContractEnd
()))
{
int
monthDiff
=
DateUtil
.
getMonthDiff
(
insert
.
getContractStart
(),
insert
.
getContractEnd
());
BigDecimal
b
=
new
BigDecimal
(
String
.
valueOf
(
monthDiff
/
12.0
));
b
=
b
.
setScale
(
1
,
BigDecimal
.
ROUND_HALF_UP
);
insert
.
setContractTerm
(
String
.
valueOf
(
b
));
}
// 核心保存
R
<
List
<
ErrorMessage
>>
info
=
this
.
setBaseInfo
(
insert
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
info
.
getMsg
()));
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"员工合同保存异常:"
+
e
.
getMessage
());
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_FAILED
));
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/util/DateUtil.java
View file @
bf1affd1
...
...
@@ -858,6 +858,24 @@ public class DateUtil {
return
false
;
}
/**
* @param startDate
* @param endDate
* @Description: 计算年月的月份差值(202205-202205=0)想要1自己+1
* @Author: hgw
* @Date: 2022/7/15 12:16
* @return: int
**/
public
static
int
getMonthDiff
(
Date
startDate
,
Date
endDate
)
{
try
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
DATETIME_YYYYMM
);
return
Integer
.
parseInt
(
sdf
.
format
(
endDate
))
-
Integer
.
parseInt
(
sdf
.
format
(
startDate
));
}
catch
(
IllegalFormatException
e
)
{
log
.
error
(
"计算日期月份差,方法名:getMonthDiff,出错:"
,
e
);
return
0
;
}
}
public
static
int
getMonthCountByDate
(
Date
startDate
,
Date
endDate
)
{
// type:1.当月缴当月的 2.当月缴次月的
int
monthC
=
0
;
...
...
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