mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-10 13:00:02 +08:00
update
This commit is contained in:
@@ -222,8 +222,11 @@ public class OrderController extends BaseController {
|
|||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
try {
|
try {
|
||||||
// String memberId = getMemberIdByAuthorization(request);
|
// String memberId = getMemberIdByAuthorization(request);
|
||||||
String status = orderService.selectPileStarterStatus(dto.getOrderCode());
|
Map<String, String> map = orderService.selectPileStarterStatus(dto.getOrderCode());
|
||||||
response = new RestApiResponse<>(ImmutableMap.of("status", status));
|
response = new RestApiResponse<>(map);
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
logger.error("根据订单号查询充电桩启动状态 error", e);
|
||||||
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("根据订单号查询充电桩启动状态 error", e);
|
logger.error("根据订单号查询充电桩启动状态 error", e);
|
||||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_ORDER_DETAIL_ERROR);
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_ORDER_DETAIL_ERROR);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
|||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.huifu.adapay.core.AdapayCore;
|
import com.huifu.adapay.core.AdapayCore;
|
||||||
import com.huifu.adapay.core.util.AdapaySign;
|
import com.huifu.adapay.core.util.AdapaySign;
|
||||||
@@ -622,17 +623,34 @@ public class OrderService {
|
|||||||
/**
|
/**
|
||||||
* 根据订单号查询充电桩启动状态
|
* 根据订单号查询充电桩启动状态
|
||||||
*
|
*
|
||||||
* @param orderCode
|
* @param orderCode 订单编号
|
||||||
* @return
|
* @return 0: 未启动,1: 启动成功,2: 启动失败
|
||||||
*/
|
*/
|
||||||
public String selectPileStarterStatus(String orderCode) {
|
public Map<String, String> selectPileStarterStatus(String orderCode) {
|
||||||
OrderBasicInfo orderInfoByOrderCode = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||||
if (orderInfoByOrderCode == null) {
|
if (orderInfo == null) {
|
||||||
return Constants.ZERO;
|
throw new BusinessException(ReturnCodeEnum.CODE_QUERY_ORDER_INFO_IS_NULL);
|
||||||
}
|
}
|
||||||
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfoByOrderCode.getTransactionCode());
|
String status = Constants.ZERO;
|
||||||
// 只有充电桩上传的实时数据中的状态为充电,才能查到实时数据列表
|
String reason = null;
|
||||||
return CollectionUtils.isNotEmpty(chargingRealTimeData) ? Constants.ONE : Constants.ZERO;
|
|
||||||
|
// 如果是订单完成状态
|
||||||
|
if (StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.ORDER_COMPLETE.getValue())) {
|
||||||
|
status = Constants.TWO;
|
||||||
|
reason = orderInfo.getReason();
|
||||||
|
} else {
|
||||||
|
// 查询订单的实时监测数据
|
||||||
|
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode());
|
||||||
|
if (CollectionUtils.isNotEmpty(chargingRealTimeData)) {
|
||||||
|
// 实时监测数据不为空说明已经在充电中了
|
||||||
|
status = Constants.ONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> resultMap = Maps.newHashMap();
|
||||||
|
resultMap.put("status", status);
|
||||||
|
resultMap.put("reason", reason);
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -491,7 +491,6 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
.flatUsedElectricity(Constants.ZERO)
|
.flatUsedElectricity(Constants.ZERO)
|
||||||
.valleyUsedElectricity(Constants.ZERO)
|
.valleyUsedElectricity(Constants.ZERO)
|
||||||
.build();
|
.build();
|
||||||
// settleOrder(data, orderInfo);
|
|
||||||
|
|
||||||
// 新逻辑
|
// 新逻辑
|
||||||
try {
|
try {
|
||||||
@@ -499,7 +498,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic(mode);
|
AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic(mode);
|
||||||
orderLogic.settleOrder(data, orderInfo);
|
orderLogic.settleOrder(data, orderInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("充电桩启动失败,执行退款逻辑发生异常", e);
|
logger.error("启动失败退款, orderCode:{}, 执行订单结算逻辑发生异常", orderInfo.getOrderCode(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user