|
@@ -1,13 +1,17 @@
|
|
|
package com.zhongzheng.modules.user.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.modules.exam.bo.ExamNumberQueryBo;
|
|
|
import com.zhongzheng.modules.exam.domain.ExamNumber;
|
|
|
+import com.zhongzheng.modules.order.domain.Order;
|
|
|
import com.zhongzheng.modules.user.bo.UserSubscribeQueryBo;
|
|
|
+import com.zhongzheng.modules.user.domain.UserExamGoodsSupplement;
|
|
|
import com.zhongzheng.modules.user.mapper.UserSubscribeMapper;
|
|
|
+import com.zhongzheng.modules.user.service.IUserExamGoodsSupplementService;
|
|
|
import com.zhongzheng.modules.user.service.IUserSubscribeService;
|
|
|
import com.zhongzheng.modules.user.vo.UserExamGoodsSupplementVo;
|
|
|
import com.zhongzheng.modules.user.vo.UserSubscribeVo;
|
|
@@ -42,6 +46,9 @@ public class UserExamGoodsServiceImpl extends ServiceImpl<UserExamGoodsMapper, U
|
|
|
@Autowired
|
|
|
private UserSubscribeMapper userSubscribeMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserExamGoodsSupplementService iUserExamGoodsSupplementService;
|
|
|
+
|
|
|
@Override
|
|
|
public UserExamGoodsVo queryById(Long userExamGoodsId){
|
|
|
UserExamGoods db = this.baseMapper.selectById(userExamGoodsId);
|
|
@@ -155,4 +162,29 @@ public class UserExamGoodsServiceImpl extends ServiceImpl<UserExamGoodsMapper, U
|
|
|
public List<UserExamGoodsVo> selectSellGoods(ExamNumberQueryBo bo) {
|
|
|
return baseMapper.selectSellGoods(bo);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean canRefund(UserExamGoodsQueryBo bo) {
|
|
|
+ UserExamGoodsSupplement entity = iUserExamGoodsSupplementService.getOne(new LambdaQueryWrapper<UserExamGoodsSupplement>().eq(UserExamGoodsSupplement::getOrderGoodsId, bo.getOrderGoodsId()));
|
|
|
+ if(Validator.isNotEmpty(entity)){
|
|
|
+ UserExamGoodsVo examGoodsVo = queryById(entity.getUserExamGoodsId());
|
|
|
+ if(Validator.isNotEmpty(examGoodsVo)){
|
|
|
+ if(entity.getStatus()==1){
|
|
|
+ //补考
|
|
|
+ if((examGoodsVo.getExamNumber().longValue()-examGoodsVo.getExpendNumber().longValue())>entity.getExamNumber()){
|
|
|
+ //剩余次数大于购买时绑定次数
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(entity.getStatus()==2){
|
|
|
+ //前培
|
|
|
+ if((examGoodsVo.getDoNumber().longValue()-examGoodsVo.getExpendBefore().longValue())>entity.getDoNumber()){
|
|
|
+ //剩余次数大于购买时绑定次数
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|