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
5cbf4f23
Commit
5cbf4f23
authored
4 years ago
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理指定合同分摊收入
parent
e8cae298
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
33 deletions
+27
-33
ShareIncomeServiceImpl.java
...main/java/common/service/impl/ShareIncomeServiceImpl.java
+27
-33
No files found.
src/main/java/common/service/impl/ShareIncomeServiceImpl.java
View file @
5cbf4f23
...
@@ -115,7 +115,9 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -115,7 +115,9 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
public
void
shareIncome4Contract
(
Contract
contract
,
DateTime
start
,
DateTime
end
)
{
public
void
shareIncome4Contract
(
Contract
contract
,
DateTime
start
,
DateTime
end
)
{
DateTime
[]
selected
=
new
DateTime
[]{
start
,
end
};
DateTime
[]
selected
=
new
DateTime
[]{
start
,
end
};
DateTime
[]
contractPart
=
new
DateTime
[]{
DateTime
[]
contractPart
=
new
DateTime
[]{
new
DateTime
(
contract
.
getStartDate
()),
new
DateTime
(
contract
.
getStartDate
()),
new
DateTime
(
contract
.
getEndDate
())};
//合同开始结束 时间
new
DateTime
(
contract
.
getEndDate
())};
//合同开始结束 时间
...
@@ -126,7 +128,6 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -126,7 +128,6 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
usePart
[
0
]
=
usePart
[
0
].
compareTo
(
usePart
[
1
])
>=
0
?
usePart
[
1
]
:
usePart
[
0
];
usePart
[
0
]
=
usePart
[
0
].
compareTo
(
usePart
[
1
])
>=
0
?
usePart
[
1
]
:
usePart
[
0
];
contract
.
setIntervalUseDays
(
getDayRange
(
contractPart
[
0
],
usePart
[
1
])
+
1
);
contract
.
setIntervalUseDays
(
getDayRange
(
contractPart
[
0
],
usePart
[
1
])
+
1
);
Long
excludTax
=
new
BigDecimal
(
contract
.
getMoney
()
/
1.06
)
Long
excludTax
=
new
BigDecimal
(
contract
.
getMoney
()
/
1.06
)
...
@@ -135,7 +136,6 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -135,7 +136,6 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
int
contractAllDay
=
getDayRange
(
contractPart
[
0
],
contractPart
[
1
])
+
1
;
//合同总天数
int
contractAllDay
=
getDayRange
(
contractPart
[
0
],
contractPart
[
1
])
+
1
;
//合同总天数
//处理精度
//处理精度
BigDecimal
dayShareIncome
=
new
BigDecimal
(
excludTax
*
1.0
/
contractAllDay
);
BigDecimal
dayShareIncome
=
new
BigDecimal
(
excludTax
*
1.0
/
contractAllDay
);
//作废合同处理
//作废合同处理
...
@@ -183,47 +183,41 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -183,47 +183,41 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
DateTime
[]
middlePoiont
=
new
DateTime
[]{
new
DateTime
(
"2019-12-31"
),
new
DateTime
(
"2020-01-01"
)};
DateTime
[]
middlePoiont
=
new
DateTime
[]{
new
DateTime
(
"2019-12-31"
),
new
DateTime
(
"2020-01-01"
)};
int
daysIncom
=
getDayRange
(
usePart
[
0
],
usePart
[
1
])
+
1
;
BigDecimal
dayShare
=
null
;
if
(
checkTwoTime
(
usePart
[
0
],
middlePoiont
[
0
])
&&
checkTwoTime
(
middlePoiont
[
1
],
usePart
[
1
]))
{
//跨年选择 处理方式待定
contract
.
setIntervaIncomeShare
(
0L
);
contract
.
setIncomeExcludingTax
(
0L
);
contract
.
setAdjustmentFund
(
0L
);
contract
.
setAdjustmentFund
(
0L
);
contract
.
setIncomeShareAll
(
contract
.
getIntervaIncomeShare
());
contract
.
setIncomeExcludingTax
(
new
BigDecimal
(
24268.88
*
100
).
add
(
new
BigDecimal
(
31202.8181132075
*
100
))
return
contract
;
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
());
BigDecimal
dayShare_19
=
new
BigDecimal
(
24268.88
).
multiply
(
new
BigDecimal
(
100
))
.
divide
(
new
BigDecimal
(
161
),
15
,
BigDecimal
.
ROUND_HALF_UP
);
}
else
if
(
checkTwoTime
(
usePart
[
1
],
middlePoiont
[
0
]))
{
//选择时间范围内 20 年分摊天数 及每天分摊
//按19年处理
BigDecimal
dayShare_20
=
new
BigDecimal
(
31202.8181132075
).
multiply
(
new
BigDecimal
(
100
))
dayShare
=
new
BigDecimal
(
24268.88
*
100
*
1.0
/
161
);
.
divide
(
new
BigDecimal
(
205
),
15
,
BigDecimal
.
ROUND_HALF_UP
);
contract
.
setIncomeExcludingTax
(
new
BigDecimal
(
24268.88
*
100
).
longValue
());
if
(
checkTwoTime
(
usePart
[
0
],
middlePoiont
[
0
])
&&
checkTwoTime
(
middlePoiont
[
1
],
usePart
[
1
]))
{
//选择时间范围内 19 年分摊天数 及每天分摊
Long
allDayShare
=
dayShare_19
.
multiply
(
new
BigDecimal
(
getDayRange
(
usePart
[
0
],
middlePoiont
[
0
])
+
1
))
.
add
(
dayShare_20
.
multiply
(
new
BigDecimal
(
getDayRange
(
middlePoiont
[
1
],
usePart
[
1
])
+
1
)))
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
();
contract
.
setIntervaIncomeShare
(
allDayShare
);
}
else
{
}
else
{
//按20年处理
dayShare
=
new
BigDecimal
(
31202.8181132075
).
multiply
(
new
BigDecimal
(
100
))
.
divide
(
new
BigDecimal
(
205
),
15
,
BigDecimal
.
ROUND_HALF_UP
);
contract
.
setIncomeExcludingTax
(
new
BigDecimal
(
31202.8181132075
).
multiply
(
new
BigDecimal
(
100
))
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
());
}
int
days
=
getDayRange
(
usePart
[
0
],
usePart
[
1
])
+
1
;
contract
.
setIntervaIncomeShare
(
shareMultiply
(
dayShare
,
new
BigDecimal
(
daysIncom
),
0
));
if
(
checkTwoTime
(
usePart
[
1
],
middlePoiont
[
0
]))
{
//19 年
contract
.
setIntervaIncomeShare
(
shareMultiply
(
dayShare_19
,
new
BigDecimal
(
days
),
2
));
/*if (usePart[1].equals(middlePoiont[0])) {
}
else
{
//包含19年最后一日
//20 年
long last = contract.getIncomeExcludingTax() - dayShare.setScale(0, BigDecimal.ROUND_HALF_UP).longValue() * 160;
contract
.
setIntervaIncomeShare
(
shareMultiply
(
dayShare_20
,
new
BigDecimal
(
days
),
2
));
contract.setIntervaIncomeShare(shareMultiply(dayShare, new BigDecimal(daysIncom - 1), 0) + last);
} else if (checkTwoTime(middlePoiont[1], usePart[1])) {
}
// 20 年包含合同最后一日
}
long last = contract.getIncomeExcludingTax() - dayShare.setScale(0, BigDecimal.ROUND_HALF_UP).longValue() * 204;
contract.setIntervaIncomeShare(shareMultiply(dayShare, new BigDecimal(daysIncom - 1), 0) + last);
}*/
contract
.
setAdjustmentFund
(
0L
);
contract
.
setIncomeShareAll
(
contract
.
getIntervaIncomeShare
());
contract
.
setIncomeShareAll
(
contract
.
getIntervaIncomeShare
());
return
contract
;
return
contract
;
}
}
private
void
afterContract
(
Contract
contract
,
int
contractAllDay
,
BigDecimal
dayShareIncome
,
private
void
afterContract
(
Contract
contract
,
int
contractAllDay
,
BigDecimal
dayShareIncome
,
...
...
This diff is collapsed.
Click to expand it.
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