开通会员修改
This commit is contained in:
@@ -7,6 +7,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import com.czg.CzgPayUtils;
|
import com.czg.CzgPayUtils;
|
||||||
import com.czg.entity.CzgBaseRespParams;
|
import com.czg.entity.CzgBaseRespParams;
|
||||||
import com.czg.market.service.MkDistributionUserService;
|
import com.czg.market.service.MkDistributionUserService;
|
||||||
|
import com.czg.market.service.TbMemberConfigService;
|
||||||
import com.czg.mq.PrintMqListener;
|
import com.czg.mq.PrintMqListener;
|
||||||
import com.czg.order.entity.OrderPayment;
|
import com.czg.order.entity.OrderPayment;
|
||||||
import com.czg.order.service.OrderInfoService;
|
import com.czg.order.service.OrderInfoService;
|
||||||
@@ -53,10 +54,16 @@ public class NotifyController {
|
|||||||
private MkDistributionUserService distributionUserService;
|
private MkDistributionUserService distributionUserService;
|
||||||
@Resource
|
@Resource
|
||||||
private OrderPaymentService paymentService;
|
private OrderPaymentService paymentService;
|
||||||
|
@Resource
|
||||||
|
private TbMemberConfigService memberConfigService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("testOpen")
|
@GetMapping("testOpen")
|
||||||
public JSONObject test1(String code) throws Exception {
|
public JSONObject test1(String code) throws Exception {
|
||||||
|
JSONObject czg = JSONObject.parseObject("{\"amount\":10,\"cashFee\":0,\"channelSendNo\":\"20251113110113130266202235210653\",\"channelTradeNo\":\"4200002932202511131794511090\",\"currency\":\"cny\",\"drType\":\"00\",\"ifCode\":\"lklspay\",\"mchOrderNo\":\"WX1988788559919120384\",\"mercNo\":\"B251107293903\",\"msgType\":\"sft.trade.notify\",\"note\":\"成功\",\"payOrderId\":\"2025111319887885609440501775VT\",\"payTime\":\"2025-11-13 09:58:44\",\"payType\":\"WECHAT\",\"refundAmt\":0,\"refundState\":0,\"settlementType\":\"D1\",\"state\":\"TRADE_SUCCESS\",\"storeId\":\"S2511077140\",\"subject\":\"万维时光的店铺\",\"tradeFee\":0,\"userId\":\"oVxsc1QNZRRsWdWDmTdwPJGT9BWc\"}");
|
||||||
|
AssertUtil.isNull(czg, "支付回调数据为空");
|
||||||
|
log.info("支付回调数据为:{}", czg);
|
||||||
|
orderInfoService.payCallBackOrder(czg.getString("mchOrderNo"), czg, 0);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -296,9 +297,9 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
||||||
public boolean deliver(Long shopId, Long userId, TableValueConstant.MemberExpFlow.Type type, BigDecimal money, Integer expVal, Long sourceId) {
|
public boolean deliver(Long shopId, Long userId, TableValueConstant.MemberExpFlow.Type type, BigDecimal money, Integer expVal, Long sourceId) {
|
||||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getSourceShopId, shopInfoService.getMainIdByShopId(shopId)).eq(ShopUser::getUserId, userId));
|
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getSourceShopId, shopInfoService.getMainIdByShopId(shopId)).eq(ShopUser::getUserId, userId));
|
||||||
if (shopUser == null || shopUser.getIsVip() == 0) {
|
if (shopUser == null || shopUser.getIsVip() == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -444,7 +445,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
||||||
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.getShopUserInfo(shopId, userId);
|
ShopUser shopUser = shopUserService.getShopUserInfo(shopId, userId);
|
||||||
@@ -473,7 +474,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
|||||||
}
|
}
|
||||||
if (!OrderStatusEnums.UNPAID.getCode().equals(memberOrder.getStatus())) {
|
if (!OrderStatusEnums.UNPAID.getCode().equals(memberOrder.getStatus())) {
|
||||||
log.warn("会员购买支付失败,会员订单状态不为待支付,会员订单id:{}", memberOrderId);
|
log.warn("会员购买支付失败,会员订单状态不为待支付,会员订单id:{}", memberOrderId);
|
||||||
// return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (memberOrder.getCircleUnit()) {
|
switch (memberOrder.getCircleUnit()) {
|
||||||
|
|||||||
@@ -1045,7 +1045,7 @@ 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;
|
||||||
}
|
}
|
||||||
payment.setTradeNumber(czgCallBackDto.getPayOrderId());
|
payment.setTradeNumber(czgCallBackDto.getPayOrderId());
|
||||||
payment.setRespJson(resultJson.toString());
|
payment.setRespJson(resultJson.toString());
|
||||||
@@ -1165,9 +1165,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
} else if ("memberPay".equals(payment.getPayType())) {
|
} else if ("memberPay".equals(payment.getPayType())) {
|
||||||
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||||
memberConfigService.joinMember(payment.getShopId(), shopUser.getUserId(), payment.getRelatedId());
|
memberConfigService.joinMember(payment.getShopId(), shopUser.getUserId(), payment.getRelatedId());
|
||||||
|
|
||||||
// 充值赠送积分
|
// 充值赠送积分
|
||||||
memberConfigService.deliver(shopUser.getMainShopId(), shopUser.getUserId(), TableValueConstant.MemberExpFlow.Type.COST, payment.getAmount(), null, payment.getId());
|
// memberConfigService.deliver(shopUser.getMainShopId(), shopUser.getUserId(), TableValueConstant.MemberExpFlow.Type.COST, payment.getAmount(), null, payment.getId());
|
||||||
|
|
||||||
// 分销员开通
|
// 分销员开通
|
||||||
} else if ("distribution".equals(payment.getPayType())) {
|
} else if ("distribution".equals(payment.getPayType())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user