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);
|
yxVipCard.setUserId(userId);
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
yxVipCard.setUsedTime(date);
|
yxVipCard.setUsedTime(date);
|
||||||
//计算有效期至
|
if (yxVipCard.getValidTime()==null || yxVipCard.getValidTime() == 0 && yxVipCard.getValidDate()!=null) {
|
||||||
Calendar calendar = Calendar.getInstance();
|
//固定有效期
|
||||||
calendar.setTime(date);
|
AssertUtils.notTrue(yxVipCard.getValidDate().getTime()<=date.getTime(),"该卡已过有效期");
|
||||||
calendar.add(Calendar.DATE,yxVipCard.getValidTime());
|
}else{
|
||||||
yxVipCard.setValidDate(calendar.getTime());
|
//固定时间
|
||||||
|
//计算有效期至
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(date);
|
||||||
|
calendar.add(Calendar.DATE,yxVipCard.getValidTime());
|
||||||
|
yxVipCard.setValidDate(calendar.getTime());
|
||||||
|
}
|
||||||
this.updateById(yxVipCard);
|
this.updateById(yxVipCard);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue