| | |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | * 查询采购订单未检验 |
| | | */ |
| | | public List<Map<String, Object>> getInventory(String inAttr) { |
| | | String procedureName = "QUERY_POL_RECEIPT_STD"; |
| | | JSONObject stockMap = getJsonObject(procedureName, inAttr); |
| | | String body = HttpRequest.post(ifsProperties.getCustorderPort()).form(stockMap).execute().body(); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | Map map = objectMapper.readValue(body, Map.class); |
| | | List<Map<String, Object>> maps = objectMapper.readValue(JSONUtil.toJsonStr(map.get("LIST_INFO")), new TypeReference<List<Map<String, Object>>>() { |
| | | }); |
| | | log.info("获取采购订单-->>" + maps); |
| | | return maps; |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e); |
| | | } |
| | | log.info("IFS调用已禁用 - getInventory"); |
| | | return new ArrayList<>(); |
| | | // String procedureName = "QUERY_POL_RECEIPT_STD"; |
| | | // JSONObject stockMap = getJsonObject(procedureName, inAttr); |
| | | // String body = HttpRequest.post(ifsProperties.getCustorderPort()).form(stockMap).execute().body(); |
| | | // ObjectMapper objectMapper = new ObjectMapper(); |
| | | // try { |
| | | // Map map = objectMapper.readValue(body, Map.class); |
| | | // List<Map<String, Object>> maps = objectMapper.readValue(JSONUtil.toJsonStr(map.get("LIST_INFO")), new TypeReference<List<Map<String, Object>>>() { |
| | | // }); |
| | | // log.info("获取采购订单-->>" + maps); |
| | | // return maps; |
| | | // } catch (JsonProcessingException e) { |
| | | // e.printStackTrace(); |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | private Result<?> getResult(String procedureName, String inAttr, String url, String image) { |
| | | JSONObject stockMap = new JSONObject(); |
| | | stockMap.put("procedureName", procedureName); |
| | | stockMap.put("contract", ifsProperties.getContract()); |
| | | stockMap.put("contractKey", ifsProperties.getContractKeyPost()); |
| | | stockMap.put("userId", "lims_user"); |
| | | stockMap.put("inAttr", inAttr); |
| | | String body = HttpRequest.post(url).form(stockMap).execute().body(); |
| | | log.info(image + body); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | Map map = objectMapper.readValue(body, Map.class); |
| | | String successFlag = map.get("SuccessFlag").toString(); |
| | | if (Integer.valueOf(successFlag) == 1) { |
| | | return Result.success(map); |
| | | } else { |
| | | return Result.fail(map.get("ErrorMsg").toString()); |
| | | } |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | return Result.fail(e.getMessage()); |
| | | } |
| | | log.info("IFS调用已禁用 - getResult: {}", procedureName); |
| | | return Result.success(); |
| | | // JSONObject stockMap = new JSONObject(); |
| | | // stockMap.put("procedureName", procedureName); |
| | | // stockMap.put("contract", ifsProperties.getContract()); |
| | | // stockMap.put("contractKey", ifsProperties.getContractKeyPost()); |
| | | // stockMap.put("userId", "lims_user"); |
| | | // stockMap.put("inAttr", inAttr); |
| | | // String body = HttpRequest.post(url).form(stockMap).execute().body(); |
| | | // log.info(image + body); |
| | | // ObjectMapper objectMapper = new ObjectMapper(); |
| | | // try { |
| | | // Map map = objectMapper.readValue(body, Map.class); |
| | | // String successFlag = map.get("SuccessFlag").toString(); |
| | | // if (Integer.valueOf(successFlag) == 1) { |
| | | // return Result.success(map); |
| | | // } else { |
| | | // return Result.fail(map.get("ErrorMsg").toString()); |
| | | // } |
| | | // } catch (JsonProcessingException e) { |
| | | // e.printStackTrace(); |
| | | // return Result.fail(e.getMessage()); |
| | | // } |
| | | } |
| | | |
| | | /** |