Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
manager
Project
Overview
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
reyun
manager
Commits
9c21f52c
Commit
9c21f52c
authored
Jul 04, 2020
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合同晚录
parent
5b8e2f16
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
19 deletions
+48
-19
ShareIncomeService.java
src/main/java/common/service/ShareIncomeService.java
+3
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+16
-7
ShareIncomeServiceImpl.java
...main/java/common/service/impl/ShareIncomeServiceImpl.java
+27
-11
ContractStatusEnum.java
src/main/java/dic/ContractStatusEnum.java
+2
-1
No files found.
src/main/java/common/service/ShareIncomeService.java
View file @
9c21f52c
...
...
@@ -2,10 +2,13 @@ package common.service;
import
common.model.Contract
;
import
common.model.User
;
import
org.joda.time.DateTime
;
import
java.util.List
;
public
interface
ShareIncomeService
{
List
<
Contract
>
shareIncomeList
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
,
String
bodyCode
,
String
serchName
);
boolean
checkLateContract
(
DateTime
dateTime
,
DateTime
creatTime
);
}
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
9c21f52c
...
...
@@ -4,10 +4,7 @@ import adi.model.ADIUser;
import
adi.service.ADIAccountService
;
import
common.model.*
;
import
common.repository.*
;
import
common.service.AuthService
;
import
common.service.ContractService
;
import
common.service.TransactionUtils
;
import
common.service.UserService
;
import
common.service.*
;
import
dic.ContractStatusEnum
;
import
dic.ContractTypeEnum
;
import
dic.RoleEnum
;
...
...
@@ -201,6 +198,9 @@ public class ContractServiceImpl implements ContractService {
@Autowired
TransactionUtils
transactionUtils
;
@Autowired
ShareIncomeService
shareIncomeService
;
@Override
public
Map
<
String
,
Object
>
checkAccount
(
String
email
,
String
platfrom
)
{
...
...
@@ -494,6 +494,17 @@ public class ContractServiceImpl implements ContractService {
resource
.
setStatus
(
ContractStatusEnum
.
NFORMAL
.
getKey
());
}
DateTime
[]
datePoints
=
new
DateTime
[]{
new
DateTime
(
resource
.
getStartDate
()),
new
DateTime
(
new
DateTime
().
toString
(
"yyyy-MM-dd"
))
};
if
(
shareIncomeService
.
checkLateContract
(
new
DateTime
(
resource
.
getStartDate
()),
new
DateTime
(
new
DateTime
().
toString
(
"yyyy-MM-dd"
))))
{
resource
.
setStatus
(
ContractStatusEnum
.
LATE
.
getKey
());
}
if
(
resource
.
getRelationContract
()
==
null
)
{
resource
.
setRelationContract
(-
1L
);
}
...
...
@@ -808,9 +819,7 @@ public class ContractServiceImpl implements ContractService {
}
}
if
(
resource
.
getStatus
()
==
null
)
{
resource
.
setStatus
(
ContractStatusEnum
.
NFORMAL
.
getKey
());
}
resource
.
setStatus
(
contract
.
getStatus
());
this
.
calculateShareIncome
(
resource
);
...
...
src/main/java/common/service/impl/ShareIncomeServiceImpl.java
View file @
9c21f52c
...
...
@@ -82,8 +82,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
}
}
//
contracts = new ArrayList<>();
//contracts.add(contractRepository.findOne(1361
L));
contracts
=
new
ArrayList
<>();
contracts
.
add
(
contractRepository
.
findOne
(
1355
L
));
List
<
ContractBody
>
bodies
=
contractBodyRepository
.
findAll
();
Map
<
String
,
String
>
bodiesNameMap
=
bodies
.
stream
().
collect
(
...
...
@@ -150,7 +150,7 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
private
void
afterContract
(
Contract
contract
,
int
contractAllDay
,
Long
dayShareIncome
,
DateTime
[]
contractPart
,
DateTime
[]
usePart
,
DateTime
[]
selected
,
DateTime
[]
creatPoints
)
{
int
aferDays
=
contractPart
[
0
].
monthOfYear
().
get
()
==
12
?
29
:
9
;
int
betweenMonth
=
creatPoints
[
0
].
getMonthOfYear
()
-
contractPart
[
0
].
getMonthOfYear
();
//时间范围内用于计算分摊金额的天数
int
daysIncom
=
getDayRange
(
usePart
[
0
],
usePart
[
1
])
+
1
;
...
...
@@ -158,7 +158,9 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
contract
.
setIntervaIncomeShare
(
dayShareIncome
*
daysIncom
);
Long
adjustmentFund
=
0L
;
//调整金
if
(!
contractPart
[
0
].
dayOfMonth
().
withMaximumValue
().
plusDays
(
aferDays
).
isBefore
(
creatPoints
[
0
])
||
betweenMonth
<
1
)
{
int
aferDays
=
contractPart
[
0
].
monthOfYear
().
get
()
==
12
?
29
:
9
;
if
(!
ContractStatusEnum
.
LATE
.
getKey
().
equals
(
contract
.
getStatus
())
||
!
checkLateContract
(
contractPart
[
0
],
creatPoints
[
0
])
||
betweenMonth
<
1
)
{
//非合同晚录
contract
.
setAdjustmentFund
(
0L
);
contract
.
setIncomeShareAll
(
contract
.
getIntervaIncomeShare
());
...
...
@@ -167,16 +169,20 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
//录入月1号之前 调整金为 0
contract
.
setIntervaIncomeShare
(
0L
);
contract
.
setIncomeShareAll
(
contract
.
getIntervaIncomeShare
());
contract
.
setStatus
(
ContractStatusEnum
.
LATE
.
getKey
());
}
else
{
contract
.
setStatus
(
ContractStatusEnum
.
LATE
.
getKey
());
//合同晚录
//所选时间范围内的分摊收入(录入月1号开始计算)
DateTime
useStart
=
creatPoints
[
1
].
compareTo
(
selected
[
0
])
>=
0
?
creatPoints
[
1
]
:
selected
[
0
];
daysIncom
=
getDayRange
(
useStart
,
usePart
[
1
])
+
1
;
contract
.
setIntervaIncomeShare
(
dayShareIncome
*
daysIncom
);
//时间范围内分摊金
adjustmentFund
=
new
BigDecimal
(((
getDayRange
(
contractPart
[
0
],
creatPoints
[
1
].
plusDays
(-
1
))
+
1
)
/*
adjustmentFund = new BigDecimal(((getDayRange(contractPart[0], creatPoints[1].plusDays(-1)) + 1)
* contract.getIncomeExcludingTax() * 1.0 / contractAllDay))
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
();
.setScale(0, BigDecimal.ROUND_HALF_UP).longValue();*/
adjustmentFund
=
(
getDayRange
(
contractPart
[
0
],
creatPoints
[
1
].
plusDays
(-
1
))
+
1
)
*
dayShareIncome
;
if
(
checkTwoTime
(
selected
[
0
],
creatPoints
[
1
])
&&
checkTwoTime
(
creatPoints
[
1
],
selected
[
1
]))
{
//所选时间范围包含 录入月 1 号 显示统计的调整金
...
...
@@ -224,9 +230,11 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
if
(
checkTwoTime
(
suspendDate
,
cancelDate
))
{
adjustmentFund
=
0L
;
}
else
{
adjustmentFund
=
new
BigDecimal
((
getDayRange
(
cancelDate
,
suspendDate
)
+
1
)
/*
adjustmentFund = new BigDecimal((getDayRange(cancelDate, suspendDate) + 1)
* contract.getIncomeExcludingTax() * 1.0 / contractAllDay)
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
()
*
-
1
;
.setScale(0, BigDecimal.ROUND_HALF_UP).longValue() * -1;*/
adjustmentFund
=
(
getDayRange
(
cancelDate
,
suspendDate
)
+
1
)
*
dayShareIncome
*
(-
1
);
}
DateTime
usedEnd
=
usePart
[
1
].
compareTo
(
cancelDate
)
<=
0
?
usePart
[
1
]
:
cancelDate
;
...
...
@@ -265,11 +273,11 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
// 合同终止日 或 作废日
DateTime
cancelDate
=
new
DateTime
(
contractChange
.
getDs
());
Long
adjustmentFund
=
new
BigDecimal
((
Days
.
daysBetween
(
contractPart
[
0
],
cancelDate
).
getDays
()
+
1
)
*
contract
.
getIncomeExcludingTax
()
*
1.0
/
contractAllDay
)
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
()
*
-
1
;
Long
adjustmentFund
=
(
getDayRange
(
contractPart
[
0
],
cancelDate
)
+
1
)
*
dayShareIncome
*
(-
1
);
DateTime
usedEnd
=
usePart
[
1
].
compareTo
(
cancelDate
)
<=
0
?
usePart
[
1
]
:
cancelDate
;
int
daysIncom
=
Days
.
daysBetween
(
usePart
[
0
],
usedEnd
).
getDays
()
+
1
;
daysIncom
=
daysIncom
<
0
?
0
:
daysIncom
;
//区间分摊总收入
...
...
@@ -290,6 +298,14 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
return
contract
;
}
@Override
public
boolean
checkLateContract
(
DateTime
dateTime
,
DateTime
creatTime
)
{
int
aferDays
=
dateTime
.
monthOfYear
().
get
()
==
12
?
29
:
9
;
return
dateTime
.
dayOfMonth
().
withMaximumValue
().
plusDays
(
aferDays
).
isBefore
(
creatTime
);
}
private
int
getDayRange
(
DateTime
range1
,
DateTime
range2
)
{
return
Days
.
daysBetween
(
range1
,
range2
).
getDays
();
}
...
...
src/main/java/dic/ContractStatusEnum.java
View file @
9c21f52c
...
...
@@ -21,7 +21,8 @@ public enum ContractStatusEnum {
MONEY_BACK_FIRST
(
"backfirst"
,
"先回款待录入"
),
CANCEL
(
"cancel"
,
"作废"
),
SUSPEND
(
"suspend"
,
"中止"
),
NFORMAL
(
"normal"
,
"常规"
),
NFORMAL
(
"normal"
,
"常规"
),
LATE
(
"late"
,
"晚录"
),
DELETE
(
"del"
,
"已删除"
),
FIRST_SIGNING
(
"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