|
@@ -4,12 +4,15 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
import com.zhongzheng.modules.bank.mapper.QuestionMapper;
|
|
|
+import com.zhongzheng.modules.course.domain.CourseModule;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
+import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeGoods;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
|
|
@@ -26,6 +29,7 @@ import com.zhongzheng.modules.order.mapper.OrderGoodsMapper;
|
|
|
import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
import com.zhongzheng.modules.order.service.IOrderService;
|
|
|
import com.zhongzheng.modules.order.vo.OrderGoodsVo;
|
|
|
+import com.zhongzheng.modules.order.vo.OrderListVo;
|
|
|
import com.zhongzheng.modules.order.vo.OrderVo;
|
|
|
import io.swagger.models.auth.In;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -120,16 +124,42 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public Boolean closeOrderGoods(OrderGoodsQueryBo bo) {
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean closeOrderGoods(OrderGoodsEditBo bo) {
|
|
|
if(Validator.isEmpty(bo.getOrderGoodsId())){
|
|
|
throw new CustomException("参数错误");
|
|
|
}
|
|
|
- OrderGoods db = this.baseMapper.selectById(bo.getOrderGoodsId());
|
|
|
- if(db.getStatus()==0||db.getRefundStatus()>0||db.getPayStatus()==1){
|
|
|
+ OrderGoods orderGoods = this.baseMapper.selectById(bo.getOrderGoodsId());
|
|
|
+ if(orderGoods.getStatus()==0||orderGoods.getRefundStatus()>0||orderGoods.getPayStatus()==1){
|
|
|
throw new CustomException("无法操作");
|
|
|
}
|
|
|
+ OrderListVo order = iOrderService.queryDetailByOrderSn(orderGoods.getOrderSn());
|
|
|
+ if(order.getOrderFrom()>1&&order.getOrderFrom()<5){
|
|
|
+ throw new CustomException("线上订单无法操作");
|
|
|
+ }
|
|
|
+ //关闭订单
|
|
|
+ if(bo.getStatus()==0){
|
|
|
+ orderGoods.setStatus(bo.getStatus());
|
|
|
+ orderGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ updateById(orderGoods);
|
|
|
+ GoodsVo goodsVo = iGoodsService.selectDetail(orderGoods.getGoodsId());
|
|
|
+ if(goodsVo.getGoodsType()==1){
|
|
|
+ //视频商品
|
|
|
+ LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper.eq(ClassGradeUser::getOrderGoodsId, bo.getOrderGoodsId());
|
|
|
+ objectLambdaUpdateWrapper.eq(ClassGradeUser::getUserId, order.getUserId());
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getStatus, 0);
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime,DateUtils.getNowTime());
|
|
|
+ iClassGradeUserService.update(null, objectLambdaUpdateWrapper);
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(goodsVo.getGoodsType()==2){
|
|
|
+ //题库商品
|
|
|
|
|
|
- return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
/**
|