feat:创建订单后下发打印发票mq
This commit is contained in:
1 parent
e18936f302
commit
50f5ff781d
3 files changed
+40
-17
No files matched your search
+1
-1
@@ -30,7 +30,7 @@ public class Drawing2D {
|
||||
|
||||
private final int horizontalPadding = 20;
|
||||
|
||||
private final String fontFamily = "SimSun";
|
||||
private final String fontFamily = "Arial Black";
|
||||
|
||||
/**
|
||||
* end ****************** config ****************** end
|
||||
|
||||
+6
-15
@@ -9,7 +9,6 @@ import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.excel.HardOrderExcelVo;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
@@ -28,24 +27,16 @@ public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
|
||||
/**
|
||||
* 创建app订单
|
||||
*
|
||||
* @param dto 父订单id
|
||||
* @return
|
||||
*/
|
||||
Long appCreateOrder(@Valid HardAppCreateOrderDto dto);
|
||||
|
||||
/**
|
||||
* 快速扣款
|
||||
*
|
||||
* @param order 订单详情
|
||||
* 快速扣款,离线订单使用
|
||||
*/
|
||||
void fastReduceBalance(HardOrderEntity order);
|
||||
|
||||
/**
|
||||
* 计算额外金额
|
||||
*
|
||||
* @param price 购物车总价
|
||||
* @return
|
||||
*/
|
||||
Integer computeExtraPrice(Integer price);
|
||||
|
||||
@@ -61,16 +52,16 @@ public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
|
||||
/**
|
||||
* 扣减库存
|
||||
*
|
||||
* @param isReduce true 扣件库存 false增加库存
|
||||
*/
|
||||
void fastenerInventory(HardOrderEntity order, YesNoEnum isReduce);
|
||||
|
||||
/**
|
||||
* 核销硬件二维码
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Boolean handCancelCode(HandCancelCodeDto dto);
|
||||
|
||||
/**
|
||||
* 创建订单后发送mq消息
|
||||
*/
|
||||
void createOrderAfterSendMqMsg(Long orderId);
|
||||
}
|
||||
+33
-1
@@ -37,6 +37,7 @@ import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo;
|
||||
import com.bsd.pjcloud.hard.mapper.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardCarService;
|
||||
import com.bsd.pjcloud.hard.service.HardInvoiceService;
|
||||
import com.bsd.pjcloud.hard.service.HardManagerService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderService;
|
||||
import com.bsd.pjcloud.supermarket.api.feign.RemoteSupermarketSpuService;
|
||||
@@ -51,11 +52,12 @@ import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
import com.bsd.pjcloud.wallet.api.feign.*;
|
||||
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -67,6 +69,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* 订单表
|
||||
@@ -85,6 +88,8 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
private final HardManagerService hardManagerService;
|
||||
private final HardCarService hardCarService;
|
||||
private final HardParentCarServiceImpl hardParentCarServiceImpl;
|
||||
@Lazy
|
||||
private final HardInvoiceService hardInvoiceService;
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
private final RemoteCodeUseService remoteCodeUseService;
|
||||
@@ -269,6 +274,8 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
getSelf().fastenerInventory(orderObj, YesNoEnum.YES);
|
||||
// 钱包扣款
|
||||
if (isPay) getSelf().fastReduceBalance(orderObj);
|
||||
// 发送mq消息
|
||||
getSelf().createOrderAfterSendMqMsg(orderObj.getId());
|
||||
return orderObj.getId();
|
||||
}
|
||||
|
||||
@@ -497,6 +504,31 @@ 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 二维码类型的订单是否被核销 true被核销 false未核销
|
||||
private boolean validateCodeIsCancel(HardOrderTypeEnum orderType, Long orderId) {
|
||||
Boolean flag = switch (orderType) {
|
||||
|
||||
Reference in new issue
Block a user