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
ca97b857
Commit
ca97b857
authored
Jul 02, 2025
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huych-合同自动化代码提交
parent
4962db12
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
TEmployeeContractInfoServiceImpl.java
...chives/service/impl/TEmployeeContractInfoServiceImpl.java
+14
-4
TEmployeeContractPreServiceImpl.java
...rchives/service/impl/TEmployeeContractPreServiceImpl.java
+1
-0
DateUtil.java
...om/yifu/cloud/plus/v1/yifu/common/core/util/DateUtil.java
+13
-0
No files found.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeContractInfoServiceImpl.java
View file @
ca97b857
...
@@ -68,6 +68,7 @@ import java.io.IOException;
...
@@ -68,6 +68,7 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.ZoneId
;
...
@@ -1427,10 +1428,19 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
...
@@ -1427,10 +1428,19 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
if
(
Common
.
isEmpty
(
insert
.
getContractTerm
())
if
(
Common
.
isEmpty
(
insert
.
getContractTerm
())
&&
Common
.
isNotNull
(
insert
.
getContractStart
())
&&
Common
.
isNotNull
(
insert
.
getContractStart
())
&&
Common
.
isNotNull
(
insert
.
getContractEnd
()))
{
&&
Common
.
isNotNull
(
insert
.
getContractEnd
()))
{
int
monthDiff
=
DateUtil
.
getMonthDiff
(
insert
.
getContractStart
(),
insert
.
getContractEnd
());
//1.9.12合同年限优化
BigDecimal
b
=
new
BigDecimal
(
String
.
valueOf
(
monthDiff
/
12.0
));
long
daysDiff
=
DateUtil
.
getDaysDiff
(
insert
.
getContractStart
(),
insert
.
getContractEnd
());
b
=
b
.
setScale
(
1
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
daysDiff
<
0
)
{
insert
.
setContractTerm
(
String
.
valueOf
(
b
));
insert
.
setContractTerm
(
"0.0"
);
}
else
{
double
years
=
daysDiff
/
365.25
;
// 考虑闰年因素
BigDecimal
b
=
BigDecimal
.
valueOf
(
years
).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
insert
.
setContractTerm
(
b
.
toString
());
}
// 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
,
project
);
R
<
List
<
ErrorMessage
>>
info
=
this
.
setBaseInfo
(
insert
,
project
);
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeContractPreServiceImpl.java
View file @
ca97b857
...
@@ -299,6 +299,7 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra
...
@@ -299,6 +299,7 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra
.
set
(
TEmployeeContractPre:
:
getErrorInfo
,
errorMessage
.
getMessage
())
.
set
(
TEmployeeContractPre:
:
getErrorInfo
,
errorMessage
.
getMessage
())
.
set
(
TEmployeeContractPre:
:
getErrorTime
,
LocalDateTimeUtils
.
convertLDToDate
(
LocalDate
.
now
()));
.
set
(
TEmployeeContractPre:
:
getErrorTime
,
LocalDateTimeUtils
.
convertLDToDate
(
LocalDate
.
now
()));
// 执行更新操作
// 执行更新操作
errorMessage
.
setData
(
contractVO
);
this
.
update
(
updateWrapper
);
this
.
update
(
updateWrapper
);
}
}
}
}
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/DateUtil.java
View file @
ca97b857
...
@@ -11,8 +11,10 @@ import java.text.DateFormat;
...
@@ -11,8 +11,10 @@ import java.text.DateFormat;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.Instant
;
import
java.time.Instant
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.ZoneId
;
import
java.time.temporal.ChronoUnit
;
import
java.time.temporal.TemporalAdjusters
;
import
java.time.temporal.TemporalAdjusters
;
import
java.util.*
;
import
java.util.*
;
...
@@ -965,6 +967,17 @@ public class DateUtil {
...
@@ -965,6 +967,17 @@ public class DateUtil {
}
}
}
}
public
static
long
getDaysDiff
(
Date
startDate
,
Date
endDate
)
{
if
(
startDate
==
null
||
endDate
==
null
)
return
0
;
// 标准化为 LocalDate(忽略时间部分)
LocalDate
start
=
startDate
.
toInstant
().
atZone
(
ZoneId
.
systemDefault
()).
toLocalDate
();
LocalDate
end
=
endDate
.
toInstant
().
atZone
(
ZoneId
.
systemDefault
()).
toLocalDate
();
// 计算绝对天数差
return
Math
.
abs
(
ChronoUnit
.
DAYS
.
between
(
start
,
end
));
}
/**
/**
* @param date1
* @param date1
* @param date2
* @param date2
...
...
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