diff --git a/cash-api/account-server/src/main/java/com/czg/controller/admin/HandoverRecordController.java b/cash-api/account-server/src/main/java/com/czg/controller/admin/HandoverRecordController.java index b1197d986..f2b241320 100644 --- a/cash-api/account-server/src/main/java/com/czg/controller/admin/HandoverRecordController.java +++ b/cash-api/account-server/src/main/java/com/czg/controller/admin/HandoverRecordController.java @@ -87,9 +87,7 @@ public class HandoverRecordController { //@SaAdminCheckPermission("handoverRecord:handover") public CzgResult handover(@RequestParam Integer isPrint) { Long id = handoverRecordService.handover(); - if (isPrint == 1) { - // TODO 后续需要发生mq消息给打印机 - } + handoverRecordService.printHandoverReceipt(id, isPrint); return CzgResult.success(); } diff --git a/cash-common/cash-common-mq/src/main/java/com/czg/config/RabbitConstants.java b/cash-common/cash-common-mq/src/main/java/com/czg/config/RabbitConstants.java index eb0aa7d08..80ab41679 100644 --- a/cash-common/cash-common-mq/src/main/java/com/czg/config/RabbitConstants.java +++ b/cash-common/cash-common-mq/src/main/java/com/czg/config/RabbitConstants.java @@ -14,5 +14,6 @@ public interface RabbitConstants { public static final String ORDER_CANCEL_QUEUE = "order.cancel.queue"; public static final String ORDER_PRINT_QUEUE = "order.print.queue"; public static final String ORDER_MACHINE_PRINT_QUEUE = "order.machine.print.queue"; + public static final String ORDER_HANDOVER_PRINT_QUEUE = "order.handover.print.queue"; } } diff --git a/cash-common/cash-common-mq/src/main/java/com/czg/config/RabbitPublisher.java b/cash-common/cash-common-mq/src/main/java/com/czg/config/RabbitPublisher.java index 1337934bf..ea4efa0e3 100644 --- a/cash-common/cash-common-mq/src/main/java/com/czg/config/RabbitPublisher.java +++ b/cash-common/cash-common-mq/src/main/java/com/czg/config/RabbitPublisher.java @@ -45,6 +45,15 @@ public class RabbitPublisher { sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId); } + /** + * 交班小票打印消息 + * + * @param handoverRecordId 交班记录id + */ + public void sendHandoverPrintMsg(String handoverRecordId) { + sendMsg(RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE, handoverRecordId); + } + private void sendMsg(String queue, String msg) { diff --git a/cash-common/cash-common-service/src/main/java/com/czg/account/service/HandoverRecordRpcService.java b/cash-common/cash-common-service/src/main/java/com/czg/account/service/HandoverRecordRpcService.java new file mode 100644 index 000000000..99cdd4cf5 --- /dev/null +++ b/cash-common/cash-common-service/src/main/java/com/czg/account/service/HandoverRecordRpcService.java @@ -0,0 +1,15 @@ +package com.czg.account.service; + +import com.czg.account.dto.HandoverRecordDTO; + +/** + * 交班记录RPC服务接口 + * + * @author tankaikai + * @since 2025-03-01 15:34 + */ +public interface HandoverRecordRpcService { + + HandoverRecordDTO getHandoverRecordById(Long handoverRecordId); + +} diff --git a/cash-common/cash-common-service/src/main/java/com/czg/account/service/HandoverRecordService.java b/cash-common/cash-common-service/src/main/java/com/czg/account/service/HandoverRecordService.java index 7486a481e..8fddb8204 100644 --- a/cash-common/cash-common-service/src/main/java/com/czg/account/service/HandoverRecordService.java +++ b/cash-common/cash-common-service/src/main/java/com/czg/account/service/HandoverRecordService.java @@ -53,4 +53,12 @@ public interface HandoverRecordService extends IService { */ Long handover(); + /** + * 交班打印小票 + * + * @param handoverRecordId 交班记录id + * @param isPrint 是否打印 1-是 0-否 + */ + void printHandoverReceipt(Long handoverRecordId, Integer isPrint); + } \ No newline at end of file diff --git a/cash-common/cash-common-service/src/main/java/com/czg/order/service/OrderInfoRpcService.java b/cash-common/cash-common-service/src/main/java/com/czg/order/service/OrderInfoRpcService.java index 53a55116d..f1259c337 100644 --- a/cash-common/cash-common-service/src/main/java/com/czg/order/service/OrderInfoRpcService.java +++ b/cash-common/cash-common-service/src/main/java/com/czg/order/service/OrderInfoRpcService.java @@ -147,4 +147,11 @@ public interface OrderInfoRpcService { * @param orderId 订单id */ void orderCancelCallback(Long orderId); + + /** + * 订单交班回调 发送答应交班小票消息至MQ + * + * @param handoverRecordId 交班记录id + */ + void sendHandoverReceiptPrintMsgToMq(Long handoverRecordId); } diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/HandoverRecordRpcServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/HandoverRecordRpcServiceImpl.java new file mode 100644 index 000000000..33bd65690 --- /dev/null +++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/HandoverRecordRpcServiceImpl.java @@ -0,0 +1,28 @@ +package com.czg.service.account.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.czg.account.dto.HandoverRecordDTO; +import com.czg.account.entity.HandoverRecord; +import com.czg.account.service.HandoverRecordRpcService; +import com.czg.service.account.mapper.HandoverRecordMapper; +import jakarta.annotation.Resource; +import org.apache.dubbo.config.annotation.DubboService; + +/** + * 交班记录RPC服务实现 + * + * @author tankaikai + * @since 2025-03-01 15:35 + */ +@DubboService +public class HandoverRecordRpcServiceImpl implements HandoverRecordRpcService { + + @Resource + private HandoverRecordMapper handoverRecordMapper; + + @Override + public HandoverRecordDTO getHandoverRecordById(Long handoverRecordId) { + HandoverRecord record = handoverRecordMapper.selectOneById(handoverRecordId); + return BeanUtil.copyProperties(record, HandoverRecordDTO.class); + } +} diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/HandoverRecordServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/HandoverRecordServiceImpl.java index 4998071a0..057b71919 100644 --- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/HandoverRecordServiceImpl.java +++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/HandoverRecordServiceImpl.java @@ -12,6 +12,7 @@ import com.czg.account.service.HandoverRecordService; import com.czg.account.vo.HandoverCategoryListVo; import com.czg.account.vo.HandoverProductListVo; import com.czg.account.vo.HandoverTotalVo; +import com.czg.enums.YesNoEnum; import com.czg.order.service.OrderInfoRpcService; import com.czg.sa.StpKit; import com.czg.service.account.mapper.HandoverRecordMapper; @@ -138,6 +139,13 @@ public class HandoverRecordServiceImpl extends ServiceImpl