| | |
| | | insProducts = insSampleMapper.getInsProduct3(id); |
| | | break; |
| | | } |
| | | // 数采新增 |
| | | getDeviceMessage(insProducts, request); |
| | | |
| | | Set<Integer> set = new HashSet<>(); |
| | | Map<Integer, String> map2 = new HashMap<>(); |
| | | if (BeanUtil.isEmpty(insProducts)) return null; |
| | | getTemplateThing(set, map2, insProducts); |
| | | return insProducts; |
| | | } |
| | | |
| | | private List<InsProduct> getDeviceMessage(List<InsProduct> insProducts, HttpServletRequest request) { |
| | | String ipAddress = request.getRemoteAddr(); |
| | | // 防止回环地址变为IPv6 |
| | | String ip = ipAddress.equals("0:0:0:0:0:0:0:1") ? "127.0.0.1" : ipAddress; |
| | | insProducts.forEach(i -> { |
| | | Map<String, Object> devices = baseMapper.getDeviceMessage(ip, i.getInspectionItem(), i.getInspectionItemSubclass(), i.getSampleType()); |
| | | if (ObjectUtils.isNotEmpty(devices) && ObjectUtils.isNotEmpty(devices.get("file_type")) && ObjectUtils.isNotEmpty(devices.get("collect_url"))) { |
| | | InsProductResult insProductResult = i.getInsProductResult(); |
| | | if (ObjectUtils.isEmpty(insProductResult)) { |
| | | insProductResult = new InsProductResult(); |
| | | } |
| | | List<Object> list = new ArrayList<>(); |
| | | Map<Object, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("v", devices.get("device_name")); |
| | | list.add(hashMap); |
| | | insProductResult.setEquipName(JSON.toJSON(list).toString()); |
| | | List<Object> listValue = new ArrayList<>(); |
| | | Map<Object, Object> hashMapValue = new HashMap<>(); |
| | | hashMapValue.put("v", devices.get("management_number")); |
| | | listValue.add(hashMapValue); |
| | | insProductResult.setEquipName(JSON.toJSON(list).toString()); |
| | | insProductResult.setEquipValue(JSON.toJSON(listValue).toString()); |
| | | i.setInsProductResult(insProductResult); |
| | | } |
| | | }); |
| | | return insProducts; |
| | | } |
| | | |