update 华为Service

This commit is contained in:
Lemon
2024-03-25 11:24:17 +08:00
parent 5c6cf06db2
commit a4a35360aa
5 changed files with 100 additions and 16 deletions

View File

@@ -40,10 +40,8 @@ import com.jsowell.pile.service.*;
import com.jsowell.pile.service.programlogic.AbstractProgramLogic;
import com.jsowell.pile.service.programlogic.ProgramLogicFactory;
import com.jsowell.pile.util.UserUtils;
import com.jsowell.pile.vo.base.OrderAmountDetailVO;
import com.jsowell.pile.vo.base.OrderPeriodAmountVO;
import com.jsowell.pile.vo.base.*;
import com.jsowell.pile.vo.base.PileInfoVO;
import com.jsowell.pile.vo.base.StationInfoVO;
import com.jsowell.pile.vo.uniapp.InvoiceRecordVO;
import com.jsowell.pile.vo.uniapp.*;
import com.jsowell.pile.vo.web.*;
@@ -131,6 +129,9 @@ public class OrderService {
@Resource
private ClearingBillInfoService clearingBillInfoService;
@Autowired
private ThirdPartyStationRelationService thirdPartyStationRelationService;
@Autowired
private CommonService commonService;
@@ -1097,6 +1098,15 @@ public class OrderService {
.build();
// 订单支付成功 支付回调
orderBasicInfoService.payOrderSuccessCallback(callbackDTO); // 订单在线支付成功回调
// 异步判断是否对接了类似华为平台,如果是,走通用第三方平台启动充电逻辑
CompletableFuture.runAsync(() -> {
try {
checkThirdPartyQueryStartCharge(orderCode);
} catch (Exception e) {
log.error("异步推送第三方平台启动充电逻辑 error", e);
}
});
} else if (StringUtils.equals(scenarioType, ScenarioEnum.BALANCE.getValue())) { // 2-充值余额
// 充值余额成功
UpdateMemberBalanceDTO dto = new UpdateMemberBalanceDTO();
@@ -1286,5 +1296,32 @@ public class OrderService {
return orderPileOccupyService.payOccupyPileOrder(dto);
}
/**
* 异步判断是否对接了类似华为平台的第三方平台,并启动充电
* @param orderCode
*/
private void checkThirdPartyQueryStartCharge(String orderCode) {
// 根据订单号查询订单信息
OrderBasicInfo orderInfoByOrderCode = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
String stationId = orderInfoByOrderCode.getStationId();
// 判断是否对接了类似华为平台
List<ThirdPartyStationRelationVO> relationInfoList = thirdPartyStationRelationService.getRelationInfoList(stationId);
if (CollectionUtils.isEmpty(relationInfoList)) {
return;
}
for (ThirdPartyStationRelationVO vo : relationInfoList) {
String startMode = vo.getStartMode();
if (StringUtils.equals(Constants.TWO, startMode)) {
continue;
}
ThirdPartyCommonStartChargeDTO dto = new ThirdPartyCommonStartChargeDTO();
dto.setPayMode(orderInfoByOrderCode.getPayMode());
dto.setStationIds(Lists.newArrayList(stationId));
dto.setPileConnectorCode(orderInfoByOrderCode.getPileConnectorCode());
dto.setThirdPartyType(vo.getThirdPartyType());
String result = commonService.commonQueryStartCharge(dto);
log.info("异步判断是否对接第三方平台 result:{}", result);
}
}
}