|
@@ -2,9 +2,11 @@ package com.zhongzheng.modules.user.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
import cn.hutool.core.convert.Convert;
|
|
|
|
|
+import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.modules.alisms.service.IAliSmsService;
|
|
import com.zhongzheng.modules.alisms.service.IAliSmsService;
|
|
|
import com.zhongzheng.modules.exam.mapper.ExamApplyMapper;
|
|
import com.zhongzheng.modules.exam.mapper.ExamApplyMapper;
|
|
@@ -232,18 +234,22 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
}
|
|
}
|
|
|
else if (bo.getBeforeStatus() != null && bo.getBeforeStatus().equals(0)){
|
|
else if (bo.getBeforeStatus() != null && bo.getBeforeStatus().equals(0)){
|
|
|
update.setBeforeExpend(0);
|
|
update.setBeforeExpend(0);
|
|
|
- UserExamGoodsQueryBo userExamGoodsQueryBo = new UserExamGoodsQueryBo();
|
|
|
|
|
- userExamGoodsQueryBo.setGoodsId(userSubscribeVo.getGoodsId());
|
|
|
|
|
- userExamGoodsQueryBo.setUserId(userSubscribeVo.getUserId());
|
|
|
|
|
- List<UserExamGoodsVo> userExamGoodsVos = userExamGoodsService.queryList(userExamGoodsQueryBo);
|
|
|
|
|
- if (!org.springframework.util.CollectionUtils.isEmpty(userExamGoodsVos)){
|
|
|
|
|
- UserExamGoodsVo userExamGoodsVo = userExamGoodsVos.get(0);
|
|
|
|
|
- UserExamGoods userExamGoods = new UserExamGoods();
|
|
|
|
|
- userExamGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
- userExamGoods.setUserExamGoodsId(userExamGoodsVo.getUserExamGoodsId());
|
|
|
|
|
- userExamGoods.setExpendBefore(userExamGoodsVo.getExpendBefore()-1);
|
|
|
|
|
- userExamGoodsService.updateById(userExamGoods);
|
|
|
|
|
|
|
+ if(userSubscribeVo.getBeforeStatus()!=null&&userSubscribeVo.getBeforeStatus().equals(1)){
|
|
|
|
|
+ //之前是标记开通的,返回消耗次数
|
|
|
|
|
+ UserExamGoodsQueryBo userExamGoodsQueryBo = new UserExamGoodsQueryBo();
|
|
|
|
|
+ userExamGoodsQueryBo.setGoodsId(userSubscribeVo.getGoodsId());
|
|
|
|
|
+ userExamGoodsQueryBo.setUserId(userSubscribeVo.getUserId());
|
|
|
|
|
+ List<UserExamGoodsVo> userExamGoodsVos = userExamGoodsService.queryList(userExamGoodsQueryBo);
|
|
|
|
|
+ if (!org.springframework.util.CollectionUtils.isEmpty(userExamGoodsVos)){
|
|
|
|
|
+ UserExamGoodsVo userExamGoodsVo = userExamGoodsVos.get(0);
|
|
|
|
|
+ UserExamGoods userExamGoods = new UserExamGoods();
|
|
|
|
|
+ userExamGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ userExamGoods.setUserExamGoodsId(userExamGoodsVo.getUserExamGoodsId());
|
|
|
|
|
+ userExamGoods.setExpendBefore(userExamGoodsVo.getExpendBefore()-1);
|
|
|
|
|
+ userExamGoodsService.updateById(userExamGoods);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
boolean b = this.updateById(update);
|
|
boolean b = this.updateById(update);
|