From a57dceb3e6bc02e28a86f4de66f593706452c2b4 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期六, 07 十一月 2026 14:53:09 +0800
Subject: [PATCH] refactor: 需求10/23 改为基于 ERP 实现,修正此前 ERP 可用性误判
---
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/api/sale/ErpSaleOrderApiImpl.java | 41 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/api/sale/ErpSaleOrderApiImpl.java b/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/api/sale/ErpSaleOrderApiImpl.java
index 86acb62..910376c 100644
--- a/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/api/sale/ErpSaleOrderApiImpl.java
+++ b/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/api/sale/ErpSaleOrderApiImpl.java
@@ -13,6 +13,10 @@
import cn.iocoder.yudao.module.erp.service.sale.ErpSaleOrderService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
+import java.util.Objects;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -21,11 +25,12 @@
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.invalidParamException;
/**
* ERP 閿�鍞鍗� API 瀹炵幇绫�
*
- * @author 鑺嬮亾婧愮爜
+ * @author 瓒呯骇绠$悊鍛�
*/
@RestController
@RequestMapping(ErpSaleOrderApi.PREFIX)
@@ -57,6 +62,18 @@
@Override
public CommonResult<ErpSaleOrderRespDTO> getSaleOrder(Long id) {
ErpSaleOrderDO order = saleOrderService.getSaleOrder(id);
+ return success(BeanUtils.toBean(order, ErpSaleOrderRespDTO.class));
+ }
+
+ @Override
+ @Transactional(propagation = Propagation.MANDATORY)
+ public CommonResult<ErpSaleOrderRespDTO> lockSaleOrderForNotice(Long id, String orderNo) {
+ if (id == null && (orderNo == null || orderNo.isBlank())) return success(null);
+ ErpSaleOrderDO order = id != null ? saleOrderMapper.selectByIdForUpdate(id) : saleOrderMapper.selectByNoForUpdate(orderNo);
+ if (order == null || (orderNo != null && !orderNo.isBlank() && !Objects.equals(orderNo, order.getNo())))
+ throw invalidParamException("鍏宠仈閿�鍞鍗曚笉瀛樺湪鎴栬鍗曠紪鍙蜂笉鍖归厤");
+ if (!Objects.equals(order.getStatus(), ErpAuditStatus.APPROVE.getStatus()))
+ throw invalidParamException("閿�鍞鍗曟湭瀹℃牳鎴栧凡浣滃簾锛屼笉鑳界敓鎴愬彂璐ч�氱煡");
return success(BeanUtils.toBean(order, ErpSaleOrderRespDTO.class));
}
@@ -111,4 +128,24 @@
return success(true);
}
-}
\ No newline at end of file
+ @Override
+ public CommonResult<Boolean> updateOrderOutStatusTo(Long orderId, Integer outStatus) {
+ if (orderId == null || outStatus == null) {
+ return success(false);
+ }
+ saleOrderMapper.updateById(new ErpSaleOrderDO()
+ .setId(orderId).setOutStatus(outStatus));
+ return success(true);
+ }
+
+ @Override
+ public CommonResult<Boolean> cancelSaleOrder(Long orderId) {
+ if (orderId == null) {
+ return success(false);
+ }
+ // 澶嶇敤 Service 鐨勪綔搴熼�昏緫锛氬惈鐘舵�佹牎楠屻�佸嚭搴撳崟鏍¢獙銆佹湭鍙栨秷 MPS 璁″垝鎷︽埅
+ saleOrderService.cancelSaleOrder(orderId);
+ return success(true);
+ }
+
+}
--
Gitblit v1.9.3