| | |
| | | |
| | | 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(); |
| | | } |
| | | } |