feat:错误处理
This commit is contained in:
1 parent
50f5ff781d
commit
7c153751ec
1 file changed
+20
-17
+20
-17
@@ -506,26 +506,29 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
|
||||
// 发送mq消息
|
||||
@Override
|
||||
@Transactional
|
||||
public void createOrderAfterSendMqMsg(Long orderId) {
|
||||
HardOrderEntity orderdetail = baseMapper.selectById(orderId);
|
||||
if (ObjectUtil.isEmpty(orderdetail)) {
|
||||
log.error("|{}|发送mq消息失败,订单不存在orderId|{}|", TAG, orderId);
|
||||
return;
|
||||
}
|
||||
HardTypeEnum hardTypeEnum = HardTypeEnum.valueOfByType(orderdetail.getSysType());
|
||||
if (ObjectUtil.isEmpty(hardTypeEnum)) {
|
||||
log.error("|{}|发送mq消息失败,设备类型错误hardType不存在hardType|{}|", TAG, orderdetail.getSysType());
|
||||
return;
|
||||
}
|
||||
switch (hardTypeEnum) {
|
||||
// 超市需要打印订单
|
||||
case SUPERMARKET -> {
|
||||
Boolean isPrint = hardInvoiceService.printByOrder(orderdetail);
|
||||
if (isPrint) {
|
||||
log.info("|{}|发送mq消息成功,超市打印发票order|{}|", TAG, JSON.toJSONString(orderId));
|
||||
try {
|
||||
HardOrderEntity orderdetail = baseMapper.selectById(orderId);
|
||||
if (ObjectUtil.isEmpty(orderdetail)) {
|
||||
log.error("|{}|发送mq消息失败,订单不存在orderId|{}|", TAG, orderId);
|
||||
return;
|
||||
}
|
||||
HardTypeEnum hardTypeEnum = HardTypeEnum.valueOfByType(orderdetail.getSysType());
|
||||
if (ObjectUtil.isEmpty(hardTypeEnum)) {
|
||||
log.error("|{}|发送mq消息失败,设备类型错误hardType不存在hardType|{}|", TAG, orderdetail.getSysType());
|
||||
return;
|
||||
}
|
||||
switch (hardTypeEnum) {
|
||||
// 超市需要打印订单
|
||||
case SUPERMARKET -> {
|
||||
Boolean isPrint = hardInvoiceService.printByOrder(orderdetail);
|
||||
if (isPrint) {
|
||||
log.info("|{}|发送mq消息成功,超市打印发票order|{}|", TAG, JSON.toJSONString(orderId));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("|{}|发送mq消息成功,意外的错误error|{}|", TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user