mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
支付订单也加入memberId数据;汇付支付成功回调保存member_adapay_record
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.jsowell.pile.domain.MemberAdapayRecord;
|
||||
public interface MemberAdapayRecordService{
|
||||
|
||||
import java.util.List;
|
||||
public interface MemberAdapayRecordService{
|
||||
|
||||
int insertSelective(MemberAdapayRecord record);
|
||||
|
||||
|
||||
@@ -669,9 +669,6 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
}
|
||||
}
|
||||
|
||||
// 查询订单详情 修改订单数据
|
||||
OrderDetail orderDetail = getOrderDetailByOrderCode(orderCode);
|
||||
|
||||
// 把交易记录中的用电量,金额等信息 更新到orderBasicInfo和orderDetail
|
||||
orderBasicInfo.setVirtualAmount(virtualAmount); // 虚拟金额
|
||||
orderBasicInfo.setSettleAmount(orderAmount.subtract(virtualAmount)); // 结算金额
|
||||
@@ -680,7 +677,8 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
orderBasicInfo.setSettlementTime(DateUtils.getNowDate()); // 结算时间
|
||||
orderBasicInfo.setRefundAmount(residue); // 结算退款金额
|
||||
|
||||
// 更新订单详情
|
||||
// 更新订单详情 查询订单详情 修改订单数据
|
||||
OrderDetail orderDetail = getOrderDetailByOrderCode(orderCode);
|
||||
try {
|
||||
// 总电费金额
|
||||
BigDecimal totalElectricityAmount = BigDecimal.ZERO;
|
||||
@@ -763,28 +761,14 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
transactionService.doUpdateOrder(dto);
|
||||
logger.info("结算订单end:{} OrderTransactionDTO:{}", orderCode, JSONObject.toJSONString(dto));
|
||||
|
||||
try {
|
||||
// 将卡/vin状态解锁
|
||||
if (!StringUtils.equals("0000000000000000", data.getLogicCard())) {
|
||||
// 根据物理卡号查出当前为锁定状态的卡
|
||||
PileAuthCard cardInfo = pileAuthCardService.selectSomeStatusCardInfo(CardStatusEnum.START_LOCK.getCode(), orderBasicInfo.getLogicCard());
|
||||
if (cardInfo != null) {
|
||||
// orderBasicInfo.setMemberId(cardInfo.getMemberId());
|
||||
// 将此卡状态改为正常
|
||||
cardInfo.setStatus(CardStatusEnum.NORMAL.getCode());
|
||||
pileAuthCardService.updatePileAuthCard(cardInfo);
|
||||
}
|
||||
}
|
||||
// 如果是vin启动,将启动锁定状态改为正常
|
||||
if (StringUtils.equals(data.getTransactionIdentifier(), "05")) {
|
||||
MemberPlateNumberRelation plateInfo = memberPlateNumberRelationService.getMemberPlateInfoByVinCode(data.getVinCode());
|
||||
if (plateInfo != null && (StringUtils.equals(plateInfo.getVinStatus(), "2"))) {
|
||||
plateInfo.setVinStatus("1");
|
||||
memberPlateNumberRelationService.updateMemberPlateNumberRelation(plateInfo);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("解锁卡/vin状态 error,", e);
|
||||
// 将卡/vin状态解锁
|
||||
if (!StringUtils.equals("0000000000000000", data.getLogicCard())) {
|
||||
cardStatusUnlocked(orderBasicInfo.getLogicCard());
|
||||
}
|
||||
|
||||
// 如果是vin启动,将启动锁定状态改为正常
|
||||
if (StringUtils.equals(data.getTransactionIdentifier(), "05")) {
|
||||
vinStatusUnlocked(data.getVinCode());
|
||||
}
|
||||
|
||||
// 发送停止充电订阅消息
|
||||
@@ -794,6 +778,39 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
realTimeMonitorDataRedis2DB(orderBasicInfo.getTransactionCode(), orderCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡状态解锁
|
||||
*/
|
||||
private void cardStatusUnlocked(String logicCard) {
|
||||
try {
|
||||
// 根据物理卡号查出当前为锁定状态的卡
|
||||
PileAuthCard cardInfo = pileAuthCardService.selectSomeStatusCardInfo(CardStatusEnum.START_LOCK.getCode(), logicCard);
|
||||
if (cardInfo != null) {
|
||||
// 将此卡状态改为正常
|
||||
cardInfo.setStatus(CardStatusEnum.NORMAL.getCode());
|
||||
pileAuthCardService.updatePileAuthCard(cardInfo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("解锁卡状态 error,", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解锁vin状态
|
||||
* @param vinCode
|
||||
*/
|
||||
private void vinStatusUnlocked(String vinCode) {
|
||||
try {
|
||||
MemberPlateNumberRelation plateInfo = memberPlateNumberRelationService.getMemberPlateInfoByVinCode(vinCode);
|
||||
if (plateInfo != null && (StringUtils.equals(plateInfo.getVinStatus(), "2"))) {
|
||||
plateInfo.setVinStatus("1");
|
||||
memberPlateNumberRelationService.updateMemberPlateNumberRelation(plateInfo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("解锁vin状态 error,", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单退款逻辑
|
||||
* @param orderBasicInfo 订单信息
|
||||
@@ -2460,10 +2477,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> payOrder(PayOrderDTO dto) throws Exception {
|
||||
public Map<String, Object> payOrder(PayOrderDTO dto) {
|
||||
OrderBasicInfo orderInfo = this.getOrderInfoByOrderCode(dto.getOrderCode());
|
||||
if (orderInfo == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_QUERY_ORDER_NULL_ERROR);
|
||||
@@ -2485,8 +2501,6 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
|
||||
// 返回微信支付参数
|
||||
resultMap.put("weixinMap", weixinMap);
|
||||
} else if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_ALIPAY.getValue())) { // 支付宝支付
|
||||
// TODO 返回支付宝支付参数
|
||||
} else if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WHITELIST.getValue())) { // 白名单支付
|
||||
// 白名单支付可以直接调支付回调方法
|
||||
dto.setPayAmount(new BigDecimal("500"));
|
||||
@@ -2617,6 +2631,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
map.put("type", ScenarioEnum.ORDER.getValue());
|
||||
map.put("orderCode", dto.getOrderCode());
|
||||
map.put("payMode", payMode);
|
||||
map.put("memberId", dto.getMemberId());
|
||||
createAdaPaymentParam.setDescription(JSON.toJSONString(map));
|
||||
// 异步通知地址,url为http/https路径,服务器POST回调,URL 上请勿附带参数
|
||||
createAdaPaymentParam.setNotify_url(ADAPAY_CALLBACK_URL);
|
||||
|
||||
Reference in New Issue
Block a user