Commit 5cbf4f23 by kangxiaoshan

处理指定合同分摊收入

parent e8cae298
...@@ -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; contract.setAdjustmentFund(0L);
contract.setIncomeExcludingTax(new BigDecimal(24268.88 * 100).add(new BigDecimal(31202.8181132075 * 100))
.setScale(2, BigDecimal.ROUND_HALF_UP).longValue());
BigDecimal dayShare = null; BigDecimal dayShare_19 = new BigDecimal(24268.88).multiply(new BigDecimal(100))
if (checkTwoTime(usePart[0], middlePoiont[0]) && checkTwoTime(middlePoiont[1], usePart[1])) { .divide(new BigDecimal(161), 15, BigDecimal.ROUND_HALF_UP);
//跨年选择 处理方式待定
contract.setIntervaIncomeShare(0L);
contract.setIncomeExcludingTax(0L);
contract.setAdjustmentFund(0L);
contract.setIncomeShareAll(contract.getIntervaIncomeShare());
return contract;
} 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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment