|
@@ -44,6 +44,8 @@ import com.zhongzheng.modules.inform.service.IInformRemindService;
|
|
|
import com.zhongzheng.modules.inform.service.IInformUserService;
|
|
|
import com.zhongzheng.modules.inform.vo.InformRemindBusinessVo;
|
|
|
import com.zhongzheng.modules.inform.vo.InformRemindVo;
|
|
|
+import com.zhongzheng.modules.order.bo.OrderGoodsEditBo;
|
|
|
+import com.zhongzheng.modules.order.domain.Order;
|
|
|
import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
import com.zhongzheng.modules.order.mapper.OrderMapper;
|
|
|
import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
@@ -2002,6 +2004,48 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Integer offGradeOrder(OffGradeOrder bo) {
|
|
|
+ ClassGrade classGrade = getById(bo.getGradeId());
|
|
|
+ if (ObjectUtils.isNull(classGrade)){
|
|
|
+ throw new CustomException("班级信息获取有误");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ClassGradeUser> list = iClassGradeUserService.list(new LambdaQueryWrapper<ClassGradeUser>()
|
|
|
+ .eq(ClassGradeUser::getGradeId, bo.getGradeId())
|
|
|
+ .eq(ObjectUtils.isNotNull(bo.getUserId()), ClassGradeUser::getUserId, bo.getUserId())
|
|
|
+ .eq(ClassGradeUser::getStatus, 1));
|
|
|
+ if (CollectionUtils.isEmpty(list)){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ list.forEach(x -> {
|
|
|
+ OrderGoods orderGoods = iOrderGoodsService.getById(x.getOrderGoodsId());
|
|
|
+ Order order = orderMapper.selectOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderSn, orderGoods.getOrderSn()));
|
|
|
+ if (ObjectUtils.isNull(order)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(order.getInputOrderSn())){
|
|
|
+ //线下
|
|
|
+ OrderGoodsEditBo editBo = new OrderGoodsEditBo();
|
|
|
+ editBo.setOrderGoodsId(x.getOrderGoodsId());
|
|
|
+ editBo.setStatus(0);
|
|
|
+ editBo.setCloseReason("班级更换新课程");
|
|
|
+ iOrderGoodsService.closeOrderGoods(editBo);
|
|
|
+ }else {
|
|
|
+ //线上
|
|
|
+ orderGoods.setStatus(0);
|
|
|
+ orderGoods.setCloseReason("班级更换新课程");
|
|
|
+ orderGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iOrderGoodsService.updateById(orderGoods);
|
|
|
+ x.setStatus(0);
|
|
|
+ x.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iClassGradeUserService.updateById(x);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
//创建预开班班级
|
|
|
private void creatClass(List<Long> goodsIds, Long tenantId, String code) {
|
|
|
goodsIds.forEach(goodsId -> {
|