|
@@ -490,23 +490,30 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC
|
|
|
.map(VipCardRecord::getEndTime).max(Date::compareTo).get().getTime() + 1000;
|
|
|
}
|
|
|
}
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(new Date(startTimeMills));
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 23);
|
|
|
- calendar.set(Calendar.MINUTE, 59);
|
|
|
- calendar.set(Calendar.SECOND, 59);
|
|
|
- calendar.set(Calendar.MILLISECOND, 0);
|
|
|
- Date endDate = plusDate(calendar.getTime(), addVipCardRecord.getType(), Long.valueOf(addVipCardRecord.getTimes()));
|
|
|
+
|
|
|
VipCardRecord newRecord = JSON.parseObject(JSON.toJSONString(addVipCardRecord), VipCardRecord.class);
|
|
|
newRecord.setSourceType(addVipCardRecord.getSourceType() !=null?addVipCardRecord.getSourceType():SourceTypeEnum.BACKEND_GIVE);
|
|
|
newRecord.setStatus(EVipRecordStatus.ADD);
|
|
|
newRecord.setStartTime(new Date(startTimeMills));
|
|
|
- newRecord.setEndTime(new Date(endDate.getTime()));
|
|
|
+ if (index == 0) { // 当天剩余时间属于赠送
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(new Date(startTimeMills));
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 23);
|
|
|
+ calendar.set(Calendar.MINUTE, 59);
|
|
|
+ calendar.set(Calendar.SECOND, 59);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ Date endDate = plusDate(calendar.getTime(), addVipCardRecord.getType(), Long.valueOf(addVipCardRecord.getTimes()));
|
|
|
+ newRecord.setEndTime(new Date(endDate.getTime()));
|
|
|
+ } else {
|
|
|
+ Date endDate = plusDate(new Date(startTimeMills - 1000), addVipCardRecord.getType(), Long.valueOf(addVipCardRecord.getTimes()));
|
|
|
+ newRecord.setEndTime(endDate);
|
|
|
+ }
|
|
|
+
|
|
|
newRecord.setDisplayFlag(true);
|
|
|
newRecord.setEfficientFlag(true);
|
|
|
|
|
|
// 平移时间
|
|
|
- long plusMills = endDate.getTime() - startTimeMills;
|
|
|
+// long plusMills = newRecord.getEndTime().getTime() - startTimeMills;
|
|
|
long beforeEndTime = newRecord.getEndTime().getTime();
|
|
|
for (int i = 0; i < vipCardRecordList.size(); i++) {
|
|
|
VipCardRecord vipCardRecord = vipCardRecordList.get(i);
|
|
@@ -516,8 +523,8 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC
|
|
|
|
|
|
addRecord.setStartTime(new Date(beforeEndTime + 1000));
|
|
|
|
|
|
- int days = (int) Math.ceil(plusMills * 1.0D / (24 * 60 * 60 * 1000));
|
|
|
- Date endTime = plusDate(vipCardRecord.getEndTime(), PeriodEnum.DAY, days);
|
|
|
+// int days = (int) Math.ceil(plusMills * 1.0D / (24 * 60 * 60 * 1000));
|
|
|
+ Date endTime = plusDate(vipCardRecord.getEndTime(), addVipCardRecord.getType(), addVipCardRecord.getTimes());
|
|
|
addRecord.setEndTime(endTime);
|
|
|
addRecord.setDisplayFlag(false);
|
|
|
addRecord.setEfficientFlag(true);
|