| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.health.param.GetFMTrendParam; |
| | | import com.ruoyi.health.param.GetTrendParam; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.utils.result.Results; |
| | | import com.ruoyi.utils.soap.ARDSoapUtil; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | String result = ARDSoapUtil.postSoapResult(url, "GetEquipmentList", map); |
| | | if ("".equals(result)) { |
| | | //è¿åç»æä¸ºç©º |
| | | return Results.error("没æè®¾å¤ä¿¡æ¯"); |
| | | return Results.succeed("没æè®¾å¤ä¿¡æ¯"); |
| | | } |
| | | 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 { |
| | |
| | | String equipKey = ""; |
| | | if ("".equals(result)) { |
| | | //è¿åç»æä¸ºç©º |
| | | return Results.error("没æè®¾å¤ä¿¡æ¯"); |
| | | return Results.succeed("没æè®¾å¤ä¿¡æ¯"); |
| | | } |
| | | Map<String, Object> mapResult = (Map<String, Object>) JSON.parse((String) result); |
| | | if ((int) mapResult.get("code") == 200) { |
| | |
| | | } |
| | | } |
| | | if ("".equals(equipKey)) { |
| | | return Results.error("æ²¡ææµç¹ä¿¡æ¯"); |
| | | return Results.succeed("æ²¡ææµç¹ä¿¡æ¯"); |
| | | } |
| | | //è·å设å¤çæµç¹å表 |
| | | Map<String, Object> hashMap = new HashMap<String, Object>(); |
| | |
| | | String eResult = ARDSoapUtil.postSoapResult(url, "GetMeasureByEquipKey", hashMap); |
| | | if ("".equals(eResult)) { |
| | | //è¿åç»æä¸ºç©º |
| | | return Results.error("æ²¡ææµç¹ä¿¡æ¯"); |
| | | return Results.succeed("æ²¡ææµç¹ä¿¡æ¯"); |
| | | } |
| | | 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")); |
| | | // for (int i = 0; i < listResult.size(); i++) { |
| | | // Map<String, Object> mapTemp = listResult.get(i); |
| | | // int id = (Integer) mapTemp.get("id"); //主é®id |
| | | // String measureKey = (String) mapTemp.get("MeasureKey"); //æµç¹key |
| | | // String measureNumber = (String) mapTemp.get("MeasureNumber"); //æµç¹ç¼å· |
| | | // String measureName = (String) mapTemp.get("MeasureName"); //æµç¹åç§° |
| | | // String measureLevel = (String) mapTemp.get("MeasureLevel"); //æµç¹æ¥è¦ç级 0æ£å¸¸ 1注æ 2严é |
| | | // String sensorType = (String) mapTemp.get("SensorType"); //ä¼ æå¨ç±»å |
| | | // String betry = (String) mapTemp.get("BETRY");//çµé |
| | | // } |
| | | j.put("listResult", list); |
| | | } else { |
| | | //é误æç¤º |
| | |
| | | return Results.succeed(j); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('sy:syCar:getTrend')") |
| | | @ApiOperation("è·åææ²¹äºä¸æ®µæ¶é´çæµéè¶å¿") |
| | | @GetMapping("getTrend") |
| | | public Results getTrend(GetTrendParam getTrendParam){ |
| | | String url = configService.getHealth(); |
| | | Map<String , Object> map = new HashMap<String , Object>(); |
| | | map.put("MeasureKey", getTrendParam.getMeasureKey()); |
| | | map.put("StartTime", getTrendParam.getStartTime()); |
| | | map.put("EndTime", getTrendParam.getEndTime()); |
| | | JSONObject j = new JSONObject(); |
| | | String result = ARDSoapUtil.postSoapResult(url ,"GetTrend" , map); |
| | | if ("".equals(result)){ |
| | | return Results.succeed("æ²¡ææµç¹ä¿¡æ¯"); |
| | | } |
| | | 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); |
| | | int id = (Integer)mapTemp.get("id"); //主é®id |
| | | BigDecimal value = (BigDecimal)mapTemp.get("Value"); //æ°å¼ |
| | | String measureStr = (String)mapTemp.get("MeasureDate"); //æµéæ¶é´ |
| | | measureStr = measureStr.substring(measureStr.indexOf("(")+1, measureStr.indexOf(")",2)); |
| | | SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String measureDate = f.format(Long.valueOf(measureStr)); |
| | | mapTemp.put("MeasureDate", measureDate); |
| | | j.put(id +"" , mapTemp); |
| | | } |
| | | }else{ |
| | | //é误æç¤º |
| | | j.put("errmsg", mapResult.get("errmsg")); |
| | | j.put("code", mapResult.get("code")); |
| | | } |
| | | return Results.succeed(j); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('sy:syCar:getWaveDataByIndex')") |
| | | @ApiOperation("è·åææ¬¡æµéæ°æ®çå¾è°±") |
| | | @GetMapping("getWaveDataByIndex") |
| | | public Results getWaveDataByIndex(String id){ |
| | | String url = configService.getHealth(); |
| | | Map<String , Object> map = new HashMap<String , Object>(); |
| | | map.put("id", id); |
| | | JSONObject j = new JSONObject(); |
| | | String result = ARDSoapUtil.postSoapResult(url ,"GetWaveDataByIndex" , map); |
| | | if ("".equals(result)){ |
| | | return Results.succeed("æ²¡ææµç¹ä¿¡æ¯"); |
| | | } |
| | | 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")); |
| | | int frequency = (Integer) listResult.get(0).get("Frequency"); //é¢å®½ |
| | | int lines = (Integer) listResult.get(0).get("Lines");//çº¿æ° |
| | | int measureCycle = (Integer) listResult.get(0).get("MeasureCycle");//éæ ·æ¶é´ |
| | | List waveDataImage = (List) listResult.get(0).get("WaveDataImage");//æ¶åå¾è°± |
| | | List FrequencyDataImage = (List) listResult.get(0).get("FrequencyDataImage"); //é¢åå¾è°± |
| | | j.put("frequency", frequency); |
| | | j.put("lines", lines); |
| | | j.put("measureCycle", measureCycle); |
| | | j.put("waveDataImage", waveDataImage); |
| | | j.put("FrequencyDataImage", FrequencyDataImage); |
| | | } else { |
| | | //é误æç¤º |
| | | j.put("errmsg", mapResult.get("errmsg")); |
| | | j.put("code", mapResult.get("code")); |
| | | } |
| | | return Results.succeed(j); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('sy:syCar:getAlertInfo')") |
| | | @ApiOperation("è·åæä¸ªæµç¹çæå䏿¬¡æ¥è¦ä¿¡æ¯") |
| | | @GetMapping("getAlertInfo") |
| | | public Results getAlertInfo(String number){ |
| | | String url = configService.getHealth(); |
| | | Map<String , Object> map = new HashMap<String , Object>(); |
| | | map.put("WellNumber", number); |
| | | JSONObject j = new JSONObject(); |
| | | String result = ARDSoapUtil.postSoapResult(url ,"GetWellAlertInfo" , map); |
| | | if ("".equals(result)){ |
| | | return Results.succeed("æ²¡ææµç¹ä¿¡æ¯"); |
| | | } |
| | | 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")); |
| | | j.put("listResult", listResult); |
| | | for (int i = 0; i < listResult.size(); i++) { |
| | | Map<String, Object> mapTemp = listResult.get(i); |
| | | int id = (Integer) mapTemp.get("id"); //主é®id |
| | | String position = (String) mapTemp.get("position"); //å¼å¸¸é¨ä½ |
| | | String problem = (String) mapTemp.get("problem"); //å¼å¸¸é®é¢(å¤±ææ¨¡å¼) |
| | | String suggestion = (String) mapTemp.get("suggestion"); //æ¹å建议 |
| | | } |
| | | } else { |
| | | //é误æç¤º |
| | | j.put("errmsg", mapResult.get("errmsg")); |
| | | j.put("code", mapResult.get("code")); |
| | | } |
| | | return Results.succeed(j); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('sy:syCar:getFMTrend')") |
| | | @ApiOperation("è·åæå¼å¸¸é®é¢(å¤±ææ¨¡å¼)çè¶å¿") |
| | | @GetMapping("getFMTrend") |
| | | public Results getFMTrend(GetFMTrendParam getFMTrendParam){ |
| | | String url = configService.getHealth(); |
| | | Map<String , Object> map = new HashMap<String , Object>(); |
| | | map.put("id", getFMTrendParam.getId()); |
| | | map.put("StartTime", getFMTrendParam.getStartTime()); |
| | | map.put("EndTime", getFMTrendParam.getEndTime()); |
| | | JSONObject j = new JSONObject(); |
| | | String result = ARDSoapUtil.postSoapResult(url ,"GetFMTrend" , map); |
| | | if ("".equals(result)){ |
| | | return Results.succeed("æ²¡ææµç¹ä¿¡æ¯"); |
| | | } |
| | | 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")); |
| | | j.put("listResult", listResult); |
| | | for (int i = 0; i < listResult.size(); i++) { |
| | | Map<String, Object> mapTemp = listResult.get(i); |
| | | int id = (Integer) mapTemp.get("id"); //主é®id |
| | | String value = (String) mapTemp.get("Value"); //æ°å¼ |
| | | String measureStr = (String) mapTemp.get("MeasureDate"); //æµéæ¶é´ |
| | | } |
| | | } else { |
| | | //é误æç¤º |
| | | j.put("errmsg", mapResult.get("errmsg")); |
| | | j.put("code", mapResult.get("code")); |
| | | } |
| | | return Results.succeed(j); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('sy:syCar:getMeasureByEquipKey')") |
| | | @ApiOperation("è·åæä¸ªæ²¹äºæµç¹å表") |
| | | @GetMapping("getMeasureByEquipKey") |
| | | public Results getMeasureByEquipKey(GetFMTrendParam getFMTrendParam){ |
| | | String url = configService.getHealth(); |
| | | |
| | | return Results.succeed(); |
| | | } |
| | | } |