Commit 6db3387d by kangxiaoshan

调整金

parent 75ac6503
...@@ -11,6 +11,7 @@ import dic.RoleEnum; ...@@ -11,6 +11,7 @@ import dic.RoleEnum;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.Days; import org.joda.time.Days;
import org.joda.time.Months;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -82,8 +83,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService { ...@@ -82,8 +83,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
} }
} }
/* contracts = new ArrayList<>(); /*contracts = new ArrayList<>();
contracts.add(contractRepository.findOne(1360L));*/ contracts.add(contractRepository.findOne(4603L));*/
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 +114,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService { ...@@ -113,6 +114,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]
}; };
usePart[0] = usePart[0].compareTo(usePart[1]) >= 0 ? usePart[1] : usePart[0];
/*DateTime[][] mainTimes = new DateTime[][]{selected, contractPart, usePart};*/ /*DateTime[][] mainTimes = new DateTime[][]{selected, contractPart, usePart};*/
contract.setIntervalUseDays(getDayRange(contractPart[0], usePart[1]) + 1); contract.setIntervalUseDays(getDayRange(contractPart[0], usePart[1]) + 1);
...@@ -152,7 +155,7 @@ public class ShareIncomeServiceImpl implements ShareIncomeService { ...@@ -152,7 +155,7 @@ 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 = Months.monthsBetween(contractPart[0], creatPoints[0]).getMonths();
//时间范围内用于计算分摊金额的天数 //时间范围内用于计算分摊金额的天数
int daysIncom = getDayRange(usePart[0], usePart[1]) + 1; int daysIncom = getDayRange(usePart[0], usePart[1]) + 1;
//区间分摊总收入 //区间分摊总收入
......
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