Commit 01f68897 by lzxry

bugfix

parent f5c94987
......@@ -250,6 +250,13 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
contract.setOneTimeRecognizedRevenue(oneTimeRecognizedRevenue.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
int contractAllDay = getDayRange(contractValidPart[0], contractValidPart[1]) + 1;//合同总天数
//晚录合同处理
DateTime create = new DateTime(new DateTime(contract.getCreateTime()).toString("yyyy-MM-dd")); //录入时间点
DateTime[] creatPoints = new DateTime[]{
create, //录入日
create.dayOfMonth().withMinimumValue() //录入月1日
};
//处理精度
BigDecimal dayShareIncome = dailyRevenueRecognition.divide(new BigDecimal(String.valueOf(contractAllDay)), 8, BigDecimal.ROUND_HALF_UP);
......@@ -266,18 +273,12 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
}
//晚录合同处理
DateTime create = new DateTime(new DateTime(contract.getCreateTime()).toString("yyyy-MM-dd")); //录入时间点
DateTime[] creatPoints = new DateTime[]{
create, //录入日
create.dayOfMonth().withMinimumValue() //录入月1日
};
this.afterContractCAS(contract, oneTimeRecognizedRevenue, contractAllDay, dayShareIncome, contractPart, usePart, selected, creatPoints, contractValidPart);
}
private void afterContractCAS(Contract contract, BigDecimal oneTimeRecognizedRevenue, int contractAllDay, BigDecimal dayShareIncome, DateTime[] contractPart, DateTime[] usePart, DateTime[] selected, DateTime[] creatPoints, DateTime[] contractValidPart) {
int betweenMonth = Months.monthsBetween(contractPart[0], creatPoints[0]).getMonths();
//时间范围内用于计算分摊金额的天数
int daysIncom = getDayRange(usePart[0], usePart[1]) + 1;
//区间分摊总收入
......@@ -305,12 +306,10 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
contract.setStatus(ContractStatusEnum.LATE.getKey());
}
boolean isLater = true;
if (!isLateContract || betweenMonth < 1) {
if (!isLateContract ) {
//非合同晚录
contract.setAdjustmentFund(0L);
contract.setIncomeShareAll(contract.getIntervaIncomeShare());
isLater = false;
} else if (selected[1].isBefore(creatPoints[1])) {
......@@ -334,10 +333,12 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
adjustmentFund = shareMultiply(dayShareIncome, new BigDecimal(getDayRange(contractValidPart[0], creatPoints[1].plusDays(-1)) + 1), 0);
adjustmentFund += oneTimeRecognizedRevenue.multiply(new BigDecimal("100")).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
//adjustmentFund += oneTimeRecognizedRevenue.multiply(new BigDecimal("100")).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
if (checkTwoTime(selected[0], creatPoints[1]) && checkTwoTime(creatPoints[1], selected[1])) {
//所选时间范围包含 录入月 1 号 显示统计的调整金
contract.setAdjustmentFund(adjustmentFund);
//逻辑变动,所选时间返回包含录入月1号就开始显示一次性确认收入
contract.setOneTimeRecognizedRevenue(oneTimeRecognizedRevenue.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
} else {
contract.setAdjustmentFund(0L);
}
......@@ -355,24 +356,16 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
if (checkTwoTime(contractValidPart[1], selected[1])) {
//最后一日分摊金计算处理
Long lastDay;
if (isLater) {
lastDay = contract.getIncomeExcludingTax() - adjustmentFund
- shareMultiply(dayShareIncome, new BigDecimal(getDayRange(creatPoints[1], contractValidPart[1])), 0);
} else {
//CAS的合同都有“一次性确认收入”,单价是减去一次性确认收入后的,所以计算最后一天的分摊金需要再减去一次性确认收入的金额
lastDay = contract.getIncomeExcludingTax() - adjustmentFund - (contract.getOneTimeRecognizedRevenue().longValue() * 100)
//CAS的合同都有“一次性确认收入”,单价是减去一次性确认收入后的,所以计算最后一天的分摊金需要再减去一次性确认收入的金额
Long lastDay = contract.getIncomeExcludingTax() - adjustmentFund - (oneTimeRecognizedRevenue.longValue() * 100)
- shareMultiply(dayShareIncome, new BigDecimal(getDayRange(contractValidPart[0], contractValidPart[1])), 0);
}
//最后一日 或 包含最后一日 时
contract.setIntervaIncomeShare(contract.getIntervaIncomeShare() -
dayShareIncome.setScale(0, BigDecimal.ROUND_HALF_UP).longValue() + lastDay);
}
Double v = contract.getOneTimeRecognizedRevenue() * 100L;
//contract.setIncomeShareAll(contract.getIntervaIncomeShare() + contract.getAdjustmentFund());
contract.setIncomeShareAll(contract.getIntervaIncomeShare() + contract.getAdjustmentFund() + v.longValue());
}
......@@ -459,8 +452,10 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
DateTime cancelDate = new DateTime(contractChange.getDs());
Long adjustmentFund = shareMultiply(new BigDecimal((getDayRange(contractValidPart[0], cancelDate) + 1) * -1), dayShareIncome, 0);
adjustmentFund -= oneTimeRecognizedRevenue.multiply(new BigDecimal("100")).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
if (checkTwoTime(contractValidPart[0], selected[1]) && checkTwoTime(selected[0], contractValidPart[0])) {
//adjustmentFund -= oneTimeRecognizedRevenue.multiply(new BigDecimal("100")).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
if (checkTwoTime(cancelDate, selected[1]) && checkTwoTime(selected[0], cancelDate)) {
contract.setOneTimeRecognizedRevenue(oneTimeRecognizedRevenue.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()*-1);
}else if (checkTwoTime(contractValidPart[0], selected[1]) && checkTwoTime(selected[0], contractValidPart[0])) {//如果是晚录合同,把一次性确认收入放在录入月1号
} else {
contract.setOneTimeRecognizedRevenue(0.0);
}
......
......@@ -448,7 +448,7 @@ public class TrackingFlowTask {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
String status = restTaskInfoRepository.findStatus(info.getId());
if (!status.equals("init")) {
if (!status.equals("tasking")) {
logger.info("暂停重置流量 ......");
break;
}
......
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