|
@@ -60,7 +60,7 @@ public class CamelRestConfiguration extends RouteBuilder {
|
60
|
60
|
return string;
|
61
|
61
|
}
|
62
|
62
|
|
63
|
|
- public static String getDate() {
|
|
63
|
+ public String getDate() {
|
64
|
64
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
|
65
|
65
|
String date = df.format(new java.util.Date());// new Date()为获取当前系统时间
|
66
|
66
|
return date;
|
|
@@ -81,7 +81,7 @@ public class CamelRestConfiguration extends RouteBuilder {
|
81
|
81
|
String totalPower = "/upData/总有功功率";
|
82
|
82
|
String casePress = "/upData/套压";
|
83
|
83
|
String oilPress = "/upData/油压";
|
84
|
|
-
|
|
84
|
+ System.out.println("开始 :wellId: " + wellId +"wellName:" + wellName + "date"+ date + "sysdate" + new Date());
|
85
|
85
|
map.put("ACurrent", Double.valueOf("".equals(getParams(wellId + ACurrent)) ? "0" : getParams(wellId + ACurrent)));
|
86
|
86
|
map.put("BCurrent", Double.valueOf("".equals(getParams(wellId + BCurrent)) ? "0" : getParams(wellId + BCurrent)));
|
87
|
87
|
map.put("CCurrent", Double.valueOf("".equals(getParams(wellId + CCurrent)) ? "0" : getParams(wellId + CCurrent)));
|
|
@@ -92,6 +92,7 @@ public class CamelRestConfiguration extends RouteBuilder {
|
92
|
92
|
map.put("totalPower", Double.valueOf("".equals(getParams(wellId + totalPower)) ? "0" : getParams(wellId + totalPower)));
|
93
|
93
|
map.put("casePress", Double.valueOf("".equals(getParams(wellId + casePress)) ? "0" : getParams(wellId + casePress)));
|
94
|
94
|
map.put("oilPress", Double.valueOf("".equals(getParams(wellId + oilPress)) ? "0" : getParams(wellId + oilPress)));
|
|
95
|
+ System.out.println("over");
|
95
|
96
|
insertCurrentTimeParams(map, wellName,date);
|
96
|
97
|
|
97
|
98
|
|
|
@@ -306,8 +307,8 @@ public class CamelRestConfiguration extends RouteBuilder {
|
306
|
307
|
long time2 = yunpingtai.getTime();
|
307
|
308
|
Date date = new Date();
|
308
|
309
|
long time3 = date.getTime();
|
309
|
|
- int hours1 = (int) ((time3 - time2) / (1000 * 60 * 60));
|
310
|
|
- int hours = (int) ((time2 - time1) / (1000 * 60 * 60));
|
|
310
|
+ int hours1 = Math.abs((int) ((time3 - time2) / (1000 * 60 * 60)));
|
|
311
|
+ int hours = Math.abs((int) ((time2 - time1) / (1000 * 60 * 60)));
|
311
|
312
|
//云平台和采集时间相差要小于4小时
|
312
|
313
|
if (hours < 4 && !"".equals(gtsj) && hours1 < 4) {
|
313
|
314
|
z.setZd_init_sgt(gtsj);//位移载荷点
|
|
@@ -324,24 +325,24 @@ public class CamelRestConfiguration extends RouteBuilder {
|
324
|
325
|
} else {
|
325
|
326
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
|
326
|
327
|
String dateNow = df.format(new java.util.Date());
|
327
|
|
-
|
328
|
|
- z.setZd_init_sgt(gtsj);//位移载荷点
|
|
328
|
+ ZDJG_WELL well = new ZDJG_WELL();
|
|
329
|
+ well.setZd_init_sgt(gtsj);//位移载荷点
|
329
|
330
|
//
|
330
|
331
|
if (jsonObject.getString("strokeFrequency") != null) {
|
331
|
|
- z.setStroke(CALUtil.round((Double.valueOf(jsonObject.getString("stroke"))) * 100) / 100);//冲程,但GTSB_2的冲程是CC字段
|
|
332
|
+ well.setStroke(CALUtil.round((Double.valueOf(jsonObject.getString("stroke"))) * 100) / 100);//冲程,但GTSB_2的冲程是CC字段
|
332
|
333
|
}
|
333
|
334
|
if (jsonObject.getString("stroke") != null) {
|
334
|
|
- z.setFrequence(CALUtil.round((Double.valueOf(jsonObject.getString("strokeFrequency"))) * 100) / 100);//冲次,但GTSB_2的冲次是PJXC字段
|
|
335
|
+ well.setFrequence(CALUtil.round((Double.valueOf(jsonObject.getString("strokeFrequency"))) * 100) / 100);//冲次,但GTSB_2的冲次是PJXC字段
|
335
|
336
|
}
|
336
|
|
- z.setProd_date(dateNow);
|
337
|
|
- z.setBz(rtutime);
|
338
|
|
- z.setSxzh(Double.parseDouble(jsonObject.getString("maxLoad")));//最大载荷
|
339
|
|
- z.setXxzh(Double.parseDouble(jsonObject.getString("minLoad")));//最小载荷
|
340
|
|
- z.setWell_common_name(well_id);
|
341
|
|
-
|
342
|
|
- z.setErrorInfo("采集时间错误");
|
343
|
|
- if (accessWellMap.get(z.getWell_common_name()) != null)
|
344
|
|
- insertData(z);
|
|
337
|
+ well.setProd_date(dateNow);
|
|
338
|
+ well.setBz(rtutime);
|
|
339
|
+ well.setSxzh(Double.parseDouble(jsonObject.getString("maxLoad")));//最大载荷
|
|
340
|
+ well.setXxzh(Double.parseDouble(jsonObject.getString("minLoad")));//最小载荷
|
|
341
|
+ well.setWell_common_name(well_id);
|
|
342
|
+
|
|
343
|
+ well.setErrorInfo("采集时间错误");
|
|
344
|
+ if (accessWellMap.get(well.getWell_common_name()) != null)
|
|
345
|
+ insertData(well);
|
345
|
346
|
}
|
346
|
347
|
|
347
|
348
|
}
|
|
@@ -356,8 +357,7 @@ public class CamelRestConfiguration extends RouteBuilder {
|
356
|
357
|
|
357
|
358
|
@Override
|
358
|
359
|
public synchronized void configure() throws Exception {
|
359
|
|
-
|
360
|
|
-
|
|
360
|
+ String date = getDate();
|
361
|
361
|
getAccessWell();
|
362
|
362
|
JSONObject body = new JSONObject();
|
363
|
363
|
Map<String,String> map = new HashMap<>();
|
|
@@ -383,7 +383,7 @@ public class CamelRestConfiguration extends RouteBuilder {
|
383
|
383
|
exchange -> {
|
384
|
384
|
Message in = exchange.getIn();
|
385
|
385
|
HashMap<String, Object> aRow = in.getBody(HashMap.class);
|
386
|
|
- if (aRow.get("typeName").toString().indexOf("油井") > 0) {
|
|
386
|
+ if (aRow.get("typeName") != null && aRow.get("typeName").toString().indexOf("油井") > 0) {
|
387
|
387
|
getCurrentTimeParams(aRow.get("id").toString(), aRow.get("code").toString(),map.get("date"));
|
388
|
388
|
Double phd = "".equals(loadPhdDate(aRow.get("id").toString())) ? 0 : Double.valueOf(loadPhdDate(aRow.get("id").toString()));
|
389
|
389
|
ZDJG_WELL zdjg_well = loadGtData(aRow.get("id") + "/analyse/功图数据", aRow.get("code").toString(), "2021-08-17");
|