|
@@ -33,24 +33,30 @@ public class UserGalaxyCoinServiceImpl implements UserGalaxyCoinService {
|
|
|
@Override
|
|
@Override
|
|
|
public void sendGalaxyCoinRecord(Long userId, Integer galaxyCoin, String remark, Boolean isLottery) {
|
|
public void sendGalaxyCoinRecord(Long userId, Integer galaxyCoin, String remark, Boolean isLottery) {
|
|
|
if (!isLottery) {
|
|
if (!isLottery) {
|
|
|
- if (galaxyCoin <= 0) {
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ sendGalaxyCoinHandle(userId, null, galaxyCoin, remark, true);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void sendGalaxyCoinHandle(Long userId, Long orderId, Integer galaxyCoin, String remark, Boolean isRecord) {
|
|
|
|
|
+ if (galaxyCoin <= 0) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ while (true) {
|
|
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
|
|
+ if (user == null) {
|
|
|
|
|
+ log.error("用户:{}不存在,无法发送银河币", userId);
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
- while (true) {
|
|
|
|
|
- User user = userMapper.selectById(userId);
|
|
|
|
|
- if (user == null) {
|
|
|
|
|
- log.error("用户:{}不存在,无法发送银河币", userId);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- BigDecimal userGalaxyCoin = user.getGalaxyCoin();
|
|
|
|
|
- int update = userMapper.update(null, Wrappers.lambdaUpdate(User.class)
|
|
|
|
|
- .set(User::getGalaxyCoin, userGalaxyCoin.add(BigDecimal.valueOf(galaxyCoin)))
|
|
|
|
|
- .eq(User::getId, user.getId())
|
|
|
|
|
- .eq(User::getGalaxyCoin, userGalaxyCoin));
|
|
|
|
|
- if (update == 1) {
|
|
|
|
|
- recordSendGalaxyCoin(userId, galaxyCoin, remark);
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ BigDecimal userGalaxyCoin = user.getGalaxyCoin();
|
|
|
|
|
+ int update = userMapper.update(null, Wrappers.lambdaUpdate(User.class)
|
|
|
|
|
+ .set(User::getGalaxyCoin, userGalaxyCoin.add(BigDecimal.valueOf(galaxyCoin)))
|
|
|
|
|
+ .eq(User::getId, user.getId())
|
|
|
|
|
+ .eq(User::getGalaxyCoin, userGalaxyCoin));
|
|
|
|
|
+ if (update == 1) {
|
|
|
|
|
+ if (isRecord) {
|
|
|
|
|
+ recordUseRecord(userId, orderId, BigDecimal.valueOf(galaxyCoin), remark);
|
|
|
}
|
|
}
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -97,13 +103,8 @@ public class UserGalaxyCoinServiceImpl implements UserGalaxyCoinService {
|
|
|
log.info("该笔订单:{}银河币有效期:{}已过", orderId, userGalaxyCoinRecord.getExpiryTime());
|
|
log.info("该笔订单:{}银河币有效期:{}已过", orderId, userGalaxyCoinRecord.getExpiryTime());
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- recordUseRecord(orderId, userId, galaxyCoin, PointsRecordConst.ORDER_REFUND);
|
|
|
|
|
|
|
+ //发送银河币
|
|
|
|
|
+ sendGalaxyCoinHandle(userId, orderId, galaxyCoin.intValue(), PointsRecordConst.ORDER_REFUND, true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 记录发送银河币
|
|
|
|
|
- */
|
|
|
|
|
- private void recordSendGalaxyCoin(Long userId, Integer galaxyCoin, String remark) {
|
|
|
|
|
- recordUseRecord(null, userId, BigDecimal.valueOf(galaxyCoin), remark);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|