# 第三方对接模块拆解分析
## 一、功能描述
1、管理与第三方对接
2、公开CRM内部接口提供给有赞（商城调用）
3、封装调用WMS、SAP、CMS接口
## **二、代码运行截图**
![输入图片说明](/imgs/2024-02-26/PEii8t1QIhnFxXMu.png)![](https://dev.rzdata.net/download/attachments/51773469/image2024-2-17_15-29-8.png?version=1&modificationDate=1708154949000&api=v2)
![输入图片说明](/imgs/2024-02-26/ZY0E3QcF8x8PwieH.png)![](https://dev.rzdata.net/download/attachments/51773469/image2024-2-17_16-1-47.png?version=1&modificationDate=1708156908000&api=v2)
## **三、接口说明**

### **1.CMS接口**
<table>
	<tbody>
	<tr>
		<td>类地址</td>
		<td>类名</td>
		<td>类说明</td>
		<td>请求方式</td>
		<td>方法地址</td>
		<td>方法名</td>
		<td>方法说明</td>
	</tr>
	<tr>
		<td rowspan="2" >/api/cms/contract</td>
		<td rowspan="2" >CmsContractController&nbsp;&nbsp;</td>
		<td rowspan="2" >cms对接合同</td>
		<td >POST</td>
		<td >/pass</td>
		<td >pass</td>
		<td >合同审核通过</td>
	</tr>
	<tr>
		<td >POST</td>
		<td >/close</td>
		<td >close</td>
		<td >合同关闭</td>
	</tr>
	</tbody>
</table>

### 2.SAP接口
<table >
	<tbody>
		<tr>
			<td >类地址</td>
			<td >类名</td>
			<td >类说明</td>
			<td >请求方式</td>
			<td >方法地址</td>
			<td >方法名</td>
			<td >方法说明</td>
		</tr>
		<tr>
			<td rowspan="2" >/api/sap/allot</td>
			<td rowspan="2" >SapAllotController&nbsp;</td>
			<td rowspan="2" >sap对接分布式调拨单</td>
			<td >POST</td>
			<td >/callback/update</td>
			<td >updateBySap</td>
			<td >更新调拨单状态(SAP调用)</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/sync</td>
			<td >sync</td>
			<td >调拨单调入后同步到SAP</td>
		</tr>
		<tr>
			<td rowspan="3" >/api/sap/cancelOrder</td>
			<td rowspan="3" >SapCancelOrderController</td>
			<td rowspan="3" >sap对接退货订单</td>
			<td >POST</td>
			<td >/save</td>
			<td >saveCancelOrder</td>
			<td >新增退货订单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/delete</td>
			<td >delete</td>
			<td >删除退货订单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/delete/atom</td>
			<td >deleteAtom</td>
			<td >删除(原子性)</td>
		</tr>
		<tr>
			<td rowspan="16" >/api/sap/client</td>
			<td rowspan="16" >SapClientController</td>
			<td rowspan="16" >sap对接客户</td>
			<td >POST</td>
			<td >/save</td>
			<td >saveClient</td>
			<td >新建客户</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/update</td>
			<td >updateClient</td>
			<td >修改客户</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/delete</td>
			<td >deleteClient</td>
			<td >删除客户</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/freeze</td>
			<td >freezeClient</td>
			<td >冻结客户</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/unFreeze</td>
			<td >unFreezeClient</td>
			<td >解冻客户</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/partialUpdate</td>
			<td >partialUpdate</td>
			<td >sap更新客户或组织信息后调用</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/updateBatch</td>
			<td >updateBatch</td>
			<td >批量修改客户</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/syncClient</td>
			<td >syncClient</td>
			<td >初始化客户</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/addRelation</td>
			<td >addRelation</td>
			<td >增加关联</td>
		</tr>
		<tr>
			<td >GET</td>
			<td >/selectSapCodeByClientCode</td>
			<td >selectSapCodeByClientCode</td>
			<td >根据客户编码查询客户的sap编码</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/saveClientSap</td>
			<td >saveClientSap</td>
			<td >保存客户sap关联</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/batchSave</td>
			<td >batchSaveClientOrg</td>
			<td >基于组织关联批量保存客户sap关联</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/batchSaveClientSap</td>
			<td >batchSaveClientSap</td>
			<td >基于客户关联批量保存客户sap关联</td>
		</tr>
		<tr>
			<td >GET</td>
			<td >/getSapClientCode</td>
			<td >getSapOrderCode</td>
			<td >通过CRM客户编码查询对应的SAP客户编号</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/batchImport</td>
			<td >batchImport</td>
			<td >批量插入sap客户关联</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/getSapCode</td>
			<td >getSapCode</td>
			<td >查询sap编码</td>
		</tr>
		<tr>
			<td >/api/sap/exchange</td>
			<td >SapExchangeController</td>
			<td >sap对接汇率</td>
			<td >POST</td>
			<td >/getExchange</td>
			<td >saveCancelOrder</td>
			<td >月初调取记账汇率</td>
		</tr>
		<tr>
			<td rowspan="3" >/api/sap/instrumentPut</td>
			<td rowspan="3" >SapInstrumentPutController</td>
			<td rowspan="3" >sap对接其他出库单</td>
			<td >POST</td>
			<td >/save</td>
			<td >saveInstrumentPut</td>
			<td >建立资产卡片，新增其他出库单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/saveQtckd</td>
			<td >saveQtckd</td>
			<td >新增其他出库单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/update</td>
			<td >update</td>
			<td >更新单据数据（sap调用）</td>
		</tr>
		<tr>
			<td rowspan="4" >/api/sap/invoice</td>
			<td rowspan="4" >SapInvoiceController</td>
			<td rowspan="4" >sap对接发票</td>
			<td >POST</td>
			<td >/save</td>
			<td >saveInvoice</td>
			<td >新增</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/writeOff</td>
			<td >writeOffInvoice</td>
			<td >冲销</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/update</td>
			<td >updateInvoice</td>
			<td >更新发票</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/importUpdate</td>
			<td >importUpdate</td>
			<td >导入更新发票</td>
		</tr>
		<tr>
			<td rowspan="2" >/api/sap/invoiceLost</td>
			<td rowspan="2" >SapInvoiceLostController</td>
			<td rowspan="2" >sap对接发票丢失</td>
			<td >POST</td>
			<td >/pushOtherIn</td>
			<td >pushOtherIn</td>
			<td >发票丢失下推退换货退回订单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/lost/delete</td>
			<td >deleteLost</td>
			<td >删除发票丢失下推的退换货退回订单</td>
		</tr>
		<tr>
			<td >/api/sap/moneyBack</td>
			<td >SapMoneyBackController</td>
			<td >sap对接收款单</td>
			<td >POST</td>
			<td >/push</td>
			<td >push</td>
			<td >收款单数据推送</td>
		</tr>
		<tr>
			<td rowspan="7" >/api/sap/orderErp</td>
			<td rowspan="7" >SapOrderErpController</td>
			<td rowspan="7" >sap对接订单</td>
			<td >POST</td>
			<td >/save</td>
			<td >saveOrderErp</td>
			<td >新增订单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/update</td>
			<td >updateOrderErp</td>
			<td >修改订单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/close</td>
			<td >closeOrderErp</td>
			<td >关闭订单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/delete</td>
			<td >deleteOrderErp</td>
			<td >删除订单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/modifySale</td>
			<td >modifySales</td>
			<td >更新订单销售员</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/importRelation</td>
			<td >importRelation</td>
			<td >导入订单关联</td>
		</tr>
		<tr>
			<td >GET</td>
			<td >/getSapOrderCode</td>
			<td >getSapOrderCode</td>
			<td >通过CRM订单编号查询对应的SAP订单编号</td>
		</tr>
		<tr>
			<td rowspan="4" >/api/sap/org</td>
			<td rowspan="4" >SapOrgController</td>
			<td rowspan="4" >sap对接组织</td>
			<td >POST</td>
			<td >/save</td>
			<td >saveOrg</td>
			<td >新增组织</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/update</td>
			<td >updateOrg</td>
			<td >修改组织</td>
		</tr>
		<tr>
			<td >GET</td>
			<td >/getSapOrgCode</td>
			<td >getSapOrderCode</td>
			<td >通过CRM客户编码查询对应的SAP客户编号</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/batchImport</td>
			<td >batchImport</td>
			<td >批量插入sap组织关联</td>
		</tr>
		<tr>
			<td rowspan="3" >/api/sap/product</td>
			<td rowspan="3" >SapProductController</td>
			<td rowspan="3" >sap对接物料</td>
			<td >POST</td>
			<td >/syn</td>
			<td >syn</td>
			<td >sap同步物料到crm</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/getSapCode</td>
			<td >getSapCode</td>
			<td >通过crm的productCode集合查询出SAP的productCode</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/getSapBusiCodeMap</td>
			<td >getSapBusiCodeMap</td>
			<td >通过SAP的productCode集合查询出crm的productCode</td>
		</tr>
		<tr>
			<td >/api/sap/production</td>
			<td >SapProductionController</td>
			<td >sap对接定制生产</td>
			<td >POST</td>
			<td >/save</td>
			<td >save</td>
			<td >新增</td>
		</tr>
		<tr>
			<td >/api/sap/purchaseOrder</td>
			<td >SapPurchaseOrderController</td>
			<td >sap对接采购订单</td>
			<td >POST</td>
			<td >/save</td>
			<td >save</td>
			<td >采购订单</td>
		</tr>
		<tr>
			<td rowspan="4" >/api/sap/receivable</td>
			<td rowspan="4" >SapReceivableController</td>
			<td rowspan="4" >sap对接应收单</td>
			<td >POST</td>
			<td >/save</td>
			<td >saveReceivable</td>
			<td >新增</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/writeOff</td>
			<td >writeOffReceivable</td>
			<td >冲销</td>
		</tr>
		<tr>
			<td >GET</td>
			<td >/checkWhetherExist</td>
			<td >checkWhetherExist</td>
			<td >检查应收单是否存在关联</td>
		</tr>
		<tr>
			<td >GET</td>
			<td >/getSapCode</td>
			<td >getSapCode</td>
			<td >根据crm单号查询sap应收单号</td>
		</tr>
		<tr>
			<td rowspan="2" >/api/sap/refund</td>
			<td rowspan="2" >SapRefundController</td>
			<td rowspan="2" >sap对接退款单</td>
			<td >POST</td>
			<td >/save</td>
			<td >saveRefund</td>
			<td >新增</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/update</td>
			<td >update</td>
			<td >退款单状态回传接口</td>
		</tr>
		<tr>
			<td rowspan="12" >/api/sap/returns</td>
			<td rowspan="12" >SapReturnsController</td>
			<td rowspan="12" >sap对接退换货</td>
			<td >POST</td>
			<td >/back</td>
			<td >back</td>
			<td >退换货-退货</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/send</td>
			<td >send</td>
			<td >退换货-发货</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/send/modify</td>
			<td >modifySend</td>
			<td >退换货-发货修改</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/send/delete</td>
			<td >deleteSend</td>
			<td >退换货-发货删除</td>
		</tr>
		<tr>
			<td >GET</td>
			<td >/send/unAudit</td>
			<td >unAuditSend</td>
			<td >退换货-发货反审核(办事处发货)</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/back/chargeAgainstBackStockOut</td>
			<td >chargeAgainstBackStockOut</td>
			<td >退换货-退回出库单核销</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/back/deleteBackStockOut</td>
			<td >deleteBackStockOut</td>
			<td >退换货-删除退换货退回出库单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/back/deleteBackOrder</td>
			<td >deleteBackOrder</td>
			<td >退换货-删除退换货退回订单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/send/deleteWmsSendStockOut</td>
			<td >deleteWmsSendStockOut</td>
			<td >退换货-发货WMS出库单删除</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/send/chargeAgainstSendStockOut</td>
			<td >chargeAgainstBackStockOut</td>
			<td >退换货-发货出库单核销</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/send/deleteSendStockOut</td>
			<td >deleteSendStockOut</td>
			<td >退换货-删除退换货发货出库单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/send/deleteSendOrder</td>
			<td >deleteSendOrder</td>
			<td >退换货-删除退换货发货订单</td>
		</tr>
		<tr>
			<td >/api/sap/scrapApply</td>
			<td >SapScrapApplyController</td>
			<td >sap对接报废</td>
			<td >POST</td>
			<td >/save</td>
			<td >save</td>
			<td >新增</td>
		</tr>
		<tr>
			<td rowspan="6" >/api/sap/stock</td>
			<td rowspan="6" >SapStockController</td>
			<td rowspan="6" >sap对接库存</td>
			<td >GET</td>
			<td >/usableStockCalculate</td>
			<td >usableStockCalculate</td>
			<td >可用库存计算</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/usableStockCalculateBatch</td>
			<td >usableStockCalculateBatch</td>
			<td >批量可用库存计算</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/usableStockCalculateBatchGift</td>
			<td >usableStockCalculateBatchGift</td>
			<td >批量可用库存计算</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/instantStockQuery</td>
			<td >instantStockQuery</td>
			<td >即时库存查询</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/instantStockQueryNoLotnum</td>
			<td >instantStockQueryNoLotnum</td>
			<td >无批次即时库存查询(礼品库存)</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/instantStockQueryAll</td>
			<td >instantStockQueryAll</td>
			<td >即时库存查询所有</td>
		</tr>
		<tr>
			<td rowspan="2" >/api/sap/stockingApply</td>
			<td rowspan="2" >SapStockingApplyController</td>
			<td rowspan="2" >备货申请</td>
			<td >POST</td>
			<td >/save</td>
			<td >saveStockingApply</td>
			<td >新增备货申请</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/delete</td>
			<td >deleteStockingApply</td>
			<td >删除备货申请</td>
		</tr>
		<tr>
			<td rowspan="12" >/api/sap/stockOut</td>
			<td rowspan="12" >SapStockOutController</td>
			<td rowspan="12" >sap对接出库单</td>
			<td >POST</td>
			<td >/save</td>
			<td >saveStockOut</td>
			<td >新增</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/update</td>
			<td >updateStockOut</td>
			<td >修改</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/delete</td>
			<td >deleteStockOut</td>
			<td >删除</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/deleteByReturns</td>
			<td >deleteStockOutByReturns</td>
			<td >退货业务删除出库单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/posting</td>
			<td >postingStockOut</td>
			<td >过账</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/chargeAgainst</td>
			<td >chargeAgainstStockOut</td>
			<td >冲销</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/unAudit</td>
			<td >unAudit</td>
			<td >反审核</td>
		</tr>
		<tr>
			<td >GET</td>
			<td >/getSapStockOutCode</td>
			<td >getSapOrderCode</td>
			<td >通过CRM出库单编码查询对应的SAP出库单编号</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/delete/atom</td>
			<td >deleteAtom</td>
			<td >删除(原子性)</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/sureIn</td>
			<td >sureIn</td>
			<td >确认入库</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/confirm</td>
			<td >confirm</td>
			<td >报关</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/getSapCode</td>
			<td >getSapCode</td>
			<td >查询sap编码</td>
		</tr>
		<tr>
			<td >/api/sap/storehouse</td>
			<td >SapStorehouseController</td>
			<td >sap对接仓库</td>
			<td >GET</td>
			<td >/querySapStoreHouse</td>
			<td >querySapStoreHouse</td>
			<td >查询SAP所有仓库信息</td>
		</tr>
		<tr>
			<td >/api/sap/writeOff</td>
			<td >SapWriteOffController</td>
			<td >sap对接收款确认单</td>
			<td >POST</td>
			<td >/save</td>
			<td >saveWriteOff</td>
			<td >新增</td>
		</tr>
	</tbody>
</table>

### 3.wms接口

<table>
	<tbody>
		<tr>
			<td >类地址</td>
			<td >类名</td>
			<td >类说明</td>
			<td >请求方式</td>
			<td >方法地址</td>
			<td >方法名</td>
			<td >方法说明</td>
		</tr>
		<tr>
			<td >/api/wms/allow</td>
			<td >WmsAllotController&nbsp;</td>
			<td >sap对接分布式调拨单</td>
			<td >GET</td>
			<td >/queryExpress</td>
			<td >queryExpress</td>
			<td >查询wms快递信息</td>
		</tr>
		<tr>
			<td rowspan="2" >/api/wms/returns</td>
			<td rowspan="2" >WmsReturnsController</td>
			<td rowspan="2" >wms对接退换货</td>
			<td >GET</td>
			<td >/verification</td>
			<td >verification</td>
			<td >退换货总部发货的出库单锁单</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/send/updateStatus</td>
			<td >updateSendStatus</td>
			<td >更新退换货总部发货出库单状态</td>
		</tr>
		<tr>
			<td rowspan="6" >/api/wms/stockOut</td>
			<td rowspan="6" >WmsStockOutController</td>
			<td rowspan="6" >wms对接出库单</td>
			<td >POST</td>
			<td >/save</td>
			<td >saveStockOut</td>
			<td >新增</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/update</td>
			<td >updateStockOut</td>
			<td >修改</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/verification</td>
			<td >verificationStockOut</td>
			<td >校验、锁单、取消拣配</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/updateStatus</td>
			<td >updateStatus</td>
			<td >更新CRM出库单状态</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/signIn</td>
			<td >signIn</td>
			<td >签收（总部出库单-签收）</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/delte/atom</td>
			<td >deleteAtom</td>
			<td >删除(原子性)</td>
		</tr>
	</tbody>
</table>

### 4.有赞（商城）接口

<table >
	<tbody>
		<tr>
			<td >类地址</td>
			<td >类名</td>
			<td >类说明</td>
			<td >请求方式</td>
			<td >方法地址</td>
			<td >方法名</td>
			<td >方法说明</td>
		</tr>
		<tr>
			<td rowspan="2" >/api/youzan/order</td>
			<td rowspan="2" >OrderController</td>
			<td rowspan="2" >订单控制器</td>
			<td >POST</td>
			<td >/list</td>
			<td >orderList</td>
			<td >订单列表（有赞）</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/detail</td>
			<td >orderDetail</td>
			<td >订单详情（有赞）</td>
		</tr>
		<tr>
			<td rowspan="2" >/api/youzan/preorder</td>
			<td rowspan="2" >PreorderController</td>
			<td rowspan="2" >预付款订单查询控制器</td>
			<td >POST</td>
			<td >/list</td>
			<td >listByQuery</td>
			<td >客户预付款订单列表查询接口</td>
		</tr>
		<tr>
			<td >POST</td>
			<td >/detail</td>
			<td >getDetailByQuery</td>
			<td >客户预付款订单使用详情查询接口</td>
		</tr>
		<tr>
			<td >/api/youzan/imprest</td>
			<td >PreorderImprestController</td>
			<td >预付款余额查询控制器</td>
			<td >POST</td>
			<td >/</td>
			<td >imprest</td>
			<td >客户预付款余额查询接口</td>
		</tr>
		<tr>
			<td >/api/youzan/user</td>
			<td >UserController</td>
			<td >用户控制器</td>
			<td >POST</td>
			<td >/list</td>
			<td >userList</td>
			<td >用户列表查询接口（有赞）</td>
		</tr>
	</tbody>
</table>

## **四****、核心业务流程图**

![输入图片说明](/imgs/2024-02-26/LPC0C9tERb6GoMlc.png)

![输入图片说明](/imgs/2024-02-26/d3yyayaHpB9LMExf.png)
![输入图片说明](/imgs/2024-02-26/sKcVPGrNUG6UvoOJ.png)

## **五、数据库**

****主要表截图如下：****
![输入图片说明](/imgs/2024-02-26/NjYsBWQFIP65rU4j.png)
<!--stackedit_data:
eyJoaXN0b3J5IjpbMTgwMzA3MzczNiwtMTY3MDYxOTcxOSwtMT
QwMDg5Njk1OCwtODQzNDAxNDc4LDEwMjExNzI5ODQsLTU3MzI1
NDkyM119
-->