mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-27 01:30:51 +00:00
fix: bug
This commit is contained in:
parent
7bbabb3492
commit
4665b5c4b9
@ -35,7 +35,8 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
@Override
|
@Override
|
||||||
public Long createPayOrder(Byte payChannel, Integer payAmount, Long userId) {
|
public Long createPayOrder(Byte payChannel, Integer payAmount, Long userId) {
|
||||||
Date currentDate = new Date();
|
Date currentDate = new Date();
|
||||||
Long outTradeNo = Long.parseLong(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(currentDate)+new Random().nextInt(10));
|
Long outTradeNo = Long.parseLong(
|
||||||
|
new SimpleDateFormat("yyyyMMddHHmmssSSS").format(currentDate) + new Random().nextInt(10));
|
||||||
OrderPay orderPay = new OrderPay();
|
OrderPay orderPay = new OrderPay();
|
||||||
orderPay.setOutTradeNo(outTradeNo);
|
orderPay.setOutTradeNo(outTradeNo);
|
||||||
orderPay.setPayChannel(payChannel);
|
orderPay.setPayChannel(payChannel);
|
||||||
@ -50,15 +51,17 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public void updatePayOrder(Long outTradeNo, String tradeNo, String tradeStatus) {
|
public void updatePayOrder(Long outTradeNo, String tradeNo, String tradeStatus) {
|
||||||
SelectStatementProvider selectStatement = select(OrderPayDynamicSqlSupport.id,OrderPayDynamicSqlSupport.payStatus,OrderPayDynamicSqlSupport.totalAmount,OrderPayDynamicSqlSupport.userId)
|
SelectStatementProvider selectStatement = select(OrderPayDynamicSqlSupport.id,
|
||||||
.from(OrderPayDynamicSqlSupport.orderPay)
|
OrderPayDynamicSqlSupport.payStatus, OrderPayDynamicSqlSupport.totalAmount,
|
||||||
.where(OrderPayDynamicSqlSupport.outTradeNo, isEqualTo(outTradeNo))
|
OrderPayDynamicSqlSupport.userId)
|
||||||
.build()
|
.from(OrderPayDynamicSqlSupport.orderPay)
|
||||||
.render(RenderingStrategies.MYBATIS3);
|
.where(OrderPayDynamicSqlSupport.outTradeNo, isEqualTo(outTradeNo))
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3);
|
||||||
|
|
||||||
OrderPay orderPay = orderPayMapper.selectMany(selectStatement).get(0);
|
OrderPay orderPay = orderPayMapper.selectMany(selectStatement).get(0);
|
||||||
|
|
||||||
if(orderPay.getPayStatus()!=1) {
|
if (orderPay.getPayStatus().intValue() != 1) {
|
||||||
//此订单还未处理过
|
//此订单还未处理过
|
||||||
|
|
||||||
if (tradeStatus.equals("TRADE_SUCCESS") || tradeStatus.equals("TRADE_FINISHED")) {
|
if (tradeStatus.equals("TRADE_SUCCESS") || tradeStatus.equals("TRADE_FINISHED")) {
|
||||||
@ -69,17 +72,12 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
orderPayMapper.updateByPrimaryKeySelective(orderPay);
|
orderPayMapper.updateByPrimaryKeySelective(orderPay);
|
||||||
|
|
||||||
//2.增加用户余额
|
//2.增加用户余额
|
||||||
userService.addAmount(orderPay.getUserId(),orderPay.getTotalAmount()*100);
|
userService.addAmount(orderPay.getUserId(), orderPay.getTotalAmount() * 100);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user