| | |
| | | @Autowired |
| | | ISysConfigService configService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('sy:syCar:getSDKCarPositionByRight')") |
| | | @PreAuthorize("@ss.hasPermi('sy:syCar:getEquipmentList')") |
| | | @ApiOperation("获取设备列表") |
| | | @GetMapping("getEquipmentList") |
| | | public Results getEquipmentList(){ |
| | | String url = configService.getHealth(); |
| | | JSONObject j = new JSONObject(); |
| | | |
| | | Map<String, Object> map = new HashMap(); |
| | | String result = ARDSoapUtil.postSoapResult(url, "GetEquipmentList", map); |
| | | if ("".equals(result)) { |
| | | //返回结果为空 |
| | | return Results.error("查询失败!"); |
| | | return Results.error("没有设备信息"); |
| | | } |
| | | Map<String, Object> mapResult = (Map<String, Object>) JSON.parse((String) result); |
| | | if ((int) mapResult.get("code") == 200) { |
| | |
| | | for (int i = 0; i < listResult.size(); i++) { |
| | | Map<String, Object> mapTemp = listResult.get(i); |
| | | int id = (Integer) mapTemp.get("id"); //主键id |
| | | String equipKey = (String) mapTemp.get("EquipKey"); //设备Key |
| | | String equipNumber = (String) mapTemp.get("EquipNumber"); //设备编号 |
| | | String equipName = (String) mapTemp.get("EquipName"); //设备名称 |
| | | String equipLevel = (String) mapTemp.get("EquipLevel"); //设备报警等级 0正常 1注意 2严重 |
| | | String measureDate = (String) mapTemp.get("MeasureDate"); //最近一次测量时间 |
| | | j.put(id + "", mapTemp); |
| | | } |
| | | } else { |
| | |
| | | } |
| | | return Results.succeed(j); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('sy:syCar:getMeasureByEquipName')") |
| | | @ApiOperation("获取某个油井测点列表") |
| | | @GetMapping("getMeasureByEquipName") |
| | | public Results getMeasureByEquipName(String equipNumber){ |
| | | String url = configService.getHealth(); |
| | | JSONObject j = new JSONObject(); |
| | | Map<String, Object> map = new HashMap(); |
| | | String result = ARDSoapUtil.postSoapResult(url, "GetEquipmentList", map); |
| | | String equipKey = ""; |
| | | if ("".equals(result)) { |
| | | //返回结果为空 |
| | | return Results.error("没有设备信息"); |
| | | } |
| | | Map<String, Object> mapResult = (Map<String, Object>) JSON.parse((String) result); |
| | | if ((int) mapResult.get("code") == 200) { |
| | | j.put("code", mapResult.get("code")); |
| | | List<Map<String, Object>> listResult = (List<Map<String, Object>>) JSON.parse((String) mapResult.get("resdata")); |
| | | for (int i = 0; i < listResult.size(); i++) { |
| | | Map<String, Object> mapTemp = listResult.get(i); |
| | | String equipNumberTemp = (String) mapTemp.get("EquipNumber"); //设备名称 |
| | | if (equipNumberTemp.equals(equipNumber)) { |
| | | //名称匹配,即为要获取的设备; |
| | | equipKey = (String) mapTemp.get("EquipKey"); //设备Key |
| | | } |
| | | } |
| | | if ("".equals(equipKey)) { |
| | | return Results.error("没有测点信息"); |
| | | } |
| | | //获取设备的测点列表 |
| | | Map<String, Object> hashMap = new HashMap<String, Object>(); |
| | | hashMap.put("EquipKey", equipKey); |
| | | String eResult = ARDSoapUtil.postSoapResult(url, "GetMeasureByEquipKey", hashMap); |
| | | if ("".equals(eResult)) { |
| | | //返回结果为空 |
| | | return Results.error("没有测点信息"); |
| | | } |
| | | Map<String, Object> map1 = (Map<String, Object>) JSON.parse((String) eResult); |
| | | if ((int) map1.get("code") == 200) { |
| | | j.put("code", map1.get("code")); |
| | | List<Map<String, Object>> list = (List<Map<String, Object>>) JSON.parse((String) map1.get("resdata")); |
| | | j.put("listResult", list); |
| | | } else { |
| | | //错误提示 |
| | | j.put("errmsg", mapResult.get("errmsg")); |
| | | j.put("code", mapResult.get("code")); |
| | | } |
| | | } else { |
| | | //错误提示 |
| | | j.put("errmsg", mapResult.get("errmsg")); |
| | | j.put("code", mapResult.get("code")); |
| | | } |
| | | return Results.succeed(j); |
| | | } |
| | | |
| | | } |