| | |
| | | } |
| | | // 如果存在存储地址,则移动地址 |
| | | if (ObjectUtils.isNotEmpty(device.getStorageUrl())) { |
| | | String s = HTTP + ip + MOVEFILE + "?startFilePath=" + device.getCollectUrl() + "&endFilePath=" + device.getStorageUrl(); |
| | | String s = HTTP + ip + MOVEFILE + "?startFilePath=" + device.getCollectUrl() + "&endFilePath=" + device.getStorageUrl() + "&fileType=" + device.getFileType(); |
| | | String storageUrlResult = HttpUtil.get(s); |
| | | JSONObject storageUrlResultJson = JSON.parseObject(storageUrlResult); |
| | | if (Objects.equals(storageUrlResultJson.get("code"), 1)) { |
| | | if (Objects.equals(storageUrlResultJson.get("code"), 0)) { |
| | | if (ObjectUtils.isEmpty(storageUrlResultJson.get("msg"))) { |
| | | throw new ErrorException("存储地址错误,可能文件路径配置错误!"); |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } |
| | | String frequency = createFrequency(entrustCode, sampleCode); |
| | | map.put("frequency", frequency); |
| | | return map; |
| | | } |
| | | } |
| | | |
| | | private static String createFrequency(String entrustCode, String sampleCode) { |
| | | public static String createFrequency(String entrustCode, String sampleCode) { |
| | | String key = frequency + ":" + entrustCode + ":" + sampleCode; |
| | | boolean b = RedisUtil.hasKey(key); |
| | | String frequencyValue; |
| | |
| | | JSONObject jsonObject1 = JSON.parseObject(dataList.get(y).toString()); |
| | | Object o = jsonObject1.get(key); |
| | | if (ObjectUtils.isNotEmpty(o)) { |
| | | // 小数点进三位 |
| | | double v1 = 0; |
| | | try { |
| | | v1 = Double.parseDouble(o.toString()); |
| | | double v2 = v1 / 1000; |
| | | list.add(v2); |
| | | } catch (NumberFormatException e) { |
| | | list.add(o); |
| | | } |
| | | |
| | | } |
| | | } |
| | | // 进行公式计算 |
| | | String resultValue = calculationFormula(list, v.get(0), k); |