Commit c14432c0 by kangxiaoshan

1

parent 5ae66cca
......@@ -1611,10 +1611,11 @@ public class ContractServiceImpl implements ContractService {
} else {
if (ContractStatusEnum.CANCEL.getKey().equals(resource.getStatus())) {
//状态变更
//合同作废
resource.setContent(ContractStatusEnum.CANCEL.getValue());
contract.setStatus(ContractStatusEnum.CANCEL.getKey());
} else if (ContractStatusEnum.SUSPEND.getKey().equals(resource.getStatus())) {
//合同中止
resource.setContent(ContractStatusEnum.SUSPEND.getValue());
contract.setStatus(ContractStatusEnum.SUSPEND.getKey());
}
......@@ -1622,12 +1623,10 @@ public class ContractServiceImpl implements ContractService {
}
resource.setPlatform(contract.getPlatform());
resource.setCreateAccount(loginUser.getId());
resource.setCreateTime(new Date());
resource.setDs(DateUtil.getBeforeDays(0));
resource.setUser(loginUser.getId());
if (ContractStatusEnum.SUSPEND.getKey().equals(resource.getStatus())) {
resource.setCreateTime(new DateTime(resource.getDs()).toDate());
resource.setCreateTime(new Date());
} else {
resource.setCreateTime(new Date());
resource.setDs(DateUtil.getBeforeDays(0));
......
......@@ -93,7 +93,7 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
private void caculateShareIncome(Contract contract, DateTime start, DateTime end) {
DateTime create = new DateTime(contract.getCreateTime());
DateTime create = new DateTime(new DateTime(contract.getCreateTime()).toString("yyyy-MM-dd"));
DateTime contractStart = new DateTime(contract.getStartDate());
DateTime contractEnd = new DateTime(contract.getEndDate());
......@@ -141,7 +141,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
//调整金
int daysCancle = Days.daysBetween(cancelDate, contractStart).getDays() + 1;
Long adjustmentFund = daysCancle * excludTax / allDay * -1;
int reservType = ContractStatusEnum.CANCEL.getKey().equals(contract.getStatus()) ? -1 : 1;
Long adjustmentFund = daysCancle * excludTax / allDay * reservType;
if (checkTwoTime(start, cancelDate)) {
contract.setAdjustmentFund(adjustmentFund);
//分摊加入调整金
......@@ -156,16 +157,19 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
//录入时间在次月10以后
if (betweenMonth == 1) {
//相差一月
nextMonth = contractStart.dayOfMonth().withMaximumValue().plusDays(1);//合同开始次月1号
nextMonth = contractStart.dayOfMonth().withMaximumValue().plusDays(1);//合同开始次月1号 与调整金对应
} else if (betweenMonth > 1) {
//相差多月
nextMonth = creatMonth.plusDays(-1).dayOfMonth().withMinimumValue();//合同录入月上月1号
nextMonth = creatMonth;//合同录入月1号 与调整金对应
} else {
//相差小于1月
nextMonth = null;
}
if (nextMonth == null || checkTwoTime(nextMonth, end)) {
if (nextMonth != null && end.isBefore(nextMonth.plusDays(betweenMonth > 1 ? -1 : 0))) {
//当月(上月)及之前 无分摊收入
contract.setIntervaIncomeShare(0L);
} else if (nextMonth == null || (checkTwoTime(nextMonth, end))) {
if (nextMonth == null) {
//执行期内的分摊金额开始时间
nextMonth = usedStart;
......@@ -175,8 +179,7 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
Long shareIncomDay = contract.getMoney() * 94 / allDay;
//时间范围内用于计算分摊金额的天数
DateTime shareStart = nextMonth.compareTo(start) >= 0 ? nextMonth : start;
int daysIncom = Days.daysBetween(shareStart, usedEnd).getDays() + 1;
int daysIncom = Days.daysBetween(start, usedEnd).getDays() + 1;
//区间分摊总收入
contract.setIntervaIncomeShare(shareIncomDay * daysIncom);
} else {
......@@ -185,16 +188,24 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
//调证金 筛选时间包含录入月1号 则计算调证金
//调证金:(合同开始月最后一日 - 合同开始日期 + 1)* (不含税收入 / 合同总天数)
Long adjustmentFund = nextMonth == null ? 0 : (contractStart.dayOfMonth().withMaximumValue().dayOfMonth().get()
- contractStart.getDayOfMonth() + 1) * excludTax / allDay;
Long adjustmentFund;
if (betweenMonth == 1) {
adjustmentFund = nextMonth == null ? 0 : (contractStart.dayOfMonth().withMaximumValue().dayOfMonth().get()
- contractStart.getDayOfMonth() + 1) * excludTax / allDay;
} else {
adjustmentFund = nextMonth == null ? 0 :
(nextMonth.plusDays(-1).dayOfMonth().withMaximumValue().dayOfMonth().get() - contractStart.getDayOfMonth() + 1)
* excludTax / allDay;
}
if (nextMonth != null && checkTwoTime(start, creatMonth) && checkTwoTime(end, nextMonth)) {
if (nextMonth != null && checkTwoTime(start, creatMonth) && checkTwoTime(nextMonth, end)) {
contract.setAdjustmentFund(adjustmentFund);
} else {
contract.setAdjustmentFund(0L);
}
if (nextMonth != null && checkTwoTime(start, nextMonth)) {
if (nextMonth != null && checkTwoTime(start, nextMonth) && checkTwoTime(nextMonth, end)) {
//筛选开始时间包含次月1号,则分摊金需加上调证金
contract.setIntervaIncomeShare(contract.getIntervaIncomeShare() + adjustmentFund);
}
......
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