|
@@ -20,6 +20,7 @@ import com.zhongzheng.modules.bank.domain.QuestionChapterExam;
|
|
|
import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
|
|
|
import com.zhongzheng.modules.base.service.IProfileTpService;
|
|
|
import com.zhongzheng.modules.base.service.IShoppingCartService;
|
|
|
+import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
|
|
|
import com.zhongzheng.modules.course.domain.CourseBusiness;
|
|
|
import com.zhongzheng.modules.course.domain.CourseEducationType;
|
|
@@ -183,18 +184,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
@Override
|
|
|
public List<OrderListVo> selectList(OrderQueryBo bo) {
|
|
|
- if(Validator.isNotEmpty(bo.getOrderGoodsStatus())){
|
|
|
- if(bo.getOrderGoodsStatus()==-1){
|
|
|
- Integer[] orderStatus = new Integer []{-2,-1};
|
|
|
+ if (Validator.isNotEmpty(bo.getOrderGoodsStatus())) {
|
|
|
+ if (bo.getOrderGoodsStatus() == -1) {
|
|
|
+ Integer[] orderStatus = new Integer[]{-2, -1};
|
|
|
bo.setOrderStatus(orderStatus);
|
|
|
- }
|
|
|
- else if(bo.getOrderGoodsStatus()==0){
|
|
|
+ } else if (bo.getOrderGoodsStatus() == 0) {
|
|
|
bo.setGoodsPayStatus(1);
|
|
|
- }
|
|
|
- else if(bo.getOrderGoodsStatus()==1){
|
|
|
+ } else if (bo.getOrderGoodsStatus() == 1) {
|
|
|
//已支付 sql实现
|
|
|
- }
|
|
|
- else if(bo.getOrderGoodsStatus()==2){
|
|
|
+ } else if (bo.getOrderGoodsStatus() == 2) {
|
|
|
bo.setRefundStatus(2);
|
|
|
}
|
|
|
}
|
|
@@ -244,9 +242,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
@Override
|
|
|
public List<OrderUserCheckBuyBo> userCheckBuyList(List<OrderUserCheckBuyBo> list) {
|
|
|
- for(OrderUserCheckBuyBo bo : list){
|
|
|
+ for (OrderUserCheckBuyBo bo : list) {
|
|
|
bo.setBuy(false);
|
|
|
- if(Validator.isEmpty(bo.getTel())||Validator.isEmpty(bo.getGradeId())||Validator.isEmpty(bo.getGoodsId())){
|
|
|
+ if (Validator.isEmpty(bo.getTel()) || Validator.isEmpty(bo.getGradeId()) || Validator.isEmpty(bo.getGoodsId())) {
|
|
|
bo.setMsg("参数缺失");
|
|
|
continue;
|
|
|
}
|
|
@@ -254,7 +252,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, bo.getGoodsId()));
|
|
|
User user = iUserService.getOne(new LambdaQueryWrapper<User>()
|
|
|
.eq(User::getTelphone, EncryptHandler.encrypt(bo.getTel())).last("limit 1"));
|
|
|
- if(Validator.isNull(user)){
|
|
|
+ if (Validator.isNull(user)) {
|
|
|
bo.setMsg("该手机号码用户不存在");
|
|
|
continue;
|
|
|
}
|
|
@@ -274,10 +272,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
payStatusList.add(4);
|
|
|
orderGoodsQueryBo.setPayStatusList(payStatusList);
|
|
|
List<OrderGoodsVo> list1 = iOrderGoodsService.selectList(orderGoodsQueryBo);
|
|
|
- if(Validator.isNotEmpty(list1)&&list1.size()>0){
|
|
|
+ if (Validator.isNotEmpty(list1) && list1.size() > 0) {
|
|
|
bo.setBuy(true);
|
|
|
}
|
|
|
- for(OrderGoodsVo vo : list1){
|
|
|
+ for (OrderGoodsVo vo : list1) {
|
|
|
bo.setServiceEndTime(vo.getServiceEndTime());
|
|
|
bo.setServiceStartTime(vo.getServiceStartTime());
|
|
|
}
|
|
@@ -439,7 +437,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//订单商品
|
|
|
Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
|
|
|
if (goods.getGoodsStatus() != 1) {
|
|
|
- throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单");
|
|
|
+ throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
|
|
|
}
|
|
|
OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
|
|
|
orderGoods.setOrderSn(out_trade_no);
|
|
@@ -467,7 +465,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
payPrice = payPrice.add(g.getGoodsPrice());
|
|
|
boolean orderGoodsRs = iOrderGoodsService.save(orderGoods);
|
|
|
boolean canRepeatBuy = false;
|
|
|
- validUserBeforeBuy(goods,bo.getUserId());
|
|
|
+ validUserBeforeBuy(goods, bo.getUserId());
|
|
|
//判断视频/题库商品是否有购买过,服务期是否过期
|
|
|
Long oldOrderGoodsId = getHaveBuyGoods(g.getGoodsId(), bo.getUserId());
|
|
|
//视频商品安排班级
|
|
@@ -497,7 +495,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
isArrange = arrangeGrade(goods.getGoodsName(), goods.getGoodsId(), orderGoods.getOrderGoodsId(), gradeId, add.getUserId(), out_trade_no, goods.getBusinessId());
|
|
|
redisCache.unlockLua(redisLockEntity);
|
|
|
}
|
|
|
- if(!isArrange){
|
|
|
+ if (!isArrange) {
|
|
|
throw new CustomException("分班错误");
|
|
|
}
|
|
|
iOrderGoodsService.updateById(orderGoods);
|
|
@@ -509,7 +507,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
if (goods.getGoodsType() == 6) {
|
|
|
//直播商品
|
|
|
- if(Validator.isNotEmpty(oldOrderGoodsId)&&oldOrderGoodsId.longValue()>0){
|
|
|
+ if (Validator.isNotEmpty(oldOrderGoodsId) && oldOrderGoodsId.longValue() > 0) {
|
|
|
throw new CustomException("直播商品不允许复购");
|
|
|
}
|
|
|
}
|
|
@@ -552,14 +550,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
public Map<String, Object> placePlatInputOrder(OrderAddBo bo) {
|
|
|
List<OrderGoodsAddBo> goodsList = bo.getGoodsList();
|
|
|
if (goodsList == null || goodsList.size() < 1) {
|
|
|
- throw new CustomException("商品列表为空",510);
|
|
|
+ throw new CustomException("商品列表为空", 510);
|
|
|
}
|
|
|
if (Validator.isEmpty(bo.getInputOrderSn())) {
|
|
|
- throw new CustomException("录单单号为空",510);
|
|
|
+ throw new CustomException("录单单号为空", 510);
|
|
|
}
|
|
|
OrderInput orderInput = iOrderInputService.queryBySn(bo.getInputOrderSn());
|
|
|
if (Validator.isEmpty(orderInput)) {
|
|
|
- throw new CustomException("录单单号不存在",510);
|
|
|
+ throw new CustomException("录单单号不存在", 510);
|
|
|
}
|
|
|
Order add = BeanUtil.toBean(bo, Order.class);
|
|
|
validEntityBeforeSave(add);
|
|
@@ -608,7 +606,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
receivedPrice = receivedPrice.add(g.getGoodsReceived());
|
|
|
boolean orderGoodsRs = iOrderGoodsService.save(orderGoods);
|
|
|
boolean canRepeatBuy = false;
|
|
|
- validUserBeforeBuy(goods,bo.getUserId());
|
|
|
+ validUserBeforeBuy(goods, bo.getUserId());
|
|
|
//判断是否有购买过
|
|
|
Long oldOrderGoodsId = getHaveBuyGoods(g.getGoodsId(), bo.getUserId());
|
|
|
//视频商品安排班级
|
|
@@ -638,8 +636,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
isArrange = arrangeGrade(goods.getGoodsName(), goods.getGoodsId(), orderGoods.getOrderGoodsId(), gradeId, add.getUserId(), out_trade_no, goods.getBusinessId());
|
|
|
redisCache.unlockLua(redisLockEntity);
|
|
|
}
|
|
|
- if(!isArrange){
|
|
|
- throw new CustomException("分班错误",510);
|
|
|
+ if (!isArrange) {
|
|
|
+ throw new CustomException("分班错误", 510);
|
|
|
}
|
|
|
iOrderGoodsService.updateById(orderGoods);
|
|
|
newFreeBankGoods(goods.getGoodsId(), orderGoods.getOrderGoodsId());
|
|
@@ -650,7 +648,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
if (goods.getGoodsType() == 6) {
|
|
|
//直播商品
|
|
|
- if(Validator.isNotEmpty(oldOrderGoodsId)&&oldOrderGoodsId.longValue()>0){
|
|
|
+ if (Validator.isNotEmpty(oldOrderGoodsId) && oldOrderGoodsId.longValue() > 0) {
|
|
|
throw new CustomException("直播商品不允许复购");
|
|
|
}
|
|
|
}
|
|
@@ -665,9 +663,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
add.setOrderSn(out_trade_no);
|
|
|
- if(Validator.isNotEmpty(bo.getOrderFrom())&&bo.getOrderFrom()==6){
|
|
|
+ if (Validator.isNotEmpty(bo.getOrderFrom()) && bo.getOrderFrom() == 6) {
|
|
|
add.setOrderFrom(bo.getOrderFrom());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
add.setOrderFrom(Order.FROM_INPUT);
|
|
|
}
|
|
|
add.setPayPrice(payPrice);//需要支付价格
|
|
@@ -769,7 +767,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//订单商品
|
|
|
Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
|
|
|
if (goods.getGoodsStatus() != 1) {
|
|
|
- throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单");
|
|
|
+ throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
|
|
|
}
|
|
|
body = "中正祥粤云-" + goods.getGoodsName();
|
|
|
OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
|
|
@@ -799,7 +797,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
boolean orderGoodsRs = iOrderGoodsService.save(orderGoods);
|
|
|
|
|
|
boolean canRepeatBuy = false;
|
|
|
- validUserBeforeBuy(goods,bo.getUserId());
|
|
|
+ validUserBeforeBuy(goods, bo.getUserId());
|
|
|
//判断是否有购买过
|
|
|
Long oldOrderGoodsId = getHaveBuyGoods(g.getGoodsId(), bo.getUserId());
|
|
|
//视频商品安排班级
|
|
@@ -836,7 +834,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
if (goods.getGoodsType() == 6) {
|
|
|
//直播商品
|
|
|
- if(Validator.isNotEmpty(oldOrderGoodsId)&&oldOrderGoodsId.longValue()>0){
|
|
|
+ if (Validator.isNotEmpty(oldOrderGoodsId) && oldOrderGoodsId.longValue() > 0) {
|
|
|
throw new CustomException("直播商品不允许复购");
|
|
|
}
|
|
|
}
|
|
@@ -871,7 +869,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
this.save(add);
|
|
|
|
|
|
//判断是否红包活动订单
|
|
|
- if (org.apache.commons.lang3.StringUtils.isNotBlank(add.getShareActivityCode())){
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(add.getShareActivityCode())) {
|
|
|
ActivityOrder activityOrder = new ActivityOrder();
|
|
|
activityOrder.setOrderSn(out_trade_no);
|
|
|
activityOrder.setType(1);//分销红包活动
|
|
@@ -930,7 +928,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//订单商品
|
|
|
Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
|
|
|
if (goods.getGoodsStatus() != 1) {
|
|
|
- throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单");
|
|
|
+ throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
|
|
|
}
|
|
|
body = "中正祥粤云-" + goods.getGoodsName();
|
|
|
OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
|
|
@@ -960,7 +958,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
boolean orderGoodsRs = iOrderGoodsService.save(orderGoods);
|
|
|
|
|
|
boolean canRepeatBuy = false;
|
|
|
- validUserBeforeBuy(goods,bo.getUserId());
|
|
|
+ validUserBeforeBuy(goods, bo.getUserId());
|
|
|
//判断是否有购买过
|
|
|
Long oldOrderGoodsId = getHaveBuyGoods(g.getGoodsId(), bo.getUserId());
|
|
|
//视频商品安排班级
|
|
@@ -997,7 +995,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
if (goods.getGoodsType() == 6) {
|
|
|
//直播商品
|
|
|
- if(Validator.isNotEmpty(oldOrderGoodsId)&&oldOrderGoodsId.longValue()>0){
|
|
|
+ if (Validator.isNotEmpty(oldOrderGoodsId) && oldOrderGoodsId.longValue() > 0) {
|
|
|
throw new CustomException("直播商品不允许复购");
|
|
|
}
|
|
|
}
|
|
@@ -1043,10 +1041,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
Map<String, String> payResult = new HashMap<>();
|
|
|
//大于0元,获取微信支付信息
|
|
|
if (payPrice.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
- if(Validator.isEmpty(userVo.getGzhOpenId())){
|
|
|
+ if (Validator.isEmpty(userVo.getGzhOpenId())) {
|
|
|
throw new CustomException("请先授权绑定公众号信息");
|
|
|
}
|
|
|
- payResult = iWxPayService.paymentGzh(pay_no, userVo.getGzhOpenId(), body, payPrice,bo.getUrl());
|
|
|
+ payResult = iWxPayService.paymentGzh(pay_no, userVo.getGzhOpenId(), body, payPrice, bo.getUrl());
|
|
|
}
|
|
|
|
|
|
payResult.put("orderSn", out_trade_no);
|
|
@@ -1083,7 +1081,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//订单商品
|
|
|
Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
|
|
|
if (goods.getGoodsStatus() != 1) {
|
|
|
- throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单");
|
|
|
+ throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
|
|
|
}
|
|
|
body = "中正祥粤云-" + goods.getGoodsName();
|
|
|
OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
|
|
@@ -1113,7 +1111,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
boolean orderGoodsRs = iOrderGoodsService.save(orderGoods);
|
|
|
|
|
|
boolean canRepeatBuy = false;
|
|
|
- validUserBeforeBuy(goods,bo.getUserId());
|
|
|
+ validUserBeforeBuy(goods, bo.getUserId());
|
|
|
//判断是否有购买过
|
|
|
Long oldOrderGoodsId = getHaveBuyGoods(g.getGoodsId(), bo.getUserId());
|
|
|
//视频商品安排班级
|
|
@@ -1150,7 +1148,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
if (goods.getGoodsType() == 6) {
|
|
|
//直播商品
|
|
|
- if(Validator.isNotEmpty(oldOrderGoodsId)&&oldOrderGoodsId.longValue()>0){
|
|
|
+ if (Validator.isNotEmpty(oldOrderGoodsId) && oldOrderGoodsId.longValue() > 0) {
|
|
|
throw new CustomException("直播商品不允许复购");
|
|
|
}
|
|
|
}
|
|
@@ -1204,12 +1202,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
return payResult;
|
|
|
}
|
|
|
|
|
|
- private Boolean validUserBeforeBuy(Goods goods ,Long userId){
|
|
|
- if(goods.getGoodsType()==3||goods.getGoodsType()==4){
|
|
|
+ private Boolean validUserBeforeBuy(Goods goods, Long userId) {
|
|
|
+ if (goods.getGoodsType() == 3 || goods.getGoodsType() == 4) {
|
|
|
Long makeGoodsId = goods.getMakeGoodsId();
|
|
|
- UserExamGoods entity = userExamGoodsService.getOne(new LambdaQueryWrapper<UserExamGoods>().eq(UserExamGoods::getUserId,userId).eq(UserExamGoods::getGoodsId,makeGoodsId).last("limit 1"));
|
|
|
- if(Validator.isEmpty(entity)){
|
|
|
- throw new CustomException("请先购买此补考前培商品的绑定商品",510);
|
|
|
+ UserExamGoods entity = userExamGoodsService.getOne(new LambdaQueryWrapper<UserExamGoods>().eq(UserExamGoods::getUserId, userId).eq(UserExamGoods::getGoodsId, makeGoodsId).last("limit 1"));
|
|
|
+ if (Validator.isEmpty(entity)) {
|
|
|
+ throw new CustomException("请先购买此补考前培商品的绑定商品", 510);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1230,7 +1228,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
for (OrderGoods g : goodsList) {
|
|
|
Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
|
|
|
if (goods.getGoodsStatus() != 1) {
|
|
|
- throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单");
|
|
|
+ throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
|
|
|
}
|
|
|
body = "中正祥粤云-" + goods.getGoodsName();
|
|
|
break;
|
|
@@ -1266,7 +1264,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
for (OrderGoods g : goodsList) {
|
|
|
Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
|
|
|
if (goods.getGoodsStatus() != 1) {
|
|
|
- throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单");
|
|
|
+ throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
|
|
|
}
|
|
|
body = "中正祥粤云-" + goods.getGoodsName();
|
|
|
break;
|
|
@@ -1283,7 +1281,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
payAddBo.setStatus(0);
|
|
|
payAddBo.setPayPrice(order.getPayPrice());
|
|
|
iOrderPayService.insertByAddBo(payAddBo);
|
|
|
- Map<String, String> payResult = iWxPayService.paymentGzh(pay_no, userVo.getGzhOpenId(), body, order.getPayPrice(),bo.getUrl());
|
|
|
+ Map<String, String> payResult = iWxPayService.paymentGzh(pay_no, userVo.getGzhOpenId(), body, order.getPayPrice(), bo.getUrl());
|
|
|
payResult.put("orderSn", bo.getOrderSn());
|
|
|
return payResult;
|
|
|
}
|
|
@@ -1292,7 +1290,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
@Override
|
|
|
public Boolean updateByEditBo(OrderEditBo bo) {
|
|
|
Order order = this.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderId, bo.getOrderId()));
|
|
|
- if (order.getOrderStatus() >0) {
|
|
|
+ if (order.getOrderStatus() > 0) {
|
|
|
throw new CustomException("订单无法取消");
|
|
|
}
|
|
|
|
|
@@ -1300,7 +1298,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
validEntityBeforeSave(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
//待支付手动关闭
|
|
|
- if (Validator.isNotEmpty(update.getOrderStatus())&&update.getOrderStatus() == -1 &&order.getOrderStatus()==0) {
|
|
|
+ if (Validator.isNotEmpty(update.getOrderStatus()) && update.getOrderStatus() == -1 && order.getOrderStatus() == 0) {
|
|
|
update.setCancelTime(DateUtils.getNowTime());
|
|
|
//手动关闭订单
|
|
|
OrderVo orderVo = this.queryById(bo.getOrderId());
|
|
@@ -1387,7 +1385,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
for (OrderGoods g : goodsList) {
|
|
|
Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
|
|
|
if (goods.getGoodsStatus() != 1) {
|
|
|
- throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单");
|
|
|
+ throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
|
|
|
}
|
|
|
body = "中正祥粤云-" + goods.getGoodsName();
|
|
|
break;
|
|
@@ -1444,6 +1442,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
/**
|
|
|
* 课程商品ID产生免费的题库商品
|
|
|
+ *
|
|
|
* @param goodsId
|
|
|
* @return
|
|
|
*/
|
|
@@ -1454,15 +1453,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
Long value = redisCache.getCacheObject(key);
|
|
|
if (Validator.isNotEmpty(value)) {
|
|
|
freeBankGoodsId = value;
|
|
|
- if(freeBankGoodsId.longValue()<0){
|
|
|
+ if (freeBankGoodsId.longValue() < 0) {
|
|
|
freeBankGoodsId = null;
|
|
|
}
|
|
|
}
|
|
|
- if(Validator.isEmpty(freeBankGoodsId)){
|
|
|
+ if (Validator.isEmpty(freeBankGoodsId)) {
|
|
|
List<CourseModuleFreeExamVo> moduleExamList = iGoodsService.moduleFreeExamList(goodsId);
|
|
|
//课程模块有赠送的试卷
|
|
|
- if(moduleExamList.size()>0){
|
|
|
- for(CourseModuleFreeExamVo examVo : moduleExamList){
|
|
|
+ if (moduleExamList.size() > 0) {
|
|
|
+ for (CourseModuleFreeExamVo examVo : moduleExamList) {
|
|
|
examVo.setFreeExamName(null);//MD5去除名称影响
|
|
|
}
|
|
|
String jsonList = JSON.toJSONString(moduleExamList);
|
|
@@ -1470,15 +1469,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//判断该课程商品是否已经存在相同结构的赠送卷商品
|
|
|
GoodsFreeBank freeBank = iGoodsFreeBankService.getOne(new LambdaQueryWrapper<GoodsFreeBank>().eq(GoodsFreeBank::getFromGoodsId, goodsId)
|
|
|
.eq(GoodsFreeBank::getMd5, examListMd5));
|
|
|
- if(Validator.isNotEmpty(freeBank)){
|
|
|
+ if (Validator.isNotEmpty(freeBank)) {
|
|
|
freeBankGoodsId = freeBank.getGoodsId();//赠送的商品ID
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, goodsId));//获取课程商品
|
|
|
String code = ServletUtils.getEncoded("ZS");
|
|
|
//创建赠送卷商品
|
|
|
GoodsBankAddBo addBo = new GoodsBankAddBo();
|
|
|
addBo.setGoodsType(5);
|
|
|
- String goodsName = goods.getGoodsName()+"-"+code;
|
|
|
+ String goodsName = goods.getGoodsName() + "-" + code;
|
|
|
addBo.setGoodsName(goodsName);
|
|
|
addBo.setEducationTypeId(goods.getEducationTypeId());
|
|
|
addBo.setProjectId(goods.getProjectId());
|
|
@@ -1487,7 +1486,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
addBo.setCoverUrl("oss/images/avatar/20211013/1634097664410_1397766697");
|
|
|
List<GoodsAttachedAddBo> bankList = new ArrayList<>();
|
|
|
int sort = 1;
|
|
|
- for(CourseModuleFreeExamVo menuVo :moduleExamList){
|
|
|
+ for (CourseModuleFreeExamVo menuVo : moduleExamList) {
|
|
|
GoodsAttachedAddBo attachedAddBo = new GoodsAttachedAddBo();
|
|
|
attachedAddBo.setType(menuVo.getExamType());
|
|
|
attachedAddBo.setMajorId(menuVo.getFreeExamId());
|
|
@@ -1509,12 +1508,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(Validator.isNotEmpty(freeBankGoodsId)){
|
|
|
+ if (Validator.isNotEmpty(freeBankGoodsId)) {
|
|
|
OrderGoodsFreeAddBo goodsFreeAddBo = new OrderGoodsFreeAddBo();
|
|
|
goodsFreeAddBo.setFreeGoodsId(freeBankGoodsId);
|
|
|
goodsFreeAddBo.setOrderGoodsId(orderGoodsId);
|
|
|
iOrderGoodsFreeService.insertByAddBo(goodsFreeAddBo);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
freeBankGoodsId = -1L; //课程商品不存在免费题库商品
|
|
|
}
|
|
|
redisCache.setCacheObject(key, freeBankGoodsId, 10, TimeUnit.SECONDS);
|
|
@@ -1544,25 +1543,26 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
payStatusList.add(4);
|
|
|
orderGoodsQueryBo.setPayStatusList(payStatusList);
|
|
|
List<OrderGoodsVo> list1 = iOrderGoodsService.selectList(orderGoodsQueryBo);
|
|
|
- for(OrderGoodsVo goodsVo : list1){
|
|
|
- if(Validator.isNotEmpty(goodsVo.getServiceEndTime())&&(goodsVo.getServiceEndTime().longValue()>(System.currentTimeMillis()/1000))){
|
|
|
- if(goodsVo.getGoodsType()==1){
|
|
|
- if(Validator.isNotEmpty(goodsVo.getGradeId())){
|
|
|
+ for (OrderGoodsVo goodsVo : list1) {
|
|
|
+ if (Validator.isNotEmpty(goodsVo.getServiceEndTime()) && (goodsVo.getServiceEndTime().longValue() > (System.currentTimeMillis() / 1000))) {
|
|
|
+ if (goodsVo.getGoodsType() == 1) {
|
|
|
+ if (Validator.isNotEmpty(goodsVo.getGradeId())) {
|
|
|
ClassGrade grade = iClassGradeService.getOne(new LambdaQueryWrapper<ClassGrade>()
|
|
|
.eq(ClassGrade::getGradeId, goodsVo.getGradeId()));
|
|
|
//不存在班级有效期才校验服务期是否过期
|
|
|
- if(Validator.isEmpty(grade.getClassEndTime())){
|
|
|
+ if (Validator.isEmpty(grade.getClassEndTime())) {
|
|
|
return goodsVo;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(goodsVo.getGoodsType()==2){
|
|
|
+ if (goodsVo.getGoodsType() == 2) {
|
|
|
return goodsVo;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
//判断视频商品是否购买过且服务期是否过期
|
|
|
public Long getHaveBuyGoods(Long goodsId, Long userId) {
|
|
|
OrderGoodsQueryBo orderGoodsQueryBo = new OrderGoodsQueryBo();
|
|
@@ -1579,19 +1579,19 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
payStatusList.add(4);
|
|
|
orderGoodsQueryBo.setPayStatusList(payStatusList);
|
|
|
List<OrderGoodsVo> list1 = iOrderGoodsService.selectList(orderGoodsQueryBo);
|
|
|
- for(OrderGoodsVo goodsVo : list1){
|
|
|
- if(Validator.isNotEmpty(goodsVo.getServiceEndTime())&&(goodsVo.getServiceEndTime().longValue()>(System.currentTimeMillis()/1000))){
|
|
|
- if(goodsVo.getGoodsType()==1){
|
|
|
- if(Validator.isNotEmpty(goodsVo.getGradeId())){
|
|
|
+ for (OrderGoodsVo goodsVo : list1) {
|
|
|
+ if (Validator.isNotEmpty(goodsVo.getServiceEndTime()) && (goodsVo.getServiceEndTime().longValue() > (System.currentTimeMillis() / 1000))) {
|
|
|
+ if (goodsVo.getGoodsType() == 1) {
|
|
|
+ if (Validator.isNotEmpty(goodsVo.getGradeId())) {
|
|
|
ClassGrade grade = iClassGradeService.getOne(new LambdaQueryWrapper<ClassGrade>()
|
|
|
.eq(ClassGrade::getGradeId, goodsVo.getGradeId()));
|
|
|
//不存在班级有效期才校验服务期是否过期
|
|
|
- if(Validator.isEmpty(grade.getClassEndTime())){
|
|
|
+ if (Validator.isEmpty(grade.getClassEndTime())) {
|
|
|
throw new CustomException("存在已购买【学习服务期未过期】的视频商品,不可以重复购买商品", 511);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(goodsVo.getGoodsType()==2){
|
|
|
+ if (goodsVo.getGoodsType() == 2) {
|
|
|
throw new CustomException("存在已购买【学习服务期未过期】的题库商品,不可以重复购买商品", 511);
|
|
|
}
|
|
|
}
|
|
@@ -1611,8 +1611,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
bo.setPastDue(1L);
|
|
|
List<ClassGradeVo> list = iClassGradeService.queryList(bo);
|
|
|
if (list != null && list.size() > 0) {
|
|
|
- for(ClassGradeVo gradeVo : list){
|
|
|
- if(Validator.isNotEmpty(gradeVo.getClassEndTime())){
|
|
|
+ for (ClassGradeVo gradeVo : list) {
|
|
|
+ if (Validator.isNotEmpty(gradeVo.getClassEndTime())) {
|
|
|
throw new CustomException("存在已购买【班级有效期未过期】的商品,不可以重复购买商品", 511);
|
|
|
}
|
|
|
}
|
|
@@ -1692,9 +1692,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getGradeId, gradeId)
|
|
|
.eq(ClassGradeUser::getUserId, userId));
|
|
|
//不在此班级内
|
|
|
- if(Validator.isEmpty(gradeUser)){
|
|
|
+ if (Validator.isEmpty(gradeUser)) {
|
|
|
//班级还有剩位,直接锁定班级
|
|
|
- if(iClassGradeService.checkEjjjPeopleNumLimit(businessId,gradeId)){ //判断全系统平台二建班级人数是否超300
|
|
|
+ if (iClassGradeService.checkEjjjPeopleNumLimit(businessId, gradeId)) { //判断全系统平台二建班级人数是否超300
|
|
|
return lockGrade(orderGoodsId, gradeId, userId, goodsId, orderSn);
|
|
|
}
|
|
|
|
|
@@ -1722,8 +1722,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getGradeId, gradeId)
|
|
|
.eq(ClassGradeUser::getUserId, userId));
|
|
|
//不在此班级内
|
|
|
- if(Validator.isEmpty(gradeUser)){
|
|
|
- if(iClassGradeService.checkEjjjPeopleNumLimit(businessId,gradeId)){ //判断全系统平台二建班级人数是否超300
|
|
|
+ if (Validator.isEmpty(gradeUser)) {
|
|
|
+ if (iClassGradeService.checkEjjjPeopleNumLimit(businessId, gradeId)) { //判断全系统平台二建班级人数是否超300
|
|
|
return lockGrade(orderGoodsId, gradeId, userId, goodsId, orderSn);
|
|
|
}
|
|
|
}
|
|
@@ -1742,8 +1742,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
classGrade.setClassStatus(0);
|
|
|
classGrade.setLearningStatus(2);//待定
|
|
|
classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
|
|
|
- //生成预开班编号
|
|
|
- classGrade.setOfficialName( createGradeCode(goodsId,businessVo));
|
|
|
+
|
|
|
+ CourseBusinessQueryBo businessQueryBo = new CourseBusinessQueryBo();
|
|
|
+ businessQueryBo.setId(businessId);
|
|
|
+ String fullName = iCourseBusinessService.queryFullName(businessQueryBo);
|
|
|
+ if (("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) {
|
|
|
+ //生成预开班编号
|
|
|
+ classGrade.setOfficialName(createGradeCode(goodsId, businessVo));
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
classGrade.setLearningStatus(1);//即刻
|
|
|
classGrade.setStudentUpper(ClassGrade.INIT_UPPER2); //上限1000000
|
|
@@ -1759,28 +1766,28 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
CourseEducationType educationType = courseEducationTypeService.getById(goods.getEducationTypeId());
|
|
|
String educationName = educationType.getEducationName();
|
|
|
String className = businessName + educationName;
|
|
|
- if (StringUtils.isNotBlank(goods.getSubjectIds())){
|
|
|
+ if (StringUtils.isNotBlank(goods.getSubjectIds())) {
|
|
|
List<CourseSubject> subjects = courseSubjectService.listByIds(Arrays.stream(goods.getSubjectIds().split(",")).collect(Collectors.toList()));
|
|
|
List<String> names = subjects.stream().map(CourseSubject::getSubjectName).collect(Collectors.toList());
|
|
|
- className = String.format("%s(%s)",className,org.apache.commons.lang3.StringUtils.join(names,'+'));
|
|
|
+ className = String.format("%s(%s)", className, org.apache.commons.lang3.StringUtils.join(names, '+'));
|
|
|
}
|
|
|
Integer nameSort = 1;
|
|
|
//获取排序值
|
|
|
List<ClassGrade> list = iClassGradeService
|
|
|
.list(new LambdaQueryWrapper<ClassGrade>()
|
|
|
- .like(ClassGrade::getClassName, className));
|
|
|
- if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ .like(ClassGrade::getClassName, className));
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
List<Integer> collect = list.stream().filter(x -> x.getClassName().contains("第") && x.getClassName().contains("期")).map(item -> {
|
|
|
String name = item.getClassName();
|
|
|
String substring = name.substring(name.indexOf("第") + 1, name.indexOf("期"));
|
|
|
return Integer.parseInt(substring);
|
|
|
}).collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(collect)){
|
|
|
+ if (CollectionUtils.isNotEmpty(collect)) {
|
|
|
Integer integer = collect.stream().sorted(Comparator.reverseOrder()).findFirst().get();
|
|
|
nameSort = integer + 1;
|
|
|
}
|
|
|
}
|
|
|
- classGrade.setClassName(String.format("%s年第%s期%s",goods.getYear(),nameSort,className));
|
|
|
+ classGrade.setClassName(String.format("%s年第%s期%s", goods.getYear(), nameSort, className));
|
|
|
|
|
|
boolean save = iClassGradeService.save(classGrade);
|
|
|
//绑定班级商品
|
|
@@ -1795,47 +1802,46 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private String createGradeCode(Long goodsId,CourseBusinessVo business) {
|
|
|
+ private String createGradeCode(Long goodsId, CourseBusinessVo business) {
|
|
|
|
|
|
Goods goods = iGoodsService.getById(goodsId);
|
|
|
- if (StringUtils.isNotBlank(business.getAliasName()) && (business.getAliasName().equals("二级建造师") || business.getAliasName().equals("二级造价工程师"))){
|
|
|
- List<Goods> goodsList = iGoodsService.list(new LambdaQueryWrapper<Goods>()
|
|
|
- .eq(Goods::getEducationTypeId, goods.getEducationTypeId())
|
|
|
- .eq(Goods::getBusinessId, goods.getBusinessId())
|
|
|
- .eq(Goods::getStatus,1)
|
|
|
- .eq(Goods::getGoodsStatus,1)
|
|
|
- .eq(Goods::getProjectId, goods.getProjectId())
|
|
|
- .eq(Goods::getSubjectIds, goods.getSubjectIds()));
|
|
|
- if (goodsList.size() > 1){
|
|
|
- //该业务层次下有多个商品
|
|
|
- List<Long> goodsIds = goodsList.stream().filter(item -> !item.getGoodsId().equals(goodsId)).map(Goods::getGoodsId).collect(Collectors.toList());
|
|
|
- //获取预报名班级
|
|
|
- List<ClassGradeGoods> goodsGradeList = iClassGradeGoodsService.getClassGradeByIds(goodsIds);
|
|
|
- if (CollectionUtils.isNotEmpty(goodsGradeList)){
|
|
|
- Map<Long, List<ClassGradeGoods>> map = goodsGradeList.stream().collect(Collectors.groupingBy(ClassGradeGoods::getGoodsId));
|
|
|
- List<ClassGradeSortBo> sortList = new ArrayList<>();
|
|
|
- map.forEach((k, v) -> {
|
|
|
- ClassGradeSortBo sortBo = new ClassGradeSortBo();
|
|
|
- sortBo.setKey(k);
|
|
|
- sortBo.setSize(v.size());
|
|
|
- sortList.add(sortBo);
|
|
|
- });
|
|
|
- ClassGradeSortBo sortBo = sortList.stream().sorted(Comparator.comparing(ClassGradeSortBo::getSize).reversed()).findFirst().orElse(null);
|
|
|
- List<ClassGradeGoods> classGradesMax = map.get(sortBo.getKey()).stream().sorted(Comparator.comparing(ClassGradeGoods::getCreateTime)).collect(Collectors.toList());
|
|
|
- //班级信息
|
|
|
- List<ClassGrade> list = iClassGradeService.listByIds(classGradesMax.stream().map(ClassGradeGoods::getGradeId).collect(Collectors.toList()));
|
|
|
- //获取当前机构商品下的班级
|
|
|
- List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService.getGradeGoodsList(goods.getGoodsId());
|
|
|
- if (gradeGoods.size() < list.size()) {
|
|
|
- ClassGrade grade = list.get(gradeGoods.size());
|
|
|
- if (iClassGradeService.checkEjjjPeopleNumLimit(business.getId(),grade.getGradeId())){
|
|
|
- return grade.getOfficialName();
|
|
|
- }
|
|
|
- return ServletUtils.getEncoded("PIY");
|
|
|
+ List<Goods> goodsList = iGoodsService.list(new LambdaQueryWrapper<Goods>()
|
|
|
+ .eq(Goods::getEducationTypeId, goods.getEducationTypeId())
|
|
|
+ .eq(Goods::getBusinessId, goods.getBusinessId())
|
|
|
+ .eq(Goods::getStatus, 1)
|
|
|
+ .eq(Goods::getGoodsStatus, 1)
|
|
|
+ .eq(Goods::getProjectId, goods.getProjectId())
|
|
|
+ .eq(Goods::getSubjectIds, goods.getSubjectIds()));
|
|
|
+ if (goodsList.size() > 1) {
|
|
|
+ //该业务层次下有多个商品
|
|
|
+ List<Long> goodsIds = goodsList.stream().filter(item -> !item.getGoodsId().equals(goodsId)).map(Goods::getGoodsId).collect(Collectors.toList());
|
|
|
+ //获取预报名班级
|
|
|
+ List<ClassGradeGoods> goodsGradeList = iClassGradeGoodsService.getClassGradeByIds(goodsIds);
|
|
|
+ if (CollectionUtils.isNotEmpty(goodsGradeList)) {
|
|
|
+ Map<Long, List<ClassGradeGoods>> map = goodsGradeList.stream().collect(Collectors.groupingBy(ClassGradeGoods::getGoodsId));
|
|
|
+ List<ClassGradeSortBo> sortList = new ArrayList<>();
|
|
|
+ map.forEach((k, v) -> {
|
|
|
+ ClassGradeSortBo sortBo = new ClassGradeSortBo();
|
|
|
+ sortBo.setKey(k);
|
|
|
+ sortBo.setSize(v.size());
|
|
|
+ sortList.add(sortBo);
|
|
|
+ });
|
|
|
+ ClassGradeSortBo sortBo = sortList.stream().sorted(Comparator.comparing(ClassGradeSortBo::getSize).reversed()).findFirst().orElse(null);
|
|
|
+ List<ClassGradeGoods> classGradesMax = map.get(sortBo.getKey()).stream().sorted(Comparator.comparing(ClassGradeGoods::getCreateTime)).collect(Collectors.toList());
|
|
|
+ //班级信息
|
|
|
+ List<ClassGrade> list = iClassGradeService.listByIds(classGradesMax.stream().map(ClassGradeGoods::getGradeId).collect(Collectors.toList()));
|
|
|
+ //获取当前机构商品下的班级
|
|
|
+ List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService.getGradeGoodsList(goods.getGoodsId());
|
|
|
+ if (gradeGoods.size() < list.size()) {
|
|
|
+ ClassGrade grade = list.get(gradeGoods.size());
|
|
|
+ if (iClassGradeService.checkEjjjPeopleNumLimit(business.getId(), grade.getGradeId())) {
|
|
|
+ return grade.getOfficialName();
|
|
|
}
|
|
|
+ return ServletUtils.getEncoded("PIY");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
List<CourseSubject> courseSubjectList = courseSubjectService.listByIds(Arrays.asList(goods.getSubjectIds().split(",")));
|
|
|
List<String> subNames = courseSubjectList.stream().map(CourseSubject::getSubjectName).collect(Collectors.toList());
|
|
|
List<Long> subIds = courseSubjectService.getIdsByTenant(subNames);
|
|
@@ -1862,7 +1868,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//去重
|
|
|
List<String> codeStrs = new ArrayList<>();
|
|
|
for (ClassGrade gradesMax : classGradesMax) {
|
|
|
- if (codeStrs.contains(gradesMax.getOfficialName())){
|
|
|
+ if (codeStrs.contains(gradesMax.getOfficialName())) {
|
|
|
continue;
|
|
|
}
|
|
|
codeStrs.add(gradesMax.getOfficialName());
|
|
@@ -1902,8 +1908,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
throw new CustomException("该班级不支持该商品使用");
|
|
|
}
|
|
|
//判断用户是否在此班过
|
|
|
- ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId,userId).eq(ClassGradeUser::getGradeId,gradeId).last("limit 1"));
|
|
|
- if(Validator.isEmpty(gradeUser)){
|
|
|
+ ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId, userId).eq(ClassGradeUser::getGradeId, gradeId).last("limit 1"));
|
|
|
+ if (Validator.isEmpty(gradeUser)) {
|
|
|
LambdaQueryWrapper<ClassGradeUser> lqw = new LambdaQueryWrapper<>();
|
|
|
lqw.eq(ClassGradeUser::getGradeId, gradeId);
|
|
|
lqw.eq(ClassGradeUser::getStatus, 1);
|
|
@@ -1916,7 +1922,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//预留0空位避免超人数
|
|
|
if ((classGradeVo.getStudentUpper() - studentNum - locakStudentNum) > 0) {
|
|
|
//班级还有剩位,直接加入班级
|
|
|
- if(iClassGradeService.checkEjjjPeopleNumLimit(businessId,gradeId)) { //判断全系统平台二建班级人数是否超300
|
|
|
+ if (iClassGradeService.checkEjjjPeopleNumLimit(businessId, gradeId)) { //判断全系统平台二建班级人数是否超300
|
|
|
joinGrade(orderGoodsId, gradeId, userId);
|
|
|
return gradeId;
|
|
|
}
|
|
@@ -1942,10 +1948,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//有空位则进入班级
|
|
|
gradeId = classGradeVo.getGradeId();
|
|
|
//判断用户是否在此班过
|
|
|
- ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId,userId).eq(ClassGradeUser::getGradeId,gradeId).last("limit 1"));
|
|
|
- if(Validator.isEmpty(gradeUser)){
|
|
|
+ ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId, userId).eq(ClassGradeUser::getGradeId, gradeId).last("limit 1"));
|
|
|
+ if (Validator.isEmpty(gradeUser)) {
|
|
|
//班级还有剩位,直接加入班级
|
|
|
- if(iClassGradeService.checkEjjjPeopleNumLimit(businessId,gradeId)) { //判断全系统平台二建班级人数是否超300
|
|
|
+ if (iClassGradeService.checkEjjjPeopleNumLimit(businessId, gradeId)) { //判断全系统平台二建班级人数是否超300
|
|
|
joinGrade(orderGoodsId, gradeId, userId);
|
|
|
return gradeId;
|
|
|
}
|
|
@@ -2025,10 +2031,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
if ((classGradeVo.getStudentUpper() - studentNum - locakStudentNum) > 0) {
|
|
|
//班级还有剩位,直接加入班级
|
|
|
Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, goodsId));
|
|
|
- if(iClassGradeService.checkEjjjPeopleNumLimit(goods.getBusinessId(),gradeId)) { //判断全系统平台二建班级人数是否超300
|
|
|
+ if (iClassGradeService.checkEjjjPeopleNumLimit(goods.getBusinessId(), gradeId)) { //判断全系统平台二建班级人数是否超300
|
|
|
joinGrade(orderGoodsId, gradeId, userId);
|
|
|
return gradeId;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
throw new CustomException("该二建班级学员已满,请重新选班");
|
|
|
}
|
|
|
|
|
@@ -2088,7 +2094,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//通知外部系统
|
|
|
OrderGoods orderGoods = iOrderGoodsService.getById(orderGoodsId);
|
|
|
Goods goods = iGoodsService.getById(orderGoods.getGoodsId());
|
|
|
- iClassGradeService.gradeChangeEjjjPeople(goods.getBusinessId(),gradeId);
|
|
|
+ iClassGradeService.gradeChangeEjjjPeople(goods.getBusinessId(), gradeId);
|
|
|
return true;
|
|
|
}
|
|
|
}
|