|
@@ -55,10 +55,7 @@ import com.zhongzheng.modules.grade.vo.ClassGradeVo;
|
|
|
import com.zhongzheng.modules.inform.service.IInformRemindService;
|
|
|
import com.zhongzheng.modules.inform.service.IInformUserService;
|
|
|
import com.zhongzheng.modules.order.bo.*;
|
|
|
-import com.zhongzheng.modules.order.domain.Order;
|
|
|
-import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
-import com.zhongzheng.modules.order.domain.OrderInput;
|
|
|
-import com.zhongzheng.modules.order.domain.OrderPay;
|
|
|
+import com.zhongzheng.modules.order.domain.*;
|
|
|
import com.zhongzheng.modules.order.mapper.OrderMapper;
|
|
|
import com.zhongzheng.modules.order.service.*;
|
|
|
import com.zhongzheng.modules.order.vo.*;
|
|
@@ -97,6 +94,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
@Autowired
|
|
|
private IOrderGoodsService iOrderGoodsService;
|
|
|
@Autowired
|
|
|
+ private IOrderGoodsRefundService iOrderGoodsRefundService;
|
|
|
+ @Autowired
|
|
|
private IGoodsService iGoodsService;
|
|
|
@Autowired
|
|
|
private IClassGradeService iClassGradeService;
|
|
@@ -184,18 +183,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);
|
|
|
}
|
|
|
}
|
|
@@ -245,9 +241,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;
|
|
|
}
|
|
@@ -255,7 +251,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;
|
|
|
}
|
|
@@ -275,10 +271,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());
|
|
|
}
|
|
@@ -440,7 +436,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);
|
|
@@ -468,7 +464,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());
|
|
|
//视频商品安排班级
|
|
@@ -498,7 +494,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);
|
|
@@ -510,7 +506,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("直播商品不允许复购");
|
|
|
}
|
|
|
}
|
|
@@ -553,14 +549,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);
|
|
@@ -609,7 +605,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());
|
|
|
//视频商品安排班级
|
|
@@ -639,8 +635,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());
|
|
@@ -651,7 +647,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("直播商品不允许复购");
|
|
|
}
|
|
|
}
|
|
@@ -666,9 +662,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);//需要支付价格
|
|
@@ -770,7 +766,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);
|
|
@@ -800,7 +796,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());
|
|
|
//视频商品安排班级
|
|
@@ -837,7 +833,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("直播商品不允许复购");
|
|
|
}
|
|
|
}
|
|
@@ -872,7 +868,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);//分销红包活动
|
|
@@ -931,7 +927,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);
|
|
@@ -961,7 +957,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());
|
|
|
//视频商品安排班级
|
|
@@ -998,7 +994,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("直播商品不允许复购");
|
|
|
}
|
|
|
}
|
|
@@ -1044,10 +1040,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);
|
|
@@ -1084,7 +1080,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);
|
|
@@ -1114,7 +1110,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());
|
|
|
//视频商品安排班级
|
|
@@ -1151,7 +1147,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("直播商品不允许复购");
|
|
|
}
|
|
|
}
|
|
@@ -1205,12 +1201,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);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1231,7 +1227,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;
|
|
@@ -1267,7 +1263,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;
|
|
@@ -1284,16 +1280,17 @@ 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;
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
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("订单无法取消");
|
|
|
}
|
|
|
|
|
@@ -1301,12 +1298,12 @@ 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());
|
|
|
OrderGoodsQueryBo bo1 = new OrderGoodsQueryBo();
|
|
|
- bo.setOrderSn(orderVo.getOrderSn());
|
|
|
+ bo1.setOrderSn(orderVo.getOrderSn());
|
|
|
List<OrderGoodsVo> orderGoodsVoList = iOrderGoodsService.selectList(bo1);
|
|
|
for (OrderGoodsVo g : orderGoodsVoList) {
|
|
|
//关闭锁定班级
|
|
@@ -1322,7 +1319,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//班级人数变动通知旧系统
|
|
|
Goods goods = iGoodsService.getById(g.getGoodsId());
|
|
|
iClassGradeService.gradeChangeEjjjPeople(goods.getBusinessId(),classGradeUserTemp.getGradeId());
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1362,6 +1358,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
if (orderGoodsVo.getGoodsRealPrice() != null) {
|
|
|
totalPrice = totalPrice.add(orderGoodsVo.getGoodsRealPrice());
|
|
|
}
|
|
|
+ //审核状态
|
|
|
+ List<OrderGoodsRefund> refundList = iOrderGoodsRefundService
|
|
|
+ .list(new LambdaQueryWrapper<OrderGoodsRefund>()
|
|
|
+ .eq(OrderGoodsRefund::getOrderGoodsId, orderGoodsVo.getOrderGoodsId()));
|
|
|
+ if (CollectionUtils.isNotEmpty(refundList)){
|
|
|
+ OrderGoodsRefund refund = refundList.stream().filter(item -> item.getPeriodStatus() != -1 && item.getPeriodStatus() != -2).findFirst().orElse(null);
|
|
|
+ orderGoodsVo.setPeriodStatus(ObjectUtils.isNotNull(refund)?refund.getPeriodStatus():null);
|
|
|
+ }
|
|
|
}
|
|
|
orderListVo.setOrderGoodsList(list);
|
|
|
orderListVo.setTotalPrice(totalPrice);
|
|
@@ -1393,7 +1397,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;
|
|
@@ -1450,6 +1454,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
/**
|
|
|
* 课程商品ID产生免费的题库商品
|
|
|
+ *
|
|
|
* @param goodsId
|
|
|
* @return
|
|
|
*/
|
|
@@ -1460,15 +1465,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);
|
|
@@ -1476,15 +1481,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());
|
|
@@ -1493,7 +1498,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());
|
|
@@ -1515,12 +1520,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);
|
|
@@ -1550,25 +1555,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();
|
|
@@ -1585,19 +1591,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);
|
|
|
}
|
|
|
}
|
|
@@ -1617,8 +1623,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);
|
|
|
}
|
|
|
}
|
|
@@ -1698,9 +1704,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);
|
|
|
}
|
|
|
|
|
@@ -1728,8 +1734,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);
|
|
|
}
|
|
|
}
|
|
@@ -1739,9 +1745,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//创建新班级
|
|
|
CourseBusinessVo businessVo = iCourseBusinessService.queryById(businessId);
|
|
|
boolean isConfigTp = false; //商品是否有配置选班模板
|
|
|
-// if (Validator.isNotEmpty(businessVo) && Validator.isNotEmpty(businessVo.getTemplateStatus()) && businessVo.getTemplateStatus() == 1) {
|
|
|
-// isConfigTp = true;
|
|
|
-// }
|
|
|
if (Validator.isNotEmpty(businessVo) && Validator.isNotEmpty(businessVo.getTemplateName()) && businessVo.getTemplateName().equals("班级")) {
|
|
|
isConfigTp = true;
|
|
|
}
|
|
@@ -1759,6 +1762,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//生成预开班编号
|
|
|
classGrade.setOfficialName(createGradeCode(goodsId, businessVo));
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
classGrade.setLearningStatus(1);//即刻
|
|
|
classGrade.setStudentUpper(ClassGrade.INIT_UPPER2); //上限1000000
|
|
@@ -1774,28 +1778,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);
|
|
|
//绑定班级商品
|
|
@@ -1810,47 +1814,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);
|
|
@@ -1877,7 +1880,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());
|
|
@@ -1917,8 +1920,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);
|
|
@@ -1931,7 +1934,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;
|
|
|
}
|
|
@@ -1957,10 +1960,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;
|
|
|
}
|
|
@@ -2040,10 +2043,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("该二建班级学员已满,请重新选班");
|
|
|
}
|
|
|
|
|
@@ -2103,7 +2106,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;
|
|
|
}
|
|
|
}
|