4
hao
2025-04-16 c5fb1fbcbb2bf4d511773d348f9ef625855c61fc
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package com.web.supplier.controller;
 
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.app.base.control.WebController;
import com.app.base.data.ApiResponseResult;
import com.utils.UserUtil;
import com.web.supplier.service.OperateService;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
 
@Api(description = "操作")
@RestController
@RequestMapping(value = "/operate")
public class OperateController extends WebController {
 
    @Autowired
    private OperateService operateService;
 
    @ApiOperation(value = "获取交货订单信息", notes = "获取交货订单信息")
    @RequestMapping(value = "/getSupplyInfo", method = RequestMethod.POST)
    public ApiResponseResult getSupplyInfo() {
        try {
            String furl = "http://192.168.1.243:8988/api/DeliveryReply/DeliveryReplyQueryList";
 
            Map<String, Object> map = new HashMap<String, Object>();
            map.put("SUPPLIERID", 0);
            map.put("SUPPLIERFNUMBER", UserUtil.getSessionUser().getFcode());
            map.put("Status", "未回复");
 
            JSONObject json = JSON.parseObject(JSON.toJSONString(map));
            return operateService.doApiData(furl, json);
        } catch (Exception e) {
            System.out.println(e.toString());
            return ApiResponseResult.failure("获取交货订单信息失败!");
        }
    }
 
    @ApiOperation(value = "查询交货订单信息-历史", notes = "获取交货订单信息-历史")
    @RequestMapping(value = "/getSupplyInfoHistory", method = RequestMethod.POST)
    public ApiResponseResult getSupplyInfoHistory(@RequestBody Map<String, Object> params) {
        try {
            String furl = "http://192.168.1.243:8988/api/DeliveryReply/DeliveryReplyQueryList";
 
            String StarDate = params.get("StarDate") == null ? "" : params.get("StarDate").toString();// 答复时间
            String EndDate = params.get("EndDate") == null ? "" : params.get("EndDate").toString();
            String Status = params.get("Status") == null ? "" : params.get("Status").toString();
            int page = params.get("page") == null ? 1 : (int) params.get("page");
            int rows = params.get("rows") == null ? 20 : (int) params.get("rows");
 
            Map<String, Object> map = new HashMap<String, Object>();
            map.put("SUPPLIERID", 0);
            map.put("SUPPLIERFNUMBER", UserUtil.getSessionUser().getFcode());
            int StartRow = (page - 1) * rows;
            map.put("StartRow", StartRow);// 索引=页码*最大行数
            map.put("Limit", rows);// 最大行数
            map.put("StarDate", StarDate);
            map.put("EndDate", EndDate);
            map.put("Status", Status);
 
            JSONObject json = JSON.parseObject(JSON.toJSONString(map));
            return operateService.doApiData(furl, json);
        } catch (Exception e) {
            System.out.println(e.toString());
            return ApiResponseResult.failure("获取交货订单信息失败!");
        }
    }
 
    @ApiOperation(value = "上报交货日期", notes = "上报交货日期")
    @RequestMapping(value = "/setSupplyDate", method = RequestMethod.POST)
    public ApiResponseResult setSupplyDate(@RequestBody Map<String, Object> params) {
        try {
            String furl = "http://192.168.1.243:8988/api/DeliveryReply/WriteDeliveryReply";
 
            String FID = params.get("FID").toString();
            String FEntryID = params.get("FEntryID").toString();
            String F_SUPPLIERDATE_SUB = params.get("F_SUPPLIERDATE_SUB").toString();
 
            Map<String, Object> map = new HashMap<String, Object>();
            Map<String, Object> map_child = new HashMap<String, Object>();
 
            map.put("FID", FID);
            map_child.put("FEntryID", FEntryID);
            map_child.put("F_SUPPLIERDATE_SUB", F_SUPPLIERDATE_SUB);
 
            List<Object> list_child = new ArrayList<>();
            list_child.add(map_child);
            JSONArray child_json = JSON.parseArray(JSON.toJSONString(list_child));// 数组
            map.put("FEntity", child_json);
 
            JSONArray json = JSON.parseArray("[" + JSON.toJSONString(map) + "]");// 数组
            // System.out.println(json);
            return operateService.setApiData(furl, json);
        } catch (Exception e) {
            System.out.println(e.toString());
            return ApiResponseResult.failure("上报交货日期失败!");
        }
    }
}