skyouc
2025-03-11 b3b117424d3405190cf482f9236a40295ef2a447
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.vincent.rsf.server.api.controller;
 
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.server.api.controller.params.Order;
import com.vincent.rsf.server.api.service.ErpApiService;
import com.vincent.rsf.server.system.controller.BaseController;
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;
 
/**
 * @author Ryan
 * @version 1.0
 * @title ErpApiController
 * @description
 * @create 2025/3/4 13:19
 */
@RestController
@RequestMapping("/erp")
@Api(tags = "ERP接口对接")
public class ErpApiController extends BaseController {
 
    @Autowired
    private ErpApiService erpApiService;
 
    /**
     * @author Ryan
     * @description 接收ERP推送的PO单据
     * @throws
     * @return
     * @time 2025/3/4 13:57
     */
    @ApiOperation(value = "接收同步ERP采购单")
    @PostMapping("/sync/purchase")
    public R syncPurchases(@RequestBody List<Order> orders) {
        if (orders.isEmpty()) {
            return R.error("推送订单不能为空,请检查校验后再操作!!");
        }
        if (!erpApiService.syncPurchasee(orders)) {
            return R.error("保存失败");
        } else {
            return R.ok("保存成功!!");
        }
    }
 
}