防止错误数据导致返回格式错误
This commit is contained in:
parent
92d04c76f9
commit
dd2cf17eb2
@ -118,7 +118,7 @@ public class QueryEquipChargeStatusController {
|
|||||||
equipChargeStatus.setTotalMoney(lord.getAmountCharged() == null ? 0 : lord.getAmountCharged() / 10000.0);
|
equipChargeStatus.setTotalMoney(lord.getAmountCharged() == null ? 0 : lord.getAmountCharged() / 10000.0);
|
||||||
final Long rateModelId = REDIS.getCacheMapValue("pile:".concat(connectorId.substring(0, 14)), "rateModelId");
|
final Long rateModelId = REDIS.getCacheMapValue("pile:".concat(connectorId.substring(0, 14)), "rateModelId");
|
||||||
final CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
final CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
||||||
if (cacheRateModel != null) calculateEm(equipChargeStatus, cacheRateModel);
|
calculateEm(equipChargeStatus, cacheRateModel);
|
||||||
CommonResponse response = new CommonResponse();
|
CommonResponse response = new CommonResponse();
|
||||||
response.setRet(EvcsConst.RET_SUCC);
|
response.setRet(EvcsConst.RET_SUCC);
|
||||||
response.setData(JSONUtil.toJSONString(equipChargeStatus));
|
response.setData(JSONUtil.toJSONString(equipChargeStatus));
|
||||||
|
|||||||
@ -95,6 +95,10 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
|||||||
|
|
||||||
public static void calculateEm(EquipChargeStatus equipChargeStatus, CacheRateModel cacheRateModel) {
|
public static void calculateEm(EquipChargeStatus equipChargeStatus, CacheRateModel cacheRateModel) {
|
||||||
|
|
||||||
|
if (cacheRateModel != null) {
|
||||||
|
equipChargeStatus.setChargeDetails(new ChargeDetails[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
final Date endTime = DateUtil.string2Date(equipChargeStatus.getEndTime());
|
final Date endTime = DateUtil.string2Date(equipChargeStatus.getEndTime());
|
||||||
final Date startTime = DateUtil.string2Date(equipChargeStatus.getStartTime());
|
final Date startTime = DateUtil.string2Date(equipChargeStatus.getStartTime());
|
||||||
long totalMilSec = endTime.getTime() - startTime.getTime();
|
long totalMilSec = endTime.getTime() - startTime.getTime();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user