bug
This commit is contained in:
@@ -979,15 +979,17 @@ public class BuyOrderController {
|
|||||||
LambdaQueryWrapper<UserCourseBuyEntity> wrapper2 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<UserCourseBuyEntity> wrapper2 = new LambdaQueryWrapper<>();
|
||||||
wrapper2.eq(UserCourseBuyEntity::getUserId,orderEntity.getUserId());
|
wrapper2.eq(UserCourseBuyEntity::getUserId,orderEntity.getUserId());
|
||||||
wrapper2.eq(UserCourseBuyEntity::getCatalogueId,s.getCatalogueId());
|
wrapper2.eq(UserCourseBuyEntity::getCatalogueId,s.getCatalogueId());
|
||||||
wrapper2.gt(UserCourseBuyEntity::getEndTime,new Date());
|
wrapper2.and(r->r.isNull(UserCourseBuyEntity::getEndTime).or().gt(UserCourseBuyEntity::getEndTime,new Date()));
|
||||||
List<UserCourseBuyEntity> userCourseBuyEntities = userCourseBuyDao.selectList(wrapper2);
|
List<UserCourseBuyEntity> userCourseBuyEntities = userCourseBuyDao.selectList(wrapper2);
|
||||||
if(userCourseBuyEntities.size()>0){//延长有效期
|
if(userCourseBuyEntities.size()>0){//延长有效期
|
||||||
UserCourseBuyEntity userCourseBuyEntity = userCourseBuyEntities.get(0);
|
UserCourseBuyEntity userCourseBuyEntity = userCourseBuyEntities.get(0);
|
||||||
|
userCourseBuyEntity.setDays(userCourseBuyEntity.getDays()+s.getDays());
|
||||||
|
if(userCourseBuyEntity.getEndTime()==null){
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTime(userCourseBuyEntity.getEndTime());
|
calendar.setTime(userCourseBuyEntity.getEndTime());
|
||||||
calendar.add(Calendar.DAY_OF_MONTH,s.getDays());
|
calendar.add(Calendar.DAY_OF_MONTH,s.getDays());
|
||||||
userCourseBuyEntity.setDays(userCourseBuyEntity.getDays()+s.getDays());
|
|
||||||
userCourseBuyEntity.setEndTime(calendar.getTime());
|
userCourseBuyEntity.setEndTime(calendar.getTime());
|
||||||
|
}
|
||||||
userCourseBuyDao.updateById(userCourseBuyEntity);
|
userCourseBuyDao.updateById(userCourseBuyEntity);
|
||||||
}else{
|
}else{
|
||||||
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
||||||
|
|||||||
@@ -252,15 +252,17 @@ public class AliPayServiceImpl implements AliPayService {
|
|||||||
LambdaQueryWrapper<UserCourseBuyEntity> wrapper2 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<UserCourseBuyEntity> wrapper2 = new LambdaQueryWrapper<>();
|
||||||
wrapper2.eq(UserCourseBuyEntity::getUserId,orderEntity.getUserId());
|
wrapper2.eq(UserCourseBuyEntity::getUserId,orderEntity.getUserId());
|
||||||
wrapper2.eq(UserCourseBuyEntity::getCatalogueId,s.getCatalogueId());
|
wrapper2.eq(UserCourseBuyEntity::getCatalogueId,s.getCatalogueId());
|
||||||
wrapper2.gt(UserCourseBuyEntity::getEndTime,new Date());
|
wrapper2.and(r->r.isNull(UserCourseBuyEntity::getEndTime).or().gt(UserCourseBuyEntity::getEndTime,new Date()));
|
||||||
List<UserCourseBuyEntity> userCourseBuyEntities = userCourseBuyDao.selectList(wrapper2);
|
List<UserCourseBuyEntity> userCourseBuyEntities = userCourseBuyDao.selectList(wrapper2);
|
||||||
if(userCourseBuyEntities.size()>0){
|
if(userCourseBuyEntities.size()>0){
|
||||||
UserCourseBuyEntity userCourseBuyEntity = userCourseBuyEntities.get(0);
|
UserCourseBuyEntity userCourseBuyEntity = userCourseBuyEntities.get(0);
|
||||||
|
userCourseBuyEntity.setDays(userCourseBuyEntity.getDays()+s.getDays());
|
||||||
|
if(userCourseBuyEntity.getEndTime()==null){
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTime(userCourseBuyEntity.getEndTime());
|
calendar.setTime(userCourseBuyEntity.getEndTime());
|
||||||
calendar.add(Calendar.DAY_OF_MONTH,s.getDays());
|
calendar.add(Calendar.DAY_OF_MONTH,s.getDays());
|
||||||
userCourseBuyEntity.setDays(userCourseBuyEntity.getDays()+s.getDays());
|
|
||||||
userCourseBuyEntity.setEndTime(calendar.getTime());
|
userCourseBuyEntity.setEndTime(calendar.getTime());
|
||||||
|
}
|
||||||
userCourseBuyDao.updateById(userCourseBuyEntity);
|
userCourseBuyDao.updateById(userCourseBuyEntity);
|
||||||
}else{
|
}else{
|
||||||
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
||||||
|
|||||||
@@ -195,15 +195,17 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
|||||||
LambdaQueryWrapper<UserCourseBuyEntity> wrapper2 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<UserCourseBuyEntity> wrapper2 = new LambdaQueryWrapper<>();
|
||||||
wrapper2.eq(UserCourseBuyEntity::getUserId,order.getUserId());
|
wrapper2.eq(UserCourseBuyEntity::getUserId,order.getUserId());
|
||||||
wrapper2.eq(UserCourseBuyEntity::getCatalogueId,s.getCatalogueId());
|
wrapper2.eq(UserCourseBuyEntity::getCatalogueId,s.getCatalogueId());
|
||||||
wrapper2.lt(UserCourseBuyEntity::getEndTime,new Date());
|
wrapper2.and(r->r.isNull(UserCourseBuyEntity::getEndTime).or().gt(UserCourseBuyEntity::getEndTime,new Date()));
|
||||||
List<UserCourseBuyEntity> userCourseBuyEntities = userCourseBuyDao.selectList(wrapper2);
|
List<UserCourseBuyEntity> userCourseBuyEntities = userCourseBuyDao.selectList(wrapper2);
|
||||||
if(userCourseBuyEntities.size()>0){
|
if(userCourseBuyEntities.size()>0){
|
||||||
UserCourseBuyEntity userCourseBuyEntity = userCourseBuyEntities.get(0);
|
UserCourseBuyEntity userCourseBuyEntity = userCourseBuyEntities.get(0);
|
||||||
|
userCourseBuyEntity.setDays(userCourseBuyEntity.getDays()+s.getDays());
|
||||||
|
if(userCourseBuyEntity.getEndTime()==null){
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTime(userCourseBuyEntity.getEndTime());
|
calendar.setTime(userCourseBuyEntity.getEndTime());
|
||||||
calendar.add(Calendar.DAY_OF_MONTH,s.getDays());
|
calendar.add(Calendar.DAY_OF_MONTH,s.getDays());
|
||||||
userCourseBuyEntity.setDays(userCourseBuyEntity.getDays()+s.getDays());
|
|
||||||
userCourseBuyEntity.setEndTime(calendar.getTime());
|
userCourseBuyEntity.setEndTime(calendar.getTime());
|
||||||
|
}
|
||||||
userCourseBuyDao.updateById(userCourseBuyEntity);
|
userCourseBuyDao.updateById(userCourseBuyEntity);
|
||||||
}else{
|
}else{
|
||||||
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
||||||
|
|||||||
Reference in New Issue
Block a user