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("上报交货日期失败!");
|
}
|
}
|
}
|