|
|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.template.mapper.ElectricEquipmentMapper;
|
|
|
import com.template.model.pojo.ElectricEquipment;
|
|
|
import com.template.services.ElectricEquipmentService;
|
|
|
+import org.slf4j.Logger;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -132,16 +133,28 @@ public class ElectricEquipmentServiceImpl extends ServiceImpl<ElectricEquipmentM
|
|
|
String forObject = restTemplate.getForObject(url, String.class);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(forObject);
|
|
|
JSONArray meterObj = jsonObject.getJSONArray("meterObj");
|
|
|
+// 获取编码
|
|
|
+ String resultCode = jsonObject.getString("resultCode");
|
|
|
Boolean state = false;
|
|
|
- for (int i = 0; i < meterObj.size(); i++) {
|
|
|
- JSONObject object = meterObj.getJSONObject(i);
|
|
|
- String meterId1 = object.getString("meterId");
|
|
|
- String opState = object.getString("opState");
|
|
|
- if ("Y".equals(opState)) {
|
|
|
- state = true;
|
|
|
- }
|
|
|
+ if ("1000".equals(resultCode)) {
|
|
|
+ state = true;
|
|
|
+ System.out.println(electricEquipment.getRoomNum()+":开电成攻");
|
|
|
+ }else {
|
|
|
+ System.out.println(electricEquipment.getRoomNum()+":开电失败");
|
|
|
}
|
|
|
return state;
|
|
|
+// for (int i = 0; i < meterObj.size(); i++) {
|
|
|
+// JSONObject object = meterObj.getJSONObject(i);
|
|
|
+// String meterId1 = object.getString("meterId");
|
|
|
+// String opState = object.getString("opState");
|
|
|
+// if ("Y".equals(opState)) {
|
|
|
+// state = true;
|
|
|
+// System.out.println(electricEquipment.getRoomNum()+":开电成攻");
|
|
|
+// }else {
|
|
|
+// System.out.println(electricEquipment.getRoomNum()+":开电失败");
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -162,16 +175,25 @@ public class ElectricEquipmentServiceImpl extends ServiceImpl<ElectricEquipmentM
|
|
|
String forObject = restTemplate.getForObject(url, String.class);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(forObject);
|
|
|
JSONArray meterObj = jsonObject.getJSONArray("meterObj");
|
|
|
+ // 获取编码
|
|
|
+ String resultCode = jsonObject.getString("resultCode");
|
|
|
Boolean state = false;
|
|
|
- for (int i = 0; i < meterObj.size(); i++) {
|
|
|
- JSONObject object = meterObj.getJSONObject(i);
|
|
|
- String meterId1 = object.getString("meterId");
|
|
|
- String opState = object.getString("opState");
|
|
|
- if ("Y".equals(opState)) {
|
|
|
- state = true;
|
|
|
- }
|
|
|
+ if ("1000".equals(resultCode)) {
|
|
|
+ state = true;
|
|
|
+ System.out.println(electricEquipment.getRoomNum()+":关电成攻");
|
|
|
+ }else {
|
|
|
+ System.out.println(electricEquipment.getRoomNum()+":关电失败");
|
|
|
}
|
|
|
return state;
|
|
|
+// for (int i = 0; i < meterObj.size(); i++) {
|
|
|
+// JSONObject object = meterObj.getJSONObject(i);
|
|
|
+// String meterId1 = object.getString("meterId");
|
|
|
+// String opState = object.getString("opState");
|
|
|
+// if ("Y".equals(opState)) {
|
|
|
+// state = true;
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// @Scheduled(cron = "0 55 * * * ? ")
|