opt:优化空指针提示和判断
This commit is contained in:
@@ -142,8 +142,12 @@ public class BakingServiceImpl implements BakingService {
|
|||||||
for (int i = 0; i < hot_rows.size(); i++) {
|
for (int i = 0; i < hot_rows.size(); i++) {
|
||||||
JSONObject hot_row = hot_rows.getJSONObject(i);
|
JSONObject hot_row = hot_rows.getJSONObject(i);
|
||||||
String point_code = hot_row.getString("point_code");
|
String point_code = hot_row.getString("point_code");
|
||||||
String point_temperature = (String) redisUtils.hget(point_code, "temperature");
|
boolean exists = redisUtils.hHasKey(point_code, "temperature");
|
||||||
if (!ObjectUtil.isEmpty(point_temperature)) {
|
String point_temperature = "";
|
||||||
|
if(exists){
|
||||||
|
point_temperature = (String) redisUtils.hget(point_code, "temperature");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(point_temperature)) {
|
||||||
if (point_temperature.equals(temperature)) {
|
if (point_temperature.equals(temperature)) {
|
||||||
jsonHotIvt = hot_row;
|
jsonHotIvt = hot_row;
|
||||||
break;
|
break;
|
||||||
@@ -159,8 +163,12 @@ public class BakingServiceImpl implements BakingService {
|
|||||||
for (int i = 0; i < hot_rows.size(); i++) {
|
for (int i = 0; i < hot_rows.size(); i++) {
|
||||||
JSONObject hot_row = hot_rows.getJSONObject(i);
|
JSONObject hot_row = hot_rows.getJSONObject(i);
|
||||||
String point_code = hot_row.getString("point_code");
|
String point_code = hot_row.getString("point_code");
|
||||||
String point_temperature = (String) redisUtils.hget(point_code, "temperature");
|
boolean exists = redisUtils.hHasKey(point_code, "temperature");
|
||||||
if (!ObjectUtil.isEmpty(point_temperature)) {
|
String point_temperature = "";
|
||||||
|
if(exists){
|
||||||
|
point_temperature = (String) redisUtils.hget(point_code, "temperature");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(point_temperature)) {
|
||||||
if (point_temperature.equals(temperature)) {
|
if (point_temperature.equals(temperature)) {
|
||||||
jsonHotIvt = hot_row;
|
jsonHotIvt = hot_row;
|
||||||
break;
|
break;
|
||||||
@@ -427,8 +435,15 @@ public class BakingServiceImpl implements BakingService {
|
|||||||
hotParam.put("task_id", task_id);
|
hotParam.put("task_id", task_id);
|
||||||
hotParam.put("start_point_code", point_code1);
|
hotParam.put("start_point_code", point_code1);
|
||||||
hotParam.put("end_point_code", cache_jo.getString("point_code"));
|
hotParam.put("end_point_code", cache_jo.getString("point_code"));
|
||||||
String point_temperature = (String) redisUtils.hget(point_code1, "temperature");
|
boolean exists = redisUtils.hHasKey(point_code1, "temperature");
|
||||||
|
String point_temperature = "";
|
||||||
|
if(exists){
|
||||||
|
point_temperature = (String) redisUtils.hget(point_code1, "temperature");
|
||||||
|
}else{
|
||||||
|
throw new BadRequestException("当前操作点位设备:"+point_code1+",无法获取温度,请稍后再试!");
|
||||||
|
}
|
||||||
hotParam.put("temperature", point_temperature);
|
hotParam.put("temperature", point_temperature);
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(last_hot_mst)) {
|
if (ObjectUtil.isEmpty(last_hot_mst)) {
|
||||||
hotParam.put("oven_time", "480");
|
hotParam.put("oven_time", "480");
|
||||||
} else {
|
} else {
|
||||||
@@ -544,6 +559,9 @@ public class BakingServiceImpl implements BakingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject getJsonObject(String product_area, JSONObject point_code2_jo, String temperature) {
|
public JSONObject getJsonObject(String product_area, JSONObject point_code2_jo, String temperature) {
|
||||||
|
if (ObjectUtil.isEmpty(point_code2_jo)) {
|
||||||
|
throw new BadRequestException("暂无可用烘箱对接位!");
|
||||||
|
}
|
||||||
JSONObject jsonMap = new JSONObject();
|
JSONObject jsonMap = new JSONObject();
|
||||||
jsonMap.put("flag", "1");
|
jsonMap.put("flag", "1");
|
||||||
jsonMap.put("product_area", product_area);
|
jsonMap.put("product_area", product_area);
|
||||||
@@ -553,8 +571,12 @@ public class BakingServiceImpl implements BakingService {
|
|||||||
for (int i = 0; i < hot_rows.size(); i++) {
|
for (int i = 0; i < hot_rows.size(); i++) {
|
||||||
JSONObject hot_row = hot_rows.getJSONObject(i);
|
JSONObject hot_row = hot_rows.getJSONObject(i);
|
||||||
String point_code = hot_row.getString("point_code");
|
String point_code = hot_row.getString("point_code");
|
||||||
String point_temperature = (String) redisUtils.hget(point_code, "temperature");
|
boolean exists = redisUtils.hHasKey(point_code, "temperature");
|
||||||
if (!ObjectUtil.isEmpty(point_temperature)) {
|
String point_temperature = "";
|
||||||
|
if(exists){
|
||||||
|
point_temperature = (String) redisUtils.hget(point_code, "temperature");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(point_temperature)) {
|
||||||
if (point_temperature.equals(temperature)) {
|
if (point_temperature.equals(temperature)) {
|
||||||
jsonHotIvt = hot_row;
|
jsonHotIvt = hot_row;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user