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
96dcc615
Commit
96dcc615
authored
Jul 04, 2020
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分摊金处理
parent
9c21f52c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
ShareIncomeServiceImpl.java
...main/java/common/service/impl/ShareIncomeServiceImpl.java
+25
-12
No files found.
src/main/java/common/service/impl/ShareIncomeServiceImpl.java
View file @
96dcc615
...
@@ -82,8 +82,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -82,8 +82,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
}
}
}
}
contracts
=
new
ArrayList
<>();
/*
contracts = new ArrayList<>();
contracts
.
add
(
contractRepository
.
findOne
(
1355L
));
contracts.add(contractRepository.findOne(1355L));
*/
List
<
ContractBody
>
bodies
=
contractBodyRepository
.
findAll
();
List
<
ContractBody
>
bodies
=
contractBodyRepository
.
findAll
();
Map
<
String
,
String
>
bodiesNameMap
=
bodies
.
stream
().
collect
(
Map
<
String
,
String
>
bodiesNameMap
=
bodies
.
stream
().
collect
(
...
@@ -113,6 +113,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -113,6 +113,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
selected
[
1
].
compareTo
(
contractPart
[
1
])
>=
0
?
contractPart
[
1
]
:
selected
[
1
]
selected
[
1
].
compareTo
(
contractPart
[
1
])
>=
0
?
contractPart
[
1
]
:
selected
[
1
]
};
};
/*DateTime[][] mainTimes = new DateTime[][]{selected, contractPart, usePart};*/
contract
.
setIntervalUseDays
(
getDayRange
(
contractPart
[
0
],
usePart
[
1
])
+
1
);
contract
.
setIntervalUseDays
(
getDayRange
(
contractPart
[
0
],
usePart
[
1
])
+
1
);
Long
excludTax
=
contract
.
getMoney
()
*
94
;
//不含税收入*100
Long
excludTax
=
contract
.
getMoney
()
*
94
;
//不含税收入*100
...
@@ -121,7 +123,7 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -121,7 +123,7 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
//处理精度
//处理精度
Long
dayShareIncome
=
new
BigDecimal
(
contract
.
getMoney
()
*
94
*
1.0
/
contractAllDay
)
Long
dayShareIncome
=
new
BigDecimal
(
contract
.
getMoney
()
*
94
*
1.0
/
contractAllDay
)
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
();
//每日分摊收入
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
();
//每日分摊收入
(值扩大100倍)
//作废合同处理
//作废合同处理
Contract
cancleContract
=
this
.
cancledShare
(
contract
,
contractAllDay
,
dayShareIncome
,
contractPart
,
usePart
,
selected
);
Contract
cancleContract
=
this
.
cancledShare
(
contract
,
contractAllDay
,
dayShareIncome
,
contractPart
,
usePart
,
selected
);
...
@@ -150,7 +152,6 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -150,7 +152,6 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
private
void
afterContract
(
Contract
contract
,
int
contractAllDay
,
Long
dayShareIncome
,
private
void
afterContract
(
Contract
contract
,
int
contractAllDay
,
Long
dayShareIncome
,
DateTime
[]
contractPart
,
DateTime
[]
usePart
,
DateTime
[]
selected
,
DateTime
[]
creatPoints
)
{
DateTime
[]
contractPart
,
DateTime
[]
usePart
,
DateTime
[]
selected
,
DateTime
[]
creatPoints
)
{
int
betweenMonth
=
creatPoints
[
0
].
getMonthOfYear
()
-
contractPart
[
0
].
getMonthOfYear
();
int
betweenMonth
=
creatPoints
[
0
].
getMonthOfYear
()
-
contractPart
[
0
].
getMonthOfYear
();
//时间范围内用于计算分摊金额的天数
//时间范围内用于计算分摊金额的天数
int
daysIncom
=
getDayRange
(
usePart
[
0
],
usePart
[
1
])
+
1
;
int
daysIncom
=
getDayRange
(
usePart
[
0
],
usePart
[
1
])
+
1
;
...
@@ -158,9 +159,19 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -158,9 +159,19 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
contract
.
setIntervaIncomeShare
(
dayShareIncome
*
daysIncom
);
contract
.
setIntervaIncomeShare
(
dayShareIncome
*
daysIncom
);
Long
adjustmentFund
=
0L
;
//调整金
Long
adjustmentFund
=
0L
;
//调整金
int
aferDays
=
contractPart
[
0
].
monthOfYear
().
get
()
==
12
?
29
:
9
;
if
(!
ContractStatusEnum
.
LATE
.
getKey
().
equals
(
contract
.
getStatus
())
||
boolean
isLateContract
=
false
;
// 是否为晚录合同(为了兼容历史数据 此处做冗余判断)
!
checkLateContract
(
contractPart
[
0
],
creatPoints
[
0
])
||
betweenMonth
<
1
)
{
if
(
ContractStatusEnum
.
LATE
.
getKey
().
equals
(
contract
.
getStatus
()))
{
isLateContract
=
true
;
}
else
if
(
checkLateContract
(
contractPart
[
0
],
creatPoints
[
0
]))
{
isLateContract
=
true
;
}
if
(
isLateContract
)
{
contract
.
setStatus
(
ContractStatusEnum
.
LATE
.
getKey
());
}
if
(!
isLateContract
||
betweenMonth
<
1
)
{
//非合同晚录
//非合同晚录
contract
.
setAdjustmentFund
(
0L
);
contract
.
setAdjustmentFund
(
0L
);
contract
.
setIncomeShareAll
(
contract
.
getIntervaIncomeShare
());
contract
.
setIncomeShareAll
(
contract
.
getIntervaIncomeShare
());
...
@@ -173,15 +184,11 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -173,15 +184,11 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
}
else
{
}
else
{
contract
.
setStatus
(
ContractStatusEnum
.
LATE
.
getKey
());
contract
.
setStatus
(
ContractStatusEnum
.
LATE
.
getKey
());
//合同晚录
//合同晚录
//所选时间范围内的分摊收入(录入月1号开始计算)
//所选时间范围内的分摊收入(录入月1号
即creatPoints[1]
开始计算)
DateTime
useStart
=
creatPoints
[
1
].
compareTo
(
selected
[
0
])
>=
0
?
creatPoints
[
1
]
:
selected
[
0
];
DateTime
useStart
=
creatPoints
[
1
].
compareTo
(
selected
[
0
])
>=
0
?
creatPoints
[
1
]
:
selected
[
0
];
daysIncom
=
getDayRange
(
useStart
,
usePart
[
1
])
+
1
;
daysIncom
=
getDayRange
(
useStart
,
usePart
[
1
])
+
1
;
contract
.
setIntervaIncomeShare
(
dayShareIncome
*
daysIncom
);
//时间范围内分摊金
contract
.
setIntervaIncomeShare
(
dayShareIncome
*
daysIncom
);
//时间范围内分摊金
/*adjustmentFund = new BigDecimal(((getDayRange(contractPart[0], creatPoints[1].plusDays(-1)) + 1)
* contract.getIncomeExcludingTax() * 1.0 / contractAllDay))
.setScale(0, BigDecimal.ROUND_HALF_UP).longValue();*/
adjustmentFund
=
(
getDayRange
(
contractPart
[
0
],
creatPoints
[
1
].
plusDays
(-
1
))
+
1
)
*
dayShareIncome
;
adjustmentFund
=
(
getDayRange
(
contractPart
[
0
],
creatPoints
[
1
].
plusDays
(-
1
))
+
1
)
*
dayShareIncome
;
if
(
checkTwoTime
(
selected
[
0
],
creatPoints
[
1
])
&&
checkTwoTime
(
creatPoints
[
1
],
selected
[
1
]))
{
if
(
checkTwoTime
(
selected
[
0
],
creatPoints
[
1
])
&&
checkTwoTime
(
creatPoints
[
1
],
selected
[
1
]))
{
...
@@ -533,6 +540,12 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -533,6 +540,12 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
();
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
();
System
.
out
.
println
(
ss
);
System
.
out
.
println
(
ss
);
DateTime
[][]
times
=
new
DateTime
[][]{
{
new
DateTime
(),
new
DateTime
()},
{
new
DateTime
(),
new
DateTime
()}
};
System
.
out
.
println
(
times
[
1
][
0
].
toString
());
}
}
}
}
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