|
@@ -97,9 +97,8 @@ public class TMocServiceImpl implements ITMocService
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int delay(DelayVO delayVO) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
|
|
+ public int delay(DelayVO delayVO) {
|
|
|
TMoc tMoc = tMocMapper.selectTMocById(delayVO.getId());
|
|
|
-
|
|
|
Date sealDate = tMoc.getSealDate();
|
|
|
Date extention1 = tMoc.getExtention1();
|
|
|
Date extention2 = tMoc.getExtention2();
|
|
@@ -110,9 +109,7 @@ public class TMocServiceImpl implements ITMocService
|
|
|
Date extention7 = tMoc.getExtention7();
|
|
|
Date extention8 = tMoc.getExtention8();
|
|
|
Date extention9 = tMoc.getExtention9();
|
|
|
-
|
|
|
Date extention = null;
|
|
|
-
|
|
|
// 延期日期为空,自动延期六个月
|
|
|
if (delayVO.getExtention() == null) {
|
|
|
Date now = null;
|
|
@@ -137,23 +134,37 @@ public class TMocServiceImpl implements ITMocService
|
|
|
} else if (sealDate != null) {
|
|
|
now = sealDate;
|
|
|
}
|
|
|
- int month = now.getMonth();
|
|
|
int year = now.getYear();
|
|
|
+ int month = now.getMonth();
|
|
|
int date = now.getDate();
|
|
|
- if (month <= 5) { // 延期后不跨年
|
|
|
- month += 6;
|
|
|
- } else { // 延期后跨年
|
|
|
- month -= 6;
|
|
|
- year++;
|
|
|
+ // 3.31 => 9.30
|
|
|
+ // 5.31 => 11.30
|
|
|
+ // 10.31 => 4.30
|
|
|
+ // 12.31 => 6.30
|
|
|
+ if (month == 2 || month == 4 || month == 9 || month == 11) {
|
|
|
+ if (date == 31) {
|
|
|
+ date = 30;
|
|
|
+ }
|
|
|
}
|
|
|
+ // 8.31 => 2.28/29
|
|
|
+ if (month == 7) {
|
|
|
+ if ((year + 1) % 4 == 0) { // 闰年
|
|
|
+ if (date > 29) {
|
|
|
+ date = 29;
|
|
|
+ }
|
|
|
+ } else { // 非闰年
|
|
|
+ if (date > 28) {
|
|
|
+ date = 28;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ month += 6;
|
|
|
extention = new Date(year, month, date);
|
|
|
} else { // 手动延期
|
|
|
extention = delayVO.getExtention();
|
|
|
}
|
|
|
-
|
|
|
// 到期时间修改为延期时间
|
|
|
tMoc.setExpTime(extention);
|
|
|
-
|
|
|
// 判断第几次延期
|
|
|
if (tMoc.getExtention1() == null) {
|
|
|
tMoc.setExtention1(extention);
|
|
@@ -190,7 +201,6 @@ public class TMocServiceImpl implements ITMocService
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return this.updateTMoc(tMoc);
|
|
|
}
|
|
|
|