This commit is contained in:
2023-08-23 16:26:02 +08:00
parent 930486c5ff
commit c5a8b808c6
5 changed files with 63 additions and 26 deletions

View File

@@ -12,11 +12,13 @@ import com.google.common.collect.Sets;
import com.huifu.adapay.core.AdapayCore;
import com.huifu.adapay.core.util.AdapaySign;
import com.jsowell.adapay.response.PaymentReverseResponse;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
import com.jsowell.common.core.page.PageResponse;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.AcquirerEnum;
import com.jsowell.common.enums.InvoiceRecordEnum;
import com.jsowell.common.enums.MemberWalletEnum;
@@ -115,6 +117,9 @@ public class OrderService {
@Resource
private OrderPileOccupyService orderPileOccupyService;
@Resource
private RedisCache redisCache;
/**
* 生成订单
* @param dto
@@ -1126,15 +1131,20 @@ public class OrderService {
log.info("支付撤销成功 data:{}", JSON.toJSONString(data));
JSONObject jsonObject = JSON.parseObject(data);
JSONObject reason = jsonObject.getJSONObject("reason");
// if (ScenarioEnum.BALANCE.getValue().equals(reason.getString("scenarioType"))) {
// // 这笔支付订单原来是充值余额的,退款成功了,需要扣掉会员的本金金额
// UpdateMemberBalanceDTO dto = new UpdateMemberBalanceDTO();
// dto.setMemberId(reason.getString("memberId"));
// dto.setUpdatePrincipalBalance(new BigDecimal(jsonObject.getString("reverse_amt"))); // 更新会员本金金额,单位元
// dto.setType(MemberWalletEnum.TYPE_OUT.getValue());
// dto.setSubType(MemberWalletEnum.SUBTYPE_USER_REFUND.getValue());
// memberBasicInfoService.updateMemberBalance(dto);
// }
if (ScenarioEnum.BALANCE.getValue().equals(reason.getString("scenarioType"))) {
// 这笔支付订单原来是充值余额的,退款成功了,需要扣掉会员的本金金额
UpdateMemberBalanceDTO dto = new UpdateMemberBalanceDTO();
String memberId = reason.getString("memberId");
dto.setMemberId(memberId);
dto.setUpdatePrincipalBalance(new BigDecimal(jsonObject.getString("reverse_amt"))); // 更新会员本金金额,单位元
dto.setType(MemberWalletEnum.TYPE_OUT.getValue());
dto.setSubType(MemberWalletEnum.SUBTYPE_USER_REFUND.getValue());
memberBasicInfoService.updateMemberBalance(dto);
// 收到回调,删除缓存
String redisKey = CacheConstants.MEMBER_BALANCE_REFUNDS_ARE_IN_PROGRESS + memberId;
redisCache.deleteObject(redisKey);
}
}
@@ -1143,6 +1153,15 @@ public class OrderService {
*/
private void paymentReverseFailed(String data) {
log.info("支付撤销失败 data:{}", JSON.toJSONString(data));
JSONObject jsonObject = JSON.parseObject(data);
JSONObject reason = jsonObject.getJSONObject("reason");
if (ScenarioEnum.BALANCE.getValue().equals(reason.getString("scenarioType"))) {
String memberId = reason.getString("memberId");
// 收到回调,删除缓存
String redisKey = CacheConstants.MEMBER_BALANCE_REFUNDS_ARE_IN_PROGRESS + memberId;
redisCache.deleteObject(redisKey);
}
}
public Map<String, Object> payOccupyPileOrder(PayOrderDTO dto) {