会员回调
This commit is contained in:
parent
94c96d124e
commit
32f50f003b
|
|
@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 回调
|
||||||
* @author ww
|
* @author ww
|
||||||
* @description
|
* @description
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean joinMember(Long shopId, Long userId, Long memberOrderId) {
|
public boolean joinMember(Long shopId, Long userId, Long memberOrderId) {
|
||||||
MemberConfigVO memberConfigVO = detail(shopId);
|
MemberConfigVO memberConfigVO = detail(shopId);
|
||||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getSourceShopId, shopId).eq(ShopUser::getUserId, userId));
|
ShopUser shopUser = shopUserService.getShopUserInfo(shopId, userId);
|
||||||
if (shopUser == null) {
|
if (shopUser == null) {
|
||||||
log.warn("用户不存在, 店铺id: {}, 用户id: {}", shopId, userId);
|
log.warn("用户不存在, 店铺id: {}, 用户id: {}", shopId, userId);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -474,10 +474,14 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
||||||
// 发券流程
|
// 发券流程
|
||||||
if (StrUtil.isNotBlank(memberOrder.getCouponList())) {
|
if (StrUtil.isNotBlank(memberOrder.getCouponList())) {
|
||||||
JSONArray.parseArray(memberOrder.getCouponList()).toJavaList(MemberConfigDTO.ConfigCoupon.class).forEach(item -> {
|
JSONArray.parseArray(memberOrder.getCouponList()).toJavaList(MemberConfigDTO.ConfigCoupon.class).forEach(item -> {
|
||||||
shopCouponRecordService.grant(shopId, new MkRewardCouponDTO().setCouponId(item.getCoupon().getId())
|
try {
|
||||||
.setNum(item.getNum())
|
shopCouponRecordService.grant(shopId, new MkRewardCouponDTO().setCouponId(item.getCoupon().getId())
|
||||||
.setUserId(shopUser.getUserId())
|
.setNum(item.getNum())
|
||||||
.setShopId(shopId));
|
.setUserId(shopUser.getUserId())
|
||||||
|
.setShopId(shopId));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("发券失败", e);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -808,7 +808,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||||
@Transactional
|
@Transactional
|
||||||
public void payCallBackOrder(@NotBlank String orderNo, @NotNull JSONObject resultJson, int retryCount) {
|
public void payCallBackOrder(@NotBlank String orderNo, @NotNull JSONObject resultJson, int retryCount) {
|
||||||
CzgPayNotifyDTO czgCallBackDto = JSONObject.parseObject(resultJson.toString(), CzgPayNotifyDTO.class);
|
CzgPayNotifyDTO czgCallBackDto = JSONObject.parseObject(resultJson.toString(), CzgPayNotifyDTO.class);
|
||||||
OrderPayment payment = paymentService.queryChain().eq(OrderPayment::getOrderNo, orderNo).one();
|
OrderPayment payment = paymentService.getOne(new QueryWrapper().eq(OrderPayment::getOrderNo, orderNo));
|
||||||
if (payment == null) {
|
if (payment == null) {
|
||||||
if (retryCount < MAX_RETRIES) {
|
if (retryCount < MAX_RETRIES) {
|
||||||
log.info("支付记录不存在,第 {} 次重试,将在 {} 秒后进行", retryCount + 1, DELAY);
|
log.info("支付记录不存在,第 {} 次重试,将在 {} 秒后进行", retryCount + 1, DELAY);
|
||||||
|
|
@ -820,13 +820,11 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(payment.getTradeNumber())) {
|
if (StrUtil.isNotBlank(payment.getTradeNumber())) {
|
||||||
log.info("订单处理过,payment id:{}", payment.getId());
|
log.info("订单处理过,payment id:{}", payment.getId());
|
||||||
return;
|
// return;
|
||||||
}
|
}
|
||||||
paymentService.updateChain()
|
payment.setTradeNumber( czgCallBackDto.getPayOrderId());
|
||||||
.set(OrderPayment::getTradeNumber, czgCallBackDto.getPayOrderId())
|
payment.setRespJson(resultJson.toString());
|
||||||
.set(OrderPayment::getRespJson, resultJson.toString())
|
paymentService.updateById(payment);
|
||||||
.where(OrderPayment::getId).eq(payment.getId())
|
|
||||||
.update();
|
|
||||||
|
|
||||||
if ("TRADE_SUCCESS".equals(czgCallBackDto.getState())) {
|
if ("TRADE_SUCCESS".equals(czgCallBackDto.getState())) {
|
||||||
if ("order".equals(payment.getPayType())) {
|
if ("order".equals(payment.getPayType())) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue