From b103e4b52215a8178adb05fe501a719ee4be235f Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期二, 19 八月 2025 08:28:29 +0800
Subject: [PATCH] 接口数据同步
---
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/BaseInfoController.java | 91 +++++++++++++++
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/ReceiveMsgController.java | 153 ++----------------------
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/SyncOrderController.java | 82 +++++++++++++
3 files changed, 190 insertions(+), 136 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/BaseInfoController.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/BaseInfoController.java
new file mode 100644
index 0000000..87a657c
--- /dev/null
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/BaseInfoController.java
@@ -0,0 +1,91 @@
+package com.vincent.rsf.server.api.controller.erp;
+
+
+import com.vincent.rsf.framework.common.R;
+import com.vincent.rsf.framework.exception.CoolException;
+import com.vincent.rsf.server.api.controller.erp.params.*;
+import com.vincent.rsf.server.api.service.ReceiveMsgService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Objects;
+
+@RestController
+@RequestMapping("/base")
+@Api(tags = "鍩虹淇℃伅鍚屾")
+public class BaseInfoController {
+
+ @Autowired
+ private ReceiveMsgService receiveMsgService;
+
+ /**
+ * @author Ryan
+ * @date 2025/8/19
+ * @description: 鐗╂枡淇℃伅鍚屾
+ * @version 1.0
+ */
+ @ApiOperation(value = "鍩虹鐗╂枡淇℃伅鍚屾", tags = "鍩虹淇℃伅鍚屾")
+ @PostMapping("/sync/base/matnrs")
+ public R syncMatnrs(@RequestBody List<BaseMatParms> matnrs) {
+ if (Objects.isNull(matnrs)) {
+ return R.error("鍙傛暟涓嶈兘涓虹┖锛�");
+ }
+ receiveMsgService.syncMatnrs(matnrs);
+ return R.ok();
+ }
+
+ /**
+ * @author Ryan
+ * @date 2025/8/18
+ * @description: 搴撲綅淇℃伅鍚屾
+ * @version 1.0
+ */
+ @PostMapping("/sync/locs")
+ @ApiOperation(value = "搴撲綅淇℃伅鍚屾", tags = "鍩虹淇℃伅鍚屾")
+ public R syncLocs(@RequestBody List<SyncLocsParams> locs) {
+ if (locs.isEmpty()) {
+ throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
+ }
+ return receiveMsgService.syncLocs(locs);
+ }
+
+ /**
+ * @author Ryan
+ * @date 2025/8/18
+ * @description: 鐗╂枡鍒嗙粍淇℃伅鍚屾
+ * @version 1.0
+ */
+ @PostMapping("/sync/matGroups")
+ @ApiOperation(value = "鐗╂枡鍒嗙粍淇℃伅鍚屾", tags = "鍩虹淇℃伅鍚屾")
+ public R syncMatGroup(@RequestBody List<SyncMatGroupsParams> matGroupsParams) {
+ if (matGroupsParams.isEmpty()) {
+ throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
+ }
+ return receiveMsgService.syncMatGroups(matGroupsParams);
+ }
+
+ @ApiOperation(value = "搴撳尯鏁版嵁鍚屾", tags = "鍩虹淇℃伅鍚屾")
+ @PostMapping("/sync/warehouse/areas")
+ public R syncLocAreas(@RequestBody List<LocAreasParams> areasParams) {
+ if (areasParams.isEmpty()) {
+ throw new CoolException("搴撳尯鍙傛暟涓嶈兘涓虹┖锛侊紒");
+ }
+ return receiveMsgService.syncWarehouseAreas(areasParams);
+ }
+
+
+ @ApiOperation(value = "搴撳尯鏁版嵁鍚屾", tags = "鍩虹淇℃伅鍚屾")
+ @PostMapping("/sync/warehouse")
+ public R syncWarehouse(@RequestBody List<WarehouseParams> warehouseParams) {
+ if (warehouseParams.isEmpty()) {
+ throw new CoolException("搴撳尯鍙傛暟涓嶈兘涓虹┖锛侊紒");
+ }
+ return receiveMsgService.syncWarehouse(warehouseParams);
+ }
+}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/ReceiveMsgController.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/ReceiveMsgController.java
index b2e2ddf..a8b019f 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/ReceiveMsgController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/ReceiveMsgController.java
@@ -1,30 +1,25 @@
package com.vincent.rsf.server.api.controller.erp;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.vincent.rsf.framework.common.R;
+import com.vincent.rsf.server.api.service.ReceiveMsgService;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.api.controller.erp.params.*;
import com.vincent.rsf.server.api.service.ReceiveMsgService;
import com.vincent.rsf.server.common.domain.BaseParam;
import com.vincent.rsf.server.common.domain.PageParam;
-import com.vincent.rsf.server.common.utils.ExcelUtil;
+import com.vincent.rsf.framework.common.R;
+
import com.vincent.rsf.server.manager.entity.Loc;
-import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate;
import com.vincent.rsf.server.manager.service.MatnrGroupService;
-import com.vincent.rsf.server.manager.service.MatnrService;
import com.vincent.rsf.server.system.controller.BaseController;
import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import io.swagger.annotations.ApiOperation;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -37,91 +32,28 @@
*/
@RestController
@RequestMapping("/erp")
-//@Api(tags = "涓夋柟鎺ュ彛鏂囨。")
+@Api(tags = "鏌ヨ")
public class ReceiveMsgController extends BaseController {
@Autowired
private ReceiveMsgService receiveMsgService;
@Autowired
- private MatnrService matnrService;
- @Autowired
private MatnrGroupService matnrGroupService;
- /**
- * @author Ryan
- * @description 鎺ユ敹ERP鎺ㄩ�佺殑PO鍗曟嵁
- * @throws
- * @return
- * @time 2025/3/4 13:57
- */
- @ApiOperation(value = "鎺ユ敹鍚屾ERP閲囪喘鍗�", tags = "鍗曟嵁鍚屾")
- @PostMapping("/sync/purchase")
- public R syncPurchases(@RequestBody List<OrderParams> orders) {
- if (orders.isEmpty()) {
- return R.error("鎺ㄩ�佽鍗曚笉鑳戒负绌猴紝璇锋鏌ユ牎楠屽悗鍐嶆搷浣滐紒锛�");
- }
- if (!receiveMsgService.syncPurchasee(orders)) {
- return R.error("淇濆瓨澶辫触");
- } else {
- return R.ok("淇濆瓨鎴愬姛锛侊紒");
- }
- }
-
-
- /**
- * @author Ryan
- * @date 2025/8/15
- * @description: DO鍗曞悓姝�
- * @version 1.0
- */
- @ApiOperation(value = "鍑哄簱閫氱煡鍗�(DO鍗曞悓姝�)", tags = "鍗曟嵁鍚屾")
- @PostMapping("/sync/delivery")
- public R syncDelivery(@RequestBody List<OrderParams> orders) {
- if (!receiveMsgService.syncPurchasee(orders)) {
- return R.error("淇濆瓨澶辫触");
- } else {
- return R.ok("淇濆瓨鎴愬姛锛侊紒");
- }
- }
-
- /**
- * @author Ryan
- * @description 鍚屾璐ㄦ缁撴灉淇℃伅
- * @param
- * @return
- * @time 2025/3/12 16:56
- */
- @ApiOperation(value = "璐ㄦ缁撴灉鍚屾", tags = "鍗曟嵁鍚屾")
- @PostMapping("/sync/inspect")
- public void syncQlyInspect(HttpServletRequest request, HttpServletResponse response) {
- AsnOrderTemplate template = ExcelUtil.mockData(AsnOrderTemplate.class);
- List<AsnOrderTemplate> list = new ArrayList<>();
- list.add(template);
- ExcelUtil.build(ExcelUtil.create(list, AsnOrderTemplate.class), response);
- System.out.println(template);
-// return R.ok();
- }
-
-
- @ApiOperation(value = "鍩虹鐗╂枡淇℃伅鍚屾", tags = "鍩虹淇℃伅鍚屾")
- @PostMapping("/sync/base/matnrs")
- public R syncMatnrs(@RequestBody List<BaseMatParms> matnrs) {
- if (Objects.isNull(matnrs)) {
- return R.error("鍙傛暟涓嶈兘涓虹┖锛�");
- }
- receiveMsgService.syncMatnrs(matnrs);
- return R.ok();
- }
-
- @ApiOperation(value = "鏌ヨ鍒嗙被淇℃伅", tags = "鏌ヨ")
+ @ApiOperation(value = "鏌ヨ鍒嗙被淇℃伅")
@PostMapping("/query/matnr/group")
public R syncMatGroup() {
return R.ok().add(matnrGroupService.list());
}
-
- @ApiOperation(value = "鏌ヨ鍗曟嵁鐘舵�佸強鏄庣粏", tags = "鏌ヨ")
+ /**
+ * @author Ryan
+ * @date 2025/8/19
+ * @description: 鏌ヨ鍗曟嵁鍙婃槑缁�
+ * @version 1.0
+ */
+ @ApiOperation(value = "鏌ヨ鍗曟嵁鐘舵�佸強鏄庣粏")
@PostMapping("/query/order")
public R queryOrderStatus(@RequestBody QueryOrderParam queryParams) {
if (Objects.isNull(queryParams)) {
@@ -137,65 +69,14 @@
* @description: 搴撲綅淇℃伅鏌ヨ
* @version 1.0
*/
- @PostMapping("/sync/locs/detls")
- @ApiOperation(value = "搴撲綅淇℃伅鏌ヨ", tags = "鏌ヨ")
+ @PostMapping("/query/locs/detls")
+ @ApiOperation(value = "搴撲綅淇℃伅鏌ヨ")
public R syncLocDetls(@RequestBody Map<String, Object> map) {
BaseParam baseParam = buildParam(map, BaseParam.class);
PageParam<Loc, BaseParam> pageParam = new PageParam<>(baseParam, Loc.class);
QueryWrapper<Loc> wrapper = pageParam.buildWrapper(true);
return receiveMsgService.syncLocsDetl(pageParam, wrapper);
}
-
- /**
- * @author Ryan
- * @date 2025/8/18
- * @description: 搴撲綅淇℃伅鍚屾
- * @version 1.0
- */
- @PostMapping("/sync/locs")
- @ApiOperation(value = "搴撲綅淇℃伅鍚屾", tags = "鍩虹淇℃伅鍚屾")
- public R syncLocs(@RequestBody List<SyncLocsParams> locs) {
- if (locs.isEmpty()) {
- throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
- }
- return receiveMsgService.syncLocs(locs);
- }
-
- /**
- * @author Ryan
- * @date 2025/8/18
- * @description: 鐗╂枡鍒嗙粍淇℃伅鍚屾
- * @version 1.0
- */
- @PostMapping("/sync/matGroups")
- @ApiOperation(value = "鐗╂枡鍒嗙粍淇℃伅鍚屾", tags = "鍩虹淇℃伅鍚屾")
- public R syncMatGroup(@RequestBody List<SyncMatGroupsParams> matGroupsParams) {
- if (matGroupsParams.isEmpty()) {
- throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
- }
- return receiveMsgService.syncMatGroups(matGroupsParams);
- }
-
- @ApiOperation(value = "搴撳尯鏁版嵁鍚屾", tags = "鍩虹淇℃伅鍚屾")
- @PostMapping("/sync/warehouse/areas")
- public R syncLocAreas(@RequestBody List<LocAreasParams> areasParams) {
- if (areasParams.isEmpty()) {
- throw new CoolException("搴撳尯鍙傛暟涓嶈兘涓虹┖锛侊紒");
- }
- return receiveMsgService.syncWarehouseAreas(areasParams);
- }
-
-
- @ApiOperation(value = "搴撳尯鏁版嵁鍚屾", tags = "鍩虹淇℃伅鍚屾")
- @PostMapping("/sync/warehouse")
- public R syncWarehouse(@RequestBody List<WarehouseParams> warehouseParams) {
- if (warehouseParams.isEmpty()) {
- throw new CoolException("搴撳尯鍙傛暟涓嶈兘涓虹┖锛侊紒");
- }
- return receiveMsgService.syncWarehouse(warehouseParams);
- }
-
-
}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/SyncOrderController.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/SyncOrderController.java
new file mode 100644
index 0000000..2644760
--- /dev/null
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/SyncOrderController.java
@@ -0,0 +1,82 @@
+package com.vincent.rsf.server.api.controller.erp;
+
+import com.vincent.rsf.framework.common.R;
+import com.vincent.rsf.server.api.controller.erp.params.OrderParams;
+import com.vincent.rsf.server.api.service.ReceiveMsgService;
+import com.vincent.rsf.server.common.utils.ExcelUtil;
+import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
+
+@RestController
+@RequestMapping("/order")
+@Api(tags = "鍗曟嵁鍚屾")
+public class SyncOrderController {
+
+ @Autowired
+ private ReceiveMsgService receiveMsgService;
+
+ /**
+ * @author Ryan
+ * @description 鎺ユ敹ERP鎺ㄩ�佺殑PO鍗曟嵁
+ * @throws
+ * @return
+ * @time 2025/3/4 13:57
+ */
+ @ApiOperation(value = "鎺ユ敹鍚屾ERP閲囪喘鍗�")
+ @PostMapping("/sync/purchase")
+ public R syncPurchases(@RequestBody List<OrderParams> orders) {
+ if (orders.isEmpty()) {
+ return R.error("鎺ㄩ�佽鍗曚笉鑳戒负绌猴紝璇锋鏌ユ牎楠屽悗鍐嶆搷浣滐紒锛�");
+ }
+ if (!receiveMsgService.syncPurchasee(orders)) {
+ return R.error("淇濆瓨澶辫触");
+ } else {
+ return R.ok("淇濆瓨鎴愬姛锛侊紒");
+ }
+ }
+
+ /**
+ * @author Ryan
+ * @date 2025/8/15
+ * @description: DO鍗曞悓姝�
+ * @version 1.0
+ */
+ @ApiOperation(value = "鍑哄簱閫氱煡鍗�(DO鍗曞悓姝�)")
+ @PostMapping("/sync/delivery")
+ public R syncDelivery(@RequestBody List<OrderParams> orders) {
+ if (!receiveMsgService.syncPurchasee(orders)) {
+ return R.error("淇濆瓨澶辫触");
+ } else {
+ return R.ok("淇濆瓨鎴愬姛锛侊紒");
+ }
+ }
+
+ /**
+ * @author Ryan
+ * @description 鍚屾璐ㄦ缁撴灉淇℃伅
+ * @param
+ * @return
+ * @time 2025/3/12 16:56
+ */
+ @ApiOperation(value = "璐ㄦ缁撴灉鍚屾")
+ @PostMapping("/sync/inspect")
+ public void syncQlyInspect(HttpServletRequest request, HttpServletResponse response) {
+ AsnOrderTemplate template = ExcelUtil.mockData(AsnOrderTemplate.class);
+ List<AsnOrderTemplate> list = new ArrayList<>();
+ list.add(template);
+ ExcelUtil.build(ExcelUtil.create(list, AsnOrderTemplate.class), response);
+ System.out.println(template);
+// return R.ok();
+ }
+}
--
Gitblit v1.9.1