|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.openApi.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
@@ -12,11 +13,11 @@ import org.jeecg.modules.openApi.service.SubcontractingOrderService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
-import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.net.HttpURLConnection;
|
|
|
+import java.util.Enumeration;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -30,7 +31,8 @@ import java.util.List;
|
|
|
@RestController
|
|
|
@RequestMapping("/openApi/subcontractingOrder")
|
|
|
public class SubcontractingOrderController extends JeecgController<SubcontractingOrder, SubcontractingOrderService> {
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private HttpServletRequest request;
|
|
|
@Autowired
|
|
|
private SubcontractingOrderService subcontractingOrderService;
|
|
|
|
|
@@ -41,20 +43,58 @@ public class SubcontractingOrderController extends JeecgController<Subcontractin
|
|
|
@ResponseBody
|
|
|
public ResponseEntity<ResHttpStatus> getSubcontractingOrderByCode(String code, String key) {
|
|
|
ResHttpStatus res = new ResHttpStatus();
|
|
|
+ res.setCode("0");
|
|
|
+ res.setSuccess(false);
|
|
|
if(!StringUtils.isNotBlank(code)){
|
|
|
- res.setCode("0");
|
|
|
res.setMsg("订单号不能为空");
|
|
|
- res.setSuccess(false);
|
|
|
+ return new ResponseEntity<>(res, HttpStatus.OK);
|
|
|
}
|
|
|
-
|
|
|
List<SubcontractingOrder> order =subcontractingOrderService.selectOrderByCode(code);//"SYW313-森宏"
|
|
|
+ if(order.size() <= 0){
|
|
|
+ res.setMsg("未查到有效数据");
|
|
|
+ return new ResponseEntity<>(res, HttpStatus.OK);
|
|
|
+ }
|
|
|
res.setCode("200");
|
|
|
res.setMsg("成功");
|
|
|
res.setSuccess(true);
|
|
|
res.setData(order);
|
|
|
|
|
|
- return new ResponseEntity<ResHttpStatus>(res, HttpStatus.OK);
|
|
|
+ return new ResponseEntity<>(res, HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 合格入库单-验布机
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/saveWarehousing",method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public ResponseEntity<ResHttpStatus> saveWarehousing(@RequestBody JSONArray json) {
|
|
|
+ ResHttpStatus res = new ResHttpStatus();
|
|
|
+ res.setCode("0");
|
|
|
+ res.setSuccess(false);
|
|
|
+
|
|
|
+ String key = request.getHeader("key");
|
|
|
+ if(!StringUtils.isNotBlank(key)){
|
|
|
+ res.setMsg("key不能为空");
|
|
|
+ return new ResponseEntity<>(res, HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(json.size() < 1){
|
|
|
+ res.setMsg("正文数据不能为空");
|
|
|
+ return new ResponseEntity<>(res, HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ subcontractingOrderService.saveWarehousing(json);
|
|
|
+ res.setCode("200");
|
|
|
+ res.setSuccess(true);
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ res.setMsg(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return new ResponseEntity<>(res, HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|