打印改为事务提交后
This commit is contained in:
@@ -34,6 +34,7 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class MemberService {
|
public class MemberService {
|
||||||
@@ -84,6 +85,8 @@ public class MemberService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TbOrderInfoMapper tbOrderInfoMapper;
|
private TbOrderInfoMapper tbOrderInfoMapper;
|
||||||
private MpShopTableMapper mpShopTableMapper;
|
private MpShopTableMapper mpShopTableMapper;
|
||||||
|
@Autowired
|
||||||
|
private Utils utils;
|
||||||
|
|
||||||
public Result queryMember(String shopId, String phone,String isFlag, int page, int pageSize) {
|
public Result queryMember(String shopId, String phone,String isFlag, int page, int pageSize) {
|
||||||
|
|
||||||
@@ -579,7 +582,6 @@ public class MemberService {
|
|||||||
return Result.success(CodeEnum.SUCCESS, memberIn);
|
return Result.success(CodeEnum.SUCCESS, memberIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Result memberAccountPay(Map<String, Object> map, String token) throws Exception {
|
public Result memberAccountPay(Map<String, Object> map, String token) throws Exception {
|
||||||
if (ObjectUtil.isEmpty(map) || map.isEmpty()
|
if (ObjectUtil.isEmpty(map) || map.isEmpty()
|
||||||
|| !map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))
|
|| !map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))
|
||||||
@@ -633,10 +635,13 @@ public class MemberService {
|
|||||||
if (count < 1) {
|
if (count < 1) {
|
||||||
return Result.fail(CodeEnum.PAYTYPENOEXIST);
|
return Result.fail(CodeEnum.PAYTYPENOEXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal amount = new BigDecimal(String.valueOf(map.get("amount"))).setScale(2, RoundingMode.DOWN);
|
BigDecimal amount = new BigDecimal(String.valueOf(map.get("amount"))).setScale(2, RoundingMode.DOWN);
|
||||||
|
|
||||||
TbMemberIn memberIn = new TbMemberIn();
|
TbMemberIn memberIn = new TbMemberIn();
|
||||||
|
AtomicReference<BigDecimal> fl = new AtomicReference<>();
|
||||||
|
AtomicReference<TbShopUserFlow> flow = new AtomicReference<>(new TbShopUserFlow());
|
||||||
|
utils.runFunAndTransactional(() -> {
|
||||||
|
|
||||||
memberIn.setMerchantId(Integer.valueOf(shopInfo.getMerchantId()));
|
memberIn.setMerchantId(Integer.valueOf(shopInfo.getMerchantId()));
|
||||||
memberIn.setAmount(amount);
|
memberIn.setAmount(amount);
|
||||||
memberIn.setUserId(shopUser.getId());
|
memberIn.setUserId(shopUser.getId());
|
||||||
@@ -657,17 +662,15 @@ public class MemberService {
|
|||||||
}
|
}
|
||||||
tbShopUserMapper.updateByPrimaryKeySelective(shopUser);
|
tbShopUserMapper.updateByPrimaryKeySelective(shopUser);
|
||||||
|
|
||||||
TbShopUserFlow flow = new TbShopUserFlow();
|
flow.get().setShopUserId(shopUser.getId());
|
||||||
flow.setShopUserId(shopUser.getId());
|
flow.get().setBizCode("cashMemberIn");
|
||||||
flow.setBizCode("cashMemberIn");
|
flow.get().setType("+");
|
||||||
flow.setType("+");
|
flow.get().setBizName("线下充值");
|
||||||
flow.setBizName("线下充值");
|
flow.get().setAmount(amount);
|
||||||
flow.setAmount(amount);
|
flow.get().setBalance(shopUser.getAmount());
|
||||||
flow.setBalance(shopUser.getAmount());
|
flow.get().setCreateTime(new Date());
|
||||||
flow.setCreateTime(new Date());
|
flow.get().setIsReturn("0");
|
||||||
flow.setIsReturn("0");
|
tbShopUserFlowMapper.insert(flow.get());
|
||||||
tbShopUserFlowMapper.insert(flow);
|
|
||||||
BigDecimal fl = null;
|
|
||||||
|
|
||||||
TbActivate activate = tbActivateMapper.selectByAmount(shopInfo.getId().toString(), memberIn.getAmount());
|
TbActivate activate = tbActivateMapper.selectByAmount(shopInfo.getId().toString(), memberIn.getAmount());
|
||||||
if (ObjectUtil.isNotEmpty(activate) && ObjectUtil.isNotNull(activate)) {
|
if (ObjectUtil.isNotEmpty(activate) && ObjectUtil.isNotNull(activate)) {
|
||||||
@@ -685,22 +688,24 @@ public class MemberService {
|
|||||||
shopUser.setUpdatedAt(System.currentTimeMillis());
|
shopUser.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbShopUserMapper.updateByPrimaryKeySelective(shopUser);
|
tbShopUserMapper.updateByPrimaryKeySelective(shopUser);
|
||||||
|
|
||||||
flow = new TbShopUserFlow();
|
flow.set(new TbShopUserFlow());
|
||||||
flow.setShopUserId(shopUser.getId());
|
flow.get().setShopUserId(shopUser.getId());
|
||||||
flow.setBizCode("scanMemberAwardIn");
|
flow.get().setBizCode("scanMemberAwardIn");
|
||||||
flow.setType("+");
|
flow.get().setType("+");
|
||||||
flow.setBizName("充值活动奖励");
|
flow.get().setBizName("充值活动奖励");
|
||||||
flow.setAmount(awardAmount);
|
flow.get().setAmount(awardAmount);
|
||||||
flow.setBalance(shopUser.getAmount());
|
flow.get().setBalance(shopUser.getAmount());
|
||||||
flow.setCreateTime(new Date());
|
flow.get().setCreateTime(new Date());
|
||||||
flow.setIsReturn("0");
|
flow.get().setIsReturn("0");
|
||||||
tbShopUserFlowMapper.insert(flow);
|
tbShopUserFlowMapper.insert(flow.get());
|
||||||
|
|
||||||
fl = awardAmount;
|
|
||||||
|
|
||||||
|
fl.set(awardAmount);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("token", token);
|
jsonObject.put("token", token);
|
||||||
jsonObject.put("type", "memberIn");
|
jsonObject.put("type", "memberIn");
|
||||||
@@ -712,10 +717,10 @@ public class MemberService {
|
|||||||
JSONObject baObj = new JSONObject();
|
JSONObject baObj = new JSONObject();
|
||||||
baObj.put("userId", shopUser.getUserId());
|
baObj.put("userId", shopUser.getUserId());
|
||||||
baObj.put("shopId", shopInfo.getId());
|
baObj.put("shopId", shopInfo.getId());
|
||||||
baObj.put("amount", ObjectUtil.isNull(fl) ? amount : amount.add(fl));
|
baObj.put("amount", ObjectUtil.isNull(fl) ? amount : amount.add(fl.get()));
|
||||||
baObj.put("balance", shopUser.getAmount());
|
baObj.put("balance", shopUser.getAmount());
|
||||||
baObj.put("type", "充值");
|
baObj.put("type", "充值");
|
||||||
baObj.put("time", flow.getCreateTime());
|
baObj.put("time", flow.get().getCreateTime());
|
||||||
producer.balance(baObj.toString());
|
producer.balance(baObj.toString());
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,6 @@ public class PayService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Result scanPay(String orderId, String authCode, String ip, String token, BigDecimal payAmount, BigDecimal discountAmount) {
|
public Result scanPay(String orderId, String authCode, String ip, String token, BigDecimal payAmount, BigDecimal discountAmount) {
|
||||||
if (ObjectUtil.isEmpty(orderId) || ObjectUtil.isEmpty(authCode) || ObjectUtil.isEmpty(ip)) {
|
if (ObjectUtil.isEmpty(orderId) || ObjectUtil.isEmpty(authCode) || ObjectUtil.isEmpty(ip)) {
|
||||||
return Result.fail(CodeEnum.PARAM);
|
return Result.fail(CodeEnum.PARAM);
|
||||||
@@ -230,9 +229,9 @@ public class PayService {
|
|||||||
return Result.fail(CodeEnum.NOCUSTOMER);
|
return Result.fail(CodeEnum.NOCUSTOMER);
|
||||||
}
|
}
|
||||||
|
|
||||||
String payType = null;
|
String payType;
|
||||||
String payName = null;
|
String payName;
|
||||||
String qpay = null;
|
String qpay;
|
||||||
|
|
||||||
String payTypeCode = authCode.substring(0, 2);// 判断收款码
|
String payTypeCode = authCode.substring(0, 2);// 判断收款码
|
||||||
|
|
||||||
@@ -245,19 +244,25 @@ public class PayService {
|
|||||||
payType = "wechatPay";
|
payType = "wechatPay";
|
||||||
payName = "微信支付";
|
payName = "微信支付";
|
||||||
qpay = "scanCode";
|
qpay = "scanCode";
|
||||||
} else if ("62".equals(payTypeCode)) {
|
} else {
|
||||||
|
qpay = null;
|
||||||
|
payType = null;
|
||||||
|
payName = null;
|
||||||
|
if ("62".equals(payTypeCode)) {
|
||||||
return Result.fail(CodeEnum.ERRORQR);
|
return Result.fail(CodeEnum.ERRORQR);
|
||||||
} else if ("01".equals(payTypeCode)) {
|
} else if ("01".equals(payTypeCode)) {
|
||||||
return Result.fail(CodeEnum.ERRORQR);
|
return Result.fail(CodeEnum.ERRORQR);
|
||||||
} else {
|
} else {
|
||||||
return Result.fail(CodeEnum.ERRORQR);
|
return Result.fail(CodeEnum.ERRORQR);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int count = tbShopPayTypeMapper.countSelectByShopIdAndPayType(orderInfo.getShopId(), qpay);
|
int count = tbShopPayTypeMapper.countSelectByShopIdAndPayType(orderInfo.getShopId(), qpay);
|
||||||
if (count < 1) {
|
if (count < 1) {
|
||||||
return Result.fail(CodeEnum.PAYTYPENOEXIST);
|
return Result.fail(CodeEnum.PAYTYPENOEXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utils.runFunAndTransactional(() -> {
|
||||||
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(orderId);
|
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(orderId);
|
||||||
if (ObjectUtil.isEmpty(payment) || payment == null) {
|
if (ObjectUtil.isEmpty(payment) || payment == null) {
|
||||||
payment = new TbOrderPayment();
|
payment = new TbOrderPayment();
|
||||||
@@ -412,16 +417,33 @@ public class PayService {
|
|||||||
log.info("更新购物车:{}", cartCount);
|
log.info("更新购物车:{}", cartCount);
|
||||||
|
|
||||||
if (ObjectUtil.isNotNull(orderInfo.getDiscountRatio()) && ObjectUtil.isNotEmpty(orderInfo.getDiscountRatio())) {
|
if (ObjectUtil.isNotNull(orderInfo.getDiscountRatio()) && ObjectUtil.isNotEmpty(orderInfo.getDiscountRatio())) {
|
||||||
tbOrderDetailMapper.updateStatusByOrderId(Integer.valueOf(orderId), "closed", orderInfo.getDiscountRatio());
|
tbOrderDetailMapper.updateStatusByOrderId(Integer.parseInt(orderId), "closed", orderInfo.getDiscountRatio());
|
||||||
} else {
|
} else {
|
||||||
tbOrderDetailMapper.updateStatusByOrderId(Integer.valueOf(orderId), "closed", null);
|
tbOrderDetailMapper.updateStatusByOrderId(Integer.parseInt(orderId), "closed", null);
|
||||||
}
|
}
|
||||||
|
} else if ("TRADE_AWAIT".equals(mainScanResp.getState())) {
|
||||||
|
payment.setTradeNumber(mainScanResp.getPayOrderId());
|
||||||
|
log.info("支付中2:{}", JSON.toJSONString(payment));
|
||||||
|
orderInfo.setStatus("paying");
|
||||||
|
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
||||||
|
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||||
|
int cartCount = tbCashierCartMapper.updateByOrderId(orderId, "final");
|
||||||
|
|
||||||
|
payment.setUpdatedAt(System.currentTimeMillis());
|
||||||
|
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("token", token);
|
jsonObject.put("token", token);
|
||||||
jsonObject.put("type", "create");
|
jsonObject.put("type", "create");
|
||||||
jsonObject.put("orderId", orderId);
|
jsonObject.put("orderId", orderId);
|
||||||
|
|
||||||
producer.putOrderCollect(jsonObject.toJSONString());
|
producer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
// 打印消息
|
// 打印消息
|
||||||
@@ -439,42 +461,7 @@ public class PayService {
|
|||||||
redisUtil.del(tableCartKey);
|
redisUtil.del(tableCartKey);
|
||||||
clearTableInfoCache(orderInfo);
|
clearTableInfoCache(orderInfo);
|
||||||
|
|
||||||
return Result.success(CodeEnum.SUCCESS, mainScanResp);
|
return Result.success(SUCCESS);
|
||||||
} else if ("TRADE_AWAIT".equals(mainScanResp.getState())) {
|
|
||||||
payment.setTradeNumber(mainScanResp.getPayOrderId());
|
|
||||||
log.info("支付中2:{}", JSON.toJSONString(payment));
|
|
||||||
orderInfo.setStatus("paying");
|
|
||||||
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
|
||||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
|
||||||
int cartCount = tbCashierCartMapper.updateByOrderId(orderId, "final");
|
|
||||||
|
|
||||||
|
|
||||||
payment.setUpdatedAt(System.currentTimeMillis());
|
|
||||||
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
|
|
||||||
|
|
||||||
// 打印结算单
|
|
||||||
// 打印消息
|
|
||||||
if (!OrderUseTypeEnum.DINE_IN_AFTER.getValue().equals(orderInfo.getUseType())) {
|
|
||||||
List<TbOrderDetail> detailList = mPOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
|
||||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
|
||||||
.eq(TbOrderDetail::getStatus, "closed"));
|
|
||||||
rabbitMsgUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
|
||||||
}
|
|
||||||
rabbitMsgUtils.printPlaceTicket(orderInfo.getId(), false);
|
|
||||||
String tableCartKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(),
|
|
||||||
orderInfo.getShopId());
|
|
||||||
redisUtil.del(tableCartKey);
|
|
||||||
clearTableInfoCache(orderInfo);
|
|
||||||
|
|
||||||
return Result.success(CodeEnum.PAYING);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return Result.fail("失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result queryOrder(String orderId, String token) {
|
public Result queryOrder(String orderId, String token) {
|
||||||
@@ -567,7 +554,6 @@ public class PayService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Result accountPay(String orderId, String memberId, String token, String memberAccount, BigDecimal payAmount, BigDecimal discountAmount) {
|
public Result accountPay(String orderId, String memberId, String token, String memberAccount, BigDecimal payAmount, BigDecimal discountAmount) {
|
||||||
if (ObjectUtil.isEmpty(orderId)) {
|
if (ObjectUtil.isEmpty(orderId)) {
|
||||||
if (ObjectUtil.isEmpty(memberAccount)) {
|
if (ObjectUtil.isEmpty(memberAccount)) {
|
||||||
@@ -628,7 +614,6 @@ public class PayService {
|
|||||||
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(memberAccount)) {
|
if (ObjectUtil.isNotEmpty(memberAccount)) {
|
||||||
|
|
||||||
if (!memberAccount.startsWith("46")) {
|
if (!memberAccount.startsWith("46")) {
|
||||||
return Result.fail(CodeEnum.ERRORQR);
|
return Result.fail(CodeEnum.ERRORQR);
|
||||||
}
|
}
|
||||||
@@ -645,7 +630,6 @@ public class PayService {
|
|||||||
if (N.gt(orderInfo.getOrderAmount(), user.getAmount())) {
|
if (N.gt(orderInfo.getOrderAmount(), user.getAmount())) {
|
||||||
return Result.fail(CodeEnum.MEMBERINSUFFICIENTFUNDS);
|
return Result.fail(CodeEnum.MEMBERINSUFFICIENTFUNDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(payAmount) || ObjectUtil.isNull(payAmount)) {
|
if (ObjectUtil.isEmpty(payAmount) || ObjectUtil.isNull(payAmount)) {
|
||||||
payAmount = orderInfo.getOrderAmount();
|
payAmount = orderInfo.getOrderAmount();
|
||||||
}
|
}
|
||||||
@@ -653,27 +637,28 @@ public class PayService {
|
|||||||
user.setConsumeAmount(user.getConsumeAmount().add(payAmount));
|
user.setConsumeAmount(user.getConsumeAmount().add(payAmount));
|
||||||
user.setConsumeNumber(user.getConsumeNumber() + 1);
|
user.setConsumeNumber(user.getConsumeNumber() + 1);
|
||||||
user.setUpdatedAt(System.currentTimeMillis());
|
user.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbShopUserMapper.updateByPrimaryKeySelective(user);
|
TbShopUser finalUser = user;
|
||||||
|
BigDecimal finalPayAmount = payAmount;
|
||||||
|
|
||||||
TbShopUserFlow flow = new TbShopUserFlow();
|
TbShopUserFlow flow = new TbShopUserFlow();
|
||||||
flow.setShopUserId(user.getId());
|
utils.runFunAndTransactional(() -> {
|
||||||
|
tbShopUserMapper.updateByPrimaryKeySelective(finalUser);
|
||||||
|
flow.setShopUserId(finalUser.getId());
|
||||||
flow.setBizCode("accountPay");
|
flow.setBizCode("accountPay");
|
||||||
flow.setBizName("余额支付");
|
flow.setBizName("余额支付");
|
||||||
flow.setType("-");
|
flow.setType("-");
|
||||||
flow.setAmount(payAmount);
|
flow.setAmount(finalPayAmount);
|
||||||
flow.setBalance(user.getAmount());
|
flow.setBalance(finalUser.getAmount());
|
||||||
flow.setCreateTime(new Date());
|
flow.setCreateTime(new Date());
|
||||||
flow.setIsReturn("0");
|
flow.setIsReturn("0");
|
||||||
tbShopUserFlowMapper.insert(flow);
|
tbShopUserFlowMapper.insert(flow);
|
||||||
|
|
||||||
|
|
||||||
orderInfo.setPayAmount(ObjectUtil.isEmpty(payAmount) ? orderInfo.getOrderAmount() : payAmount);
|
orderInfo.setPayAmount(ObjectUtil.isEmpty(finalPayAmount) ? orderInfo.getOrderAmount() : finalPayAmount);
|
||||||
orderInfo.setDiscountAmount(ObjectUtil.isEmpty(discountAmount) ? null : discountAmount);
|
orderInfo.setDiscountAmount(ObjectUtil.isEmpty(discountAmount) ? null : discountAmount);
|
||||||
orderInfo.setDiscountRatio(ObjectUtil.isNotEmpty(payAmount) ? payAmount.divide(orderInfo.getOrderAmount(), 2, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_DOWN) : null);
|
orderInfo.setDiscountRatio(ObjectUtil.isNotEmpty(finalPayAmount) ? finalPayAmount.divide(orderInfo.getOrderAmount(), 2, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_DOWN) : null);
|
||||||
orderInfo.setStaffId(ObjectUtil.isEmpty(staff) ? null : staff.getId());
|
orderInfo.setStaffId(ObjectUtil.isEmpty(staff) ? null : staff.getId());
|
||||||
orderInfo.setUserId(user.getUserId());
|
orderInfo.setUserId(finalUser.getUserId());
|
||||||
orderInfo.setMemberId(user.getId().toString());
|
orderInfo.setMemberId(finalUser.getId().toString());
|
||||||
orderInfo.setPayType("deposit");
|
orderInfo.setPayType("deposit");
|
||||||
orderInfo.setStatus("closed");
|
orderInfo.setStatus("closed");
|
||||||
orderInfo.setPayOrderNo("deposit".concat(SnowFlakeUtil.generateOrderNo()));
|
orderInfo.setPayOrderNo("deposit".concat(SnowFlakeUtil.generateOrderNo()));
|
||||||
@@ -682,15 +667,15 @@ public class PayService {
|
|||||||
int cartCount = tbCashierCartMapper.updateByOrderId(orderId, "final");
|
int cartCount = tbCashierCartMapper.updateByOrderId(orderId, "final");
|
||||||
|
|
||||||
if (ObjectUtil.isNotNull(orderInfo.getDiscountRatio()) && ObjectUtil.isNotEmpty(orderInfo.getDiscountRatio())) {
|
if (ObjectUtil.isNotNull(orderInfo.getDiscountRatio()) && ObjectUtil.isNotEmpty(orderInfo.getDiscountRatio())) {
|
||||||
tbOrderDetailMapper.updateStatusByOrderId(Integer.valueOf(orderId), "closed", orderInfo.getDiscountRatio());
|
tbOrderDetailMapper.updateStatusByOrderId(Integer.parseInt(orderId), "closed", orderInfo.getDiscountRatio());
|
||||||
} else {
|
} else {
|
||||||
tbOrderDetailMapper.updateStatusByOrderId(Integer.valueOf(orderId), "closed", null);
|
tbOrderDetailMapper.updateStatusByOrderId(Integer.parseInt(orderId), "closed", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
log.info("更新购物车:{}", cartCount);
|
log.info("更新购物车:{}", cartCount);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("token", token);
|
jsonObject.put("token", token);
|
||||||
jsonObject.put("type", "create");
|
jsonObject.put("type", "create");
|
||||||
@@ -905,6 +890,7 @@ public class PayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
utils.runFunAndTransactional(() -> {
|
||||||
TbShopUserFlow userFlow = new TbShopUserFlow();
|
TbShopUserFlow userFlow = new TbShopUserFlow();
|
||||||
userFlow.setAmount((payAmount != null && discountAmount != null) ? payAmount : orderInfo.getOrderAmount());
|
userFlow.setAmount((payAmount != null && discountAmount != null) ? payAmount : orderInfo.getOrderAmount());
|
||||||
userFlow.setBalance(shopUser.getAmount().subtract((payAmount != null && discountAmount != null) ? payAmount : orderInfo.getOrderAmount()));
|
userFlow.setBalance(shopUser.getAmount().subtract((payAmount != null && discountAmount != null) ? payAmount : orderInfo.getOrderAmount()));
|
||||||
@@ -941,6 +927,9 @@ public class PayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.info("更新购物车:{}", cartCount);
|
log.info("更新购物车:{}", cartCount);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("token", token);
|
jsonObject.put("token", token);
|
||||||
@@ -1036,9 +1025,6 @@ public class PayService {
|
|||||||
return orderInfo;
|
return orderInfo;
|
||||||
});
|
});
|
||||||
|
|
||||||
log.info("事务已提交");
|
|
||||||
ThreadUtil.sleep(10, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("token", token);
|
jsonObject.put("token", token);
|
||||||
jsonObject.put("type", "create");
|
jsonObject.put("type", "create");
|
||||||
|
|||||||
Reference in New Issue
Block a user