|
|
@@ -1,6 +1,5 @@
|
|
|
package com.awspaas.user.apps.donenow_ivt.utils;
|
|
|
|
|
|
-
|
|
|
import com.actionsoft.sdk.local.SDK;
|
|
|
import com.actionsoft.sdk.local.api.Logger;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -45,20 +44,21 @@ public class PeriodCalculationUtil {
|
|
|
* CALC_METHOD_1STPERIOD/PURCHASE_CALC_METHOD_1STPERIOD
|
|
|
* 610 按月支付 4601 自然月 isNaturalMonth=true userMonthDay=true monthDayType=-1 startMonth=0
|
|
|
* 610 按月支付 4602 开通日期后的完整1个月 isNaturalMonth=false userMonthDay=true monthDayType=0 startMonth=0
|
|
|
+ *
|
|
|
* 611 按季度支付 4596 开通日期所在月+后续2个自然月 isNaturalMonth=true userMonthDay=true monthDayType=-1 startMonth=0
|
|
|
*
|
|
|
- * 611 按季度支付 4597 开通日期所在月 isNaturalMonth=true userMonthDay=true monthDayType=-2 startMonth
|
|
|
+ * 611 按季度支付 4597 开通日期所在月 isNaturalMonth=fasle userMonthDay=true monthDayType=-2 startMonth
|
|
|
*
|
|
|
- * 611 按季度支付 4598 开通日期后的完整一个季度 isNaturalMonth=false userMonthDay=true monthDayType=0 startMonth=0
|
|
|
- * 611 按季度支付 4599 首季度根据固定季度计算 isNaturalMonth=true userMonthDay=true monthDayType=-3 startMonth=0
|
|
|
+ * 611 按季度支付 4598 开通日期后的完整一个季度 isNaturalMonth=true userMonthDay=true monthDayType=0 startMonth=0
|
|
|
+ * 611 按季度支付 4599 首季度根据固定季度计算 isNaturalMonth=false userMonthDay=true monthDayType=-3 startMonth=0
|
|
|
*
|
|
|
*
|
|
|
* 612 按半年支付 4593 开通日期所在月+后续5个自然月 isNaturalMonth=true userMonthDay=true monthDayType=-1 startMonth=0
|
|
|
* 612 按半年支付 4594 开通日期所在月 isNaturalMonth=true userMonthDay=true monthDayType=-2 startMonth=0
|
|
|
* 612 按半年支付 4595 开通日期后的完整半年 isNaturalMonth=false userMonthDay=true monthDayType=0 startMonth=0
|
|
|
*
|
|
|
- * 613 按年支付 4590 开通日期所在月+后续11个自然月 isNaturalMonth=true CALC_METHOD_1STYEAR=4637 userMonthDay=false 或者 CALC_METHOD_1STYEAR=4638 userMonthDay=true monthDayType=-1 startMonth=0
|
|
|
- * 613 按年支付 4591 开通日期所在月 isNaturalMonth=true CALC_METHOD_1STYEAR=4637 userMonthDay=false 或者 CALC_METHOD_1STYEAR=4638 userMonthDay=true monthDayType=-2 startMonth=0
|
|
|
+ * 613 按年支付 4590 开通日期所在月+后续11个自然月 isNaturalMonth=false CALC_METHOD_1STYEAR=4637 userMonthDay=false 或者 CALC_METHOD_1STYEAR=4638 userMonthDay=true monthDayType=-1 startMonth=0
|
|
|
+ * 613 按年支付 4591 开通日期所在月 isNaturalMonth=false CALC_METHOD_1STYEAR=4637 userMonthDay=false 或者 CALC_METHOD_1STYEAR=4638 userMonthDay=true monthDayType=-2 startMonth=0
|
|
|
* 613 按年支付 4592 开通日期后的完整一年 isNaturalMonth=false CALC_METHOD_1STYEAR=4637 userMonthDay=false 或者 CALC_METHOD_1STYEAR=4638 userMonthDay=true monthDayType=0 startMonth=0
|
|
|
*
|
|
|
*
|
|
|
@@ -109,10 +109,6 @@ public class PeriodCalculationUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (ruleCate.equals("613")) {
|
|
|
- userMonthDay = !"4637".equals(CALC_METHOD_1STYEAR);
|
|
|
- }
|
|
|
-
|
|
|
switch (CALC_METHOD_1STPERIOD) {
|
|
|
// 合并:isNaturalMonth=true, userMonthDay=true, monthDayType=-1 的情况
|
|
|
case "4601":
|
|
|
@@ -128,17 +124,22 @@ public class PeriodCalculationUtil {
|
|
|
case "4591":
|
|
|
monthDayType = -2;
|
|
|
break;
|
|
|
+ }
|
|
|
|
|
|
- // 合并:isNaturalMonth=false, userMonthDay=true, monthDayType=0 的情况
|
|
|
- case "4602":
|
|
|
- case "4598":
|
|
|
- case "4595":
|
|
|
- case "4599":
|
|
|
- case "4592":
|
|
|
- isNaturalMonth = false;
|
|
|
- monthDayType = 0;
|
|
|
- break;
|
|
|
+ //按年支付
|
|
|
+ if (ruleCate.equals("613")) {
|
|
|
+ isNaturalMonth = false;//不需要切换到 1月1日
|
|
|
+ userMonthDay = !"4637".equals(CALC_METHOD_1STYEAR);
|
|
|
+ }
|
|
|
+
|
|
|
+ //按半年支付
|
|
|
+ if (ruleCate.equals("612")) {
|
|
|
+ isNaturalMonth = false;//不需要切换到 1月1日 或者 7月1日
|
|
|
}
|
|
|
+ if (CALC_METHOD_1STPERIOD.equals("4601"))
|
|
|
+ isNaturalMonth = true;
|
|
|
+ else
|
|
|
+ isNaturalMonth = false;
|
|
|
|
|
|
return getPeriodList(ruleCate, contractStartDate, periodBeginDate, periodEndDate,
|
|
|
isNaturalMonth, userMonthDay, monthDayType, startMonth);
|
|
|
@@ -197,7 +198,7 @@ public class PeriodCalculationUtil {
|
|
|
contractStartDate = contractStartDate.with(TemporalAdjusters.firstDayOfMonth());
|
|
|
//下月1号
|
|
|
else if (monthDayType == -2)
|
|
|
- contractStartDate = contractStartDate.with(TemporalAdjusters.lastDayOfMonth());
|
|
|
+ contractStartDate = contractStartDate.with(TemporalAdjusters.firstDayOfNextMonth());
|
|
|
//指定日期
|
|
|
else if (monthDayType > 0) {
|
|
|
int totalDays = contractStartDate.lengthOfMonth(); // 获取当月总天数
|
|
|
@@ -532,9 +533,13 @@ public class PeriodCalculationUtil {
|
|
|
endDay = contractStartDate.minusDays(1);
|
|
|
} else if (contractStartDate.isBefore(periodBeginDate)) {
|
|
|
endDay = contractStartDate.plusMonths(1).minusDays(1);
|
|
|
+ while (endDay.isBefore(periodBeginDate)) {
|
|
|
+ endDay = endDay.plusMonths(1);
|
|
|
+ }
|
|
|
} else {
|
|
|
// 合同开始日 = 服务开始日:首个周期为1个月后
|
|
|
- endDay = contractStartDate.plusMonths(1).minusDays(1);
|
|
|
+ //endDay = contractStartDate.plusMonths(1).minusDays(1);
|
|
|
+ return null;
|
|
|
}
|
|
|
// 若结束日超过服务结束日,截断
|
|
|
return endDay.isAfter(periodEndDate) ? periodEndDate : endDay;
|
|
|
@@ -564,8 +569,14 @@ public class PeriodCalculationUtil {
|
|
|
endDay = contractStartDate.minusDays(1);
|
|
|
} else if (contractStartDate.isBefore(periodBeginDate)) {
|
|
|
endDay = contractStartDate.plusMonths(3).minusDays(1);
|
|
|
+
|
|
|
+ while (endDay.isBefore(periodBeginDate)) {
|
|
|
+ endDay = endDay.plusMonths(3);
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
- endDay = contractStartDate.plusMonths(3).minusDays(1);
|
|
|
+ //endDay = contractStartDate.plusMonths(3).minusDays(1);
|
|
|
+ return null;
|
|
|
}
|
|
|
return endDay.isAfter(periodEndDate) ? periodEndDate : endDay;
|
|
|
}
|
|
|
@@ -594,8 +605,14 @@ public class PeriodCalculationUtil {
|
|
|
endDay = contractStartDate.minusDays(1);
|
|
|
} else if (contractStartDate.isBefore(periodBeginDate)) {
|
|
|
endDay = contractStartDate.plusMonths(6).minusDays(1);
|
|
|
+
|
|
|
+ while (endDay.isBefore(periodBeginDate)) {
|
|
|
+ endDay = endDay.plusMonths(6);
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
- endDay = contractStartDate.plusMonths(6).minusDays(1);
|
|
|
+ //endDay = contractStartDate.plusMonths(6).minusDays(1);
|
|
|
+ return null;
|
|
|
}
|
|
|
return endDay.isAfter(periodEndDate) ? periodEndDate : endDay;
|
|
|
}
|
|
|
@@ -624,8 +641,12 @@ public class PeriodCalculationUtil {
|
|
|
endDay = contractStartDate.minusDays(1);
|
|
|
} else if (contractStartDate.isBefore(periodBeginDate)) {
|
|
|
endDay = contractStartDate.plusMonths(12).minusDays(1);
|
|
|
+ while (endDay.isBefore(periodBeginDate)) {
|
|
|
+ endDay = endDay.plusMonths(12);
|
|
|
+ }
|
|
|
} else {
|
|
|
- endDay = contractStartDate.plusMonths(12).minusDays(1);
|
|
|
+ // endDay = contractStartDate.plusMonths(12).minusDays(1);
|
|
|
+ return null;
|
|
|
}
|
|
|
return endDay.isAfter(periodEndDate) ? periodEndDate : endDay;
|
|
|
}
|