|
|
@@ -131,8 +131,11 @@ public class ApiController {
|
|
|
@RequestMapping(value = "/contract/push")
|
|
|
public Object pushContract(@RequestBody ContractVo vo) throws Exception {
|
|
|
String token = vo.getToken();
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("code", 0);
|
|
|
if (!TOKEN.equals(token)) {
|
|
|
- return new ResponseEntity<>("no auth", HttpStatus.OK);
|
|
|
+ result.put("message", "no auth");
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
}
|
|
|
Connection connection = null;
|
|
|
try {
|
|
|
@@ -140,13 +143,15 @@ public class ApiController {
|
|
|
if (StringUtil.isEmpty(vo.getPurchaseId())) {
|
|
|
|
|
|
if (StringUtil.isEmpty(vo.getPurchaseNo())) {
|
|
|
- throw new BizException("采购编号purchaseNo无效");
|
|
|
+ result.put("message", "采购编号purchaseNo无效");
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
}
|
|
|
Purchase purchase = new Purchase();
|
|
|
purchase.setPurchaseNo(vo.getPurchaseNo());
|
|
|
purchase = jdbcClient.getJdbcModel(purchase, connection);
|
|
|
if (StringUtil.isEmpty(purchase.getId())) {
|
|
|
- throw new BizException("采购编号purchaseNo无效");
|
|
|
+ result.put("message", "采购编号purchaseNo无效");
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
}
|
|
|
vo.setPurchaseId(purchase.getId());
|
|
|
}
|
|
|
@@ -165,7 +170,8 @@ public class ApiController {
|
|
|
supplier.setSupplierName(vo.getSupplierName());
|
|
|
supplier = jdbcClient.getJdbcModel(supplier, connection);
|
|
|
if (StringUtil.isEmpty(supplier.getId())) {
|
|
|
- throw new BizException("供应商名称无效");
|
|
|
+ result.put("message", "供应商名称无效");
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
}
|
|
|
vo.setSupplierId(supplier.getId());
|
|
|
vo.setSupplierName(supplier.getSupplierName());
|
|
|
@@ -185,9 +191,12 @@ public class ApiController {
|
|
|
contract.setSupplierNo(vo.getSupplierNo());
|
|
|
jdbcClient.jdbcInsert(contract, connection);
|
|
|
|
|
|
- return new ResponseEntity<>(contract, HttpStatus.OK);
|
|
|
+ result.put("message", "success");
|
|
|
+ result.put("code", 1);
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
} catch (Exception e) {
|
|
|
- throw new BizException(e.getMessage());
|
|
|
+ result.put("message", "fail" + e.getMessage());
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
} finally {
|
|
|
jdbcClient.finallyExecute(connection);
|
|
|
}
|