多了一个NPE空指针异常判断,少了几行代码
This commit is contained in:
parent
8d0f60bfbc
commit
38174984b1
@ -31,26 +31,18 @@ public class QueryEquipBusinessPolicyController {
|
|||||||
EquipBizRequest equipBizRequest = JSONUtil.readParams(commonRequest.getData(), EquipBizRequest.class);
|
EquipBizRequest equipBizRequest = JSONUtil.readParams(commonRequest.getData(), EquipBizRequest.class);
|
||||||
String connectorId = equipBizRequest.getConnectorId();
|
String connectorId = equipBizRequest.getConnectorId();
|
||||||
//获取枪所对应的桩编码
|
//获取枪所对应的桩编码
|
||||||
String bySerialNumber = xhpcTerminalRepository.selectBySql(connectorId);
|
String pileSerialNumber = xhpcTerminalRepository.selectBySql(connectorId);
|
||||||
String pileSerialNumber = bySerialNumber;
|
Map<String, Object> cachePile = REDIS.getCacheMap("pile:" + pileSerialNumber);
|
||||||
|
if (pileSerialNumber == null || cachePile == null) {
|
||||||
//找不到对应的桩编码,说明充电设备接口编码有误
|
|
||||||
if (pileSerialNumber == null) {
|
|
||||||
CommonResponse commonResponse = new CommonResponse();
|
CommonResponse commonResponse = new CommonResponse();
|
||||||
commonResponse.setMsg("error connectorId");
|
commonResponse.setMsg("ConnectorID not found");
|
||||||
commonResponse.setRet("1");
|
commonResponse.setRet("1");
|
||||||
commonResponse.setData(null);
|
|
||||||
return commonResponse;
|
return commonResponse;
|
||||||
}
|
}
|
||||||
//通过桩编码,进入redis,找到其所用的费率模型id
|
Long rateModelId = (Long) cachePile.get("rateModelId");
|
||||||
Map<String, Object> cacheMap = REDIS.getCacheMap("pile:" + pileSerialNumber);
|
|
||||||
|
|
||||||
Long rateModelId = (Long) cacheMap.get("rateModelId");
|
|
||||||
//通过指定费率模型id,找到其对应的费率模型
|
|
||||||
CacheRateModel rateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
CacheRateModel rateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
||||||
String[] tfPricesSeq = rateModel.getTfPricesSeq();
|
String[] tfPricesSeq = rateModel.getTfPricesSeq();
|
||||||
|
|
||||||
//遍历获取每一个时段
|
|
||||||
//存储时段
|
//存储时段
|
||||||
ArrayList<String> modelTypes = new ArrayList<>();
|
ArrayList<String> modelTypes = new ArrayList<>();
|
||||||
//存储时段个数
|
//存储时段个数
|
||||||
@ -61,6 +53,7 @@ public class QueryEquipBusinessPolicyController {
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
//最后一个时段的前一个时段的下标索引
|
//最后一个时段的前一个时段的下标索引
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
//遍历获取每一个时段
|
||||||
for (int i = 0; i < tfPricesSeq.length - 1; i++) {
|
for (int i = 0; i < tfPricesSeq.length - 1; i++) {
|
||||||
count++;
|
count++;
|
||||||
//如果当前时段与后面的时段不相同,则表示当前时段已经结束,添加当前时段到list中,并将其坐标存放到另一个集合中。
|
//如果当前时段与后面的时段不相同,则表示当前时段已经结束,添加当前时段到list中,并将其坐标存放到另一个集合中。
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user