|
@@ -138,6 +138,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
User user = userMapper.selectById(payRequest.getUserId());
|
|
User user = userMapper.selectById(payRequest.getUserId());
|
|
|
GoodsDonSku sku = goodsDonSkuMapper.selectById(payRequest.getSkuId());
|
|
GoodsDonSku sku = goodsDonSkuMapper.selectById(payRequest.getSkuId());
|
|
|
GoodsDon goodsDon = goodsDonMapper.selectById(sku.getGoodsId());
|
|
GoodsDon goodsDon = goodsDonMapper.selectById(sku.getGoodsId());
|
|
|
|
|
+ Boolean isNew = false;
|
|
|
if (goodsDon == null || !goodsDon.getStatus()) {
|
|
if (goodsDon == null || !goodsDon.getStatus()) {
|
|
|
throw new BusinessRuntimeException("商品已下架");
|
|
throw new BusinessRuntimeException("商品已下架");
|
|
|
}
|
|
}
|
|
@@ -183,6 +184,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
groupsRelation.setStatus(GroupsRelation.Status.none);
|
|
groupsRelation.setStatus(GroupsRelation.Status.none);
|
|
|
groupsRelationMapper.insert(groupsRelation);
|
|
groupsRelationMapper.insert(groupsRelation);
|
|
|
}
|
|
}
|
|
|
|
|
+ isNew = true;
|
|
|
} else {
|
|
} else {
|
|
|
//寻找快满编车队进行占座
|
|
//寻找快满编车队进行占座
|
|
|
relation = groupsRelationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
relation = groupsRelationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
@@ -238,7 +240,20 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
if (goodsDon.getType() == 2) {
|
|
if (goodsDon.getType() == 2) {
|
|
|
saveTransport(payRequest.getAddressId(), orderDon.getId());
|
|
saveTransport(payRequest.getAddressId(), orderDon.getId());
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ if (isNew) {
|
|
|
|
|
+ //新增空车队发送模板消息
|
|
|
|
|
+ TASK_POOL.execute(() -> {
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<CustomerService> customerServices = customerServiceMapper.selectList(null);
|
|
|
|
|
+ for (CustomerService customerService : customerServices) {
|
|
|
|
|
+ log.info("发送客服{}空车位通知消息", customerService.getNickName());
|
|
|
|
|
+ emptySendMsgNotify(orderDon, customerService.getOpenId());
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("发送{}空车位模板消息至客服失败:{}", orderDon.getGoodsId(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
jobManager.addJob(EXPIRY_TIME, () -> {
|
|
jobManager.addJob(EXPIRY_TIME, () -> {
|
|
|
closeOrder(orderDon.getId());
|
|
closeOrder(orderDon.getId());
|
|
|
});
|
|
});
|
|
@@ -846,10 +861,6 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
log.error("车位异常 groupId:{}", relation.getGroupsId());
|
|
log.error("车位异常 groupId:{}", relation.getGroupsId());
|
|
|
throw new BusinessRuntimeException("车位异常");
|
|
throw new BusinessRuntimeException("车位异常");
|
|
|
}
|
|
}
|
|
|
- GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class).eq(GroupsTrips::getId, relation.getGroupsId()).last("limit 1"));
|
|
|
|
|
- if (groupsTrips.getAvailableNum() == 0) {
|
|
|
|
|
- groupsMapper.tripsFullSeat(groupsTrips.getId());
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -861,10 +872,6 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
log.error("车位异常 groupId:{}", relation.getGroupsId());
|
|
log.error("车位异常 groupId:{}", relation.getGroupsId());
|
|
|
throw new BusinessRuntimeException("车位异常");
|
|
throw new BusinessRuntimeException("车位异常");
|
|
|
}
|
|
}
|
|
|
- GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class).eq(GroupsTrips::getId, relation.getGroupsId()).last("limit 1"));
|
|
|
|
|
- if (groupsTrips.getIsFullSeat()) {
|
|
|
|
|
- groupsMapper.tripsNoFullSeat(groupsTrips.getId());
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void saveTransport(Long addressId, Long orderId) {
|
|
public void saveTransport(Long addressId, Long orderId) {
|