update
This commit is contained in:
parent
5dfb7a8f31
commit
bb48236480
File diff suppressed because one or more lines are too long
|
|
@ -55,11 +55,17 @@ public class YxVipCardServiceImpl extends ServiceImpl<YxVipCardMapper, YxVipCard
|
|||
yxVipCard.setUserId(userId);
|
||||
Date date = new Date();
|
||||
yxVipCard.setUsedTime(date);
|
||||
//计算有效期至
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.DATE,yxVipCard.getValidTime());
|
||||
yxVipCard.setValidDate(calendar.getTime());
|
||||
if (yxVipCard.getValidTime()==null || yxVipCard.getValidTime() == 0 && yxVipCard.getValidDate()!=null) {
|
||||
//固定有效期
|
||||
AssertUtils.notTrue(yxVipCard.getValidDate().getTime()<=date.getTime(),"该卡已过有效期");
|
||||
}else{
|
||||
//固定时间
|
||||
//计算有效期至
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.DATE,yxVipCard.getValidTime());
|
||||
yxVipCard.setValidDate(calendar.getTime());
|
||||
}
|
||||
this.updateById(yxVipCard);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue