Sfoglia il codice sorgente

feat(order): 集成ERP推送服务并添加预交付日期字段

- 在CustomerInfoServiceImpl中集成RemoteErpPushService用于客户数据推送
- 在OrderMainServiceImpl中集成RemoteErpPushService用于订单数据推送
- 在OrderReturnServiceImpl中集成RemoteErpPushService用于售后数据推送
- 为订单产品添加预交付日期字段preDeliveryDate
- 修改客户信息、订单信息和退货单信息的处理逻辑以支持ERP数据推送
- 修复部门采购功能中的返回值构建问题
hurx 9 ore fa
parent
commit
4bdc1f13cf

+ 6 - 2
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerInfoServiceImpl.java

@@ -38,6 +38,7 @@ import org.dromara.customer.mapper.*;
 import org.dromara.customer.service.ICustomerInfoService;
 import org.dromara.customer.utils.qcc.QccUtils;
 import org.dromara.customer.utils.qcc.domain.CompanyInfoResponse;
+import org.dromara.external.api.service.RemoteErpPushService;
 import org.dromara.product.api.RemoteOrderInfoService;
 import org.dromara.product.api.RemoteProductService;
 import org.dromara.product.api.domain.dto.HotProductRankingDto;
@@ -117,6 +118,9 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
     @DubboReference
     private RemoteProductService remoteProductService;
 
+    @DubboReference
+    private RemoteErpPushService remoteErpPushService;
+
     private static final String CUSTOMER_NO_KEY = "customer_info:customer_no";
     private static final String CONTACT_NO_KEY = "customer_contact:contact_no";
 
@@ -1136,7 +1140,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
 
         // 3. 插入新的关联数据
         saveAssociatedData(customerId, bo);
-        customerInfoJson(customerId);
+        remoteErpPushService.pushCustomerData(customerInfoJson(customerId),false);
         return true;
     }
 
@@ -1244,7 +1248,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
                 .set(CustomerInfo::getStatus, status)
                 .eq(CustomerInfo::getId, customerId));
         if (num > 0) {
-            customerInfoJson(customerId);
+            remoteErpPushService.pushCustomerData(customerInfoJson(customerId),true);  ;
         }
         return num;
     }

+ 1 - 0
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/controller/mini/MiniOrderController.java

@@ -307,6 +307,7 @@ public class MiniOrderController extends BaseController {
                     orderProductBo.setMinOrderQuantity(productVo.getMinOrderQuantity());
                     orderProductBo.setMinSellingPrice(productVo.getMinSellingPrice());
                     orderProductBo.setOrderQuantity(quantity);
+                    orderProductBo.setPreDeliveryDate(mainBo.getExpectedDeliveryTime());
                     orderProductBo.setSubtotal(productVo.getMemberPrice().multiply(BigDecimal.valueOf(quantity)));
                     return orderProductBo;
                 })

+ 2 - 1
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/controller/pc/PcOrderController.java

@@ -438,6 +438,7 @@ public class PcOrderController extends BaseController {
                     orderProductBo.setMinOrderQuantity(productVo.getMinOrderQuantity());
                     orderProductBo.setMinSellingPrice(productVo.getMinSellingPrice());
                     orderProductBo.setOrderQuantity(quantity);
+                    orderProductBo.setPreDeliveryDate(mainBo.getExpectedDeliveryTime());
                     orderProductBo.setSubtotal(productVo.getMemberPrice().multiply(BigDecimal.valueOf(quantity)));
                     return orderProductBo;
                 })
@@ -539,7 +540,7 @@ public class PcOrderController extends BaseController {
     public TableDataInfo<DeptPurchaseVo> deptPurchase(@RequestParam(required = false) Long contactId, PageQuery pageQuery) {
         Long customerId = LoginHelper.getLoginUser().getCustomerId();
         if (ObjectUtil.isEmpty(customerId)) {
-            return  TableDataInfo.build();
+            return TableDataInfo.build();
         }
         return orderMainService.deptPurchase(customerId, contactId, pageQuery);
     }

+ 6 - 2
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderMainServiceImpl.java

@@ -29,6 +29,7 @@ import org.dromara.customer.api.*;
 import org.dromara.customer.api.domain.dto.CustomerInfoDTO;
 import org.dromara.customer.api.domain.vo.RemoteCustomerContactVo;
 import org.dromara.customer.api.domain.vo.RemoteCustomerSalesVo;
+import org.dromara.external.api.service.RemoteErpPushService;
 import org.dromara.external.api.service.RemoteExternalItemService;
 import org.dromara.external.api.tongji.RemoteTongJiPullService;
 import org.dromara.external.api.zhongche.RemoteZhongChePullService;
@@ -115,6 +116,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
     @DubboReference
     private RemoteErpDeptService remoteErpDeptService;
 
+    @DubboReference
+    private RemoteErpPushService remoteErpPushService;
+
     //客户订单流程
     private final IOrderCustomerFlowService orderCustomerFlowService;
 
@@ -722,7 +726,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
             // 5. 批量插入订单商品
             orderProductMapper.insertBatch(orderProducts);
 
-            orderMainInfoToJson(orderId);
+            remoteErpPushService.pushOrderData(orderMainInfoToJson(orderId), false);
             log.info("成功新增订单,ID: {}", orderId);
             return orderId;
         } catch (RuntimeException e) {
@@ -829,7 +833,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
             if (bo.getPlaceOrderType() == 1) {
                 remoteProductShoppingCartService.deleteWithValidByIds(bo.getProductShoppingCartId());
             }
-            orderMainInfoToJson(orderId);
+            remoteErpPushService.pushOrderData(orderMainInfoToJson(orderId), false);
             return orderId;
         } else {
             // 插入失败,抛出异常触发事务回滚

+ 6 - 2
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderReturnServiceImpl.java

@@ -19,6 +19,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.common.redis.utils.SequenceUtils;
 import org.dromara.customer.api.RemoteCustomerService;
 import org.dromara.customer.api.domain.dto.CustomerInfoDTO;
+import org.dromara.external.api.service.RemoteErpPushService;
 import org.dromara.order.domain.*;
 import org.dromara.order.domain.bo.ApiOrderReturnBo;
 import org.dromara.order.domain.bo.OrderReturnBo;
@@ -71,6 +72,9 @@ public class OrderReturnServiceImpl extends ServiceImpl<OrderReturnMapper, Order
     @DubboReference
     private RemoteComDeptService remoteComDeptService;
 
+    @DubboReference
+    private RemoteErpPushService remoteErpPushService;
+
     private final OrderReturnMapper baseMapper;
 
     private final OrderMainMapper orderMainMapper;
@@ -265,7 +269,7 @@ public class OrderReturnServiceImpl extends ServiceImpl<OrderReturnMapper, Order
 
         // 保存明细
         saveOrderReturnItems(entity.getId(), bo.getOrderReturnItemList(), false);
-        orderReturnToJson(entity.getId());
+        remoteErpPushService.pushAfterSaleData(orderReturnToJson(entity.getId()), false);
         log.info("新增退货单成功,单号: {}", entity.getReturnNo());
         return true;
     }
@@ -304,7 +308,7 @@ public class OrderReturnServiceImpl extends ServiceImpl<OrderReturnMapper, Order
 
         // 先删后插明细
         saveOrderReturnItems(bo.getId(), bo.getOrderReturnItemList(), true);
-
+        remoteErpPushService.pushAfterSaleData(orderReturnToJson(entity.getId()), true);
         log.info("修改退货单成功,ID: {}", bo.getId());
         return true;
     }