mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -1106,7 +1106,12 @@ public class AdapayService {
|
||||
public List<AdaPayment> queryPaymentList(String startTime, String endTime) throws BaseAdaPayException {
|
||||
List<AdaPayment> resultList = Lists.newArrayList();
|
||||
String wechatAppId = "wxbb3e0d474569481d";
|
||||
String appId = "app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa";
|
||||
|
||||
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(wechatAppId);
|
||||
if (config == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CONFIG_IS_NULL_ERROR);
|
||||
}
|
||||
String appId = config.getAdapayAppId();
|
||||
long begin = DateUtils.dateStrToTimestamp(startTime); // 13位时间戳
|
||||
long end = DateUtils.dateStrToTimestamp(endTime); // 13位时间戳
|
||||
int pageNum = 0; // 页面容量,取值范围 1~20,默认值为 10
|
||||
@@ -1143,11 +1148,13 @@ public class AdapayService {
|
||||
/**
|
||||
* 查询支付列表
|
||||
*/
|
||||
public List<AdaPayment> queryPaymentByOrderNo(String orderNo) throws BaseAdaPayException {
|
||||
public List<AdaPayment> queryPaymentByOrderNo(String orderNo, String wechatAppId) throws BaseAdaPayException {
|
||||
List<AdaPayment> resultList = Lists.newArrayList();
|
||||
String wechatAppId = "wxbb3e0d474569481d";
|
||||
String appId = "app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa";
|
||||
|
||||
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(wechatAppId);
|
||||
if (config == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CONFIG_IS_NULL_ERROR);
|
||||
}
|
||||
String appId = config.getAdapayAppId();
|
||||
int pageNum = 0; // 页面容量,取值范围 1~20,默认值为 10
|
||||
int pageSize = 20; // 页面容量,取值范围 1~20,默认值为 10
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.jsowell.adapay.common.AdaPayment;
|
||||
import com.jsowell.adapay.dto.QueryPaymentConfirmDTO;
|
||||
import com.jsowell.adapay.operation.PaymentReverseOperation;
|
||||
import com.jsowell.adapay.response.PaymentConfirmResponse;
|
||||
@@ -25,6 +26,7 @@ import com.jsowell.common.enums.AcquirerEnum;
|
||||
import com.jsowell.common.enums.DelFlagEnum;
|
||||
import com.jsowell.common.enums.MemberWalletEnum;
|
||||
import com.jsowell.common.enums.adapay.AdapayStatusEnum;
|
||||
import com.jsowell.common.enums.adapay.MerchantDelayModeEnum;
|
||||
import com.jsowell.common.enums.ykc.*;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
@@ -2021,12 +2023,53 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
this.cleanCacheByOrderCode(orderBasicInfo.getOrderCode(), orderBasicInfo.getTransactionCode());
|
||||
|
||||
// 通过订单号查询汇付有没有支付单
|
||||
|
||||
checkUnpaidOrder(orderBasicInfo);
|
||||
}
|
||||
}
|
||||
return orderList.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验未支付订单
|
||||
* 如果存在因为未收到支付回调导致超时关闭的订单,在修改订单状态后,检查一下是否支付过,把支付的金额退款
|
||||
* @param orderBasicInfo
|
||||
*/
|
||||
private void checkUnpaidOrder(OrderBasicInfo orderBasicInfo) {
|
||||
String orderCode = orderBasicInfo.getOrderCode();
|
||||
List<AdaPayment> adaPayments = null;
|
||||
String memberId = orderBasicInfo.getMemberId();
|
||||
String merchantId = orderBasicInfo.getMerchantId();
|
||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(merchantId);
|
||||
String delayMode = pileMerchantInfoService.getDelayModeByWechatAppId(wechatAppId);
|
||||
try {
|
||||
adaPayments = adapayService.queryPaymentByOrderNo(orderCode, wechatAppId);
|
||||
} catch (BaseAdaPayException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(adaPayments)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 退款
|
||||
for (AdaPayment adaPayment : adaPayments) {
|
||||
String status = adaPayment.getStatus();
|
||||
if (!AdapayStatusEnum.SUCCEEDED.getValue().equals(status)) {
|
||||
// 不是交易完成状态,就跳过
|
||||
continue;
|
||||
}
|
||||
String paymentId = adaPayment.getId();
|
||||
BigDecimal payAmt = new BigDecimal(adaPayment.getPay_amt());
|
||||
if (MerchantDelayModeEnum.DELAY.getMode().equals(delayMode)) {
|
||||
// 延时分账商户,创建交易撤销请求
|
||||
adapayService.createPaymentReverseRequest(paymentId, payAmt, wechatAppId, memberId, ScenarioEnum.ORDER.getValue(), orderCode);
|
||||
} else {
|
||||
// 实时分账商户,创建交易退款请求
|
||||
adapayService.createRefundRequest(paymentId, payAmt, wechatAppId, memberId, ScenarioEnum.ORDER.getValue(), orderCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信支付-订单退款处理逻辑
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.pile.domain.PileMsgRecord;
|
||||
import com.jsowell.pile.dto.QueryPileDTO;
|
||||
@@ -67,7 +68,7 @@ public class PileMsgRecordServiceImpl implements IPileMsgRecordService {
|
||||
String frameType = pileMsgRecord.getFrameType();
|
||||
vo.setFrameType(frameType);
|
||||
vo.setFrameTypeStr(YKCFrameTypeCode.getFrameTypeStr(frameType));
|
||||
vo.setDescription(pileMsgRecord.getJsonMsg());
|
||||
vo.setDescription(generateDescription(pileMsgRecord));
|
||||
vo.setOriginalMsg(pileMsgRecord.getOriginalMsg());
|
||||
vo.setPileSn(pileMsgRecord.getPileSn());
|
||||
vo.setCreateTime(pileMsgRecord.getCreateTime());
|
||||
@@ -100,7 +101,7 @@ public class PileMsgRecordServiceImpl implements IPileMsgRecordService {
|
||||
result = loginMsg(jsonMsg);
|
||||
break;
|
||||
case "0x31" :
|
||||
result = loginMsg(jsonMsg);
|
||||
result = requestStartChargingMsg(jsonMsg);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -125,7 +126,23 @@ public class PileMsgRecordServiceImpl implements IPileMsgRecordService {
|
||||
|
||||
private String requestStartChargingMsg(String jsonMsg) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(jsonMsg);
|
||||
jsonObject.getString("");
|
||||
return null;
|
||||
// 启动方式
|
||||
String startMode = jsonObject.getString("startMode");
|
||||
if (StringUtils.equals(startMode, "0x01")) {
|
||||
startMode = "离线卡启动";
|
||||
} else if (StringUtils.equals(startMode, "0x02")) {
|
||||
startMode = "帐号启动";
|
||||
} else if (StringUtils.equals(startMode, "0x03")) {
|
||||
startMode = "VIN启动";
|
||||
} else {
|
||||
startMode = "未知";
|
||||
}
|
||||
String physicsCard = jsonObject.getString("physicsCard");
|
||||
String vinCode = jsonObject.getString("vinCode");
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("启动方式:").append(startMode).append(", ");
|
||||
stringBuilder.append("物理卡号:").append(physicsCard).append(", ");
|
||||
stringBuilder.append("vinCode:").append(vinCode).append(", ");
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user