|
@@ -77,58 +77,60 @@ public class AppUserCountServiceImpl extends ServiceImpl<AppUserCountMapper, App
|
|
|
|
|
|
@Transactional
|
|
|
public void createAppUserCount(AppUserCount appUserCount) {
|
|
|
-
|
|
|
- LambdaQueryWrapper<AppUserCount> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(AppUserCount::getStrDate,appUserCount.getStrDate());
|
|
|
- queryWrapper.eq(AppUserCount::getUserId,appUserCount.getUserId());
|
|
|
- AppUserCount userCount = appUserCountMapper.selectOne(queryWrapper);
|
|
|
- int res = 0;
|
|
|
- if(userCount==null) {
|
|
|
- appUserCount.setCreateTime(new Date());
|
|
|
- appUserCount.setUpdateTime(new Date());
|
|
|
- res = appUserCountMapper.insert(appUserCount);
|
|
|
- }else{
|
|
|
- appUserCount.setId(userCount.getId());
|
|
|
-
|
|
|
+ synchronized ("app_user_count_".concat(String.valueOf(appUserCount.getUserId()))) {
|
|
|
+
|
|
|
+ LambdaQueryWrapper<AppUserCount> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(AppUserCount::getStrDate, appUserCount.getStrDate());
|
|
|
+ queryWrapper.eq(AppUserCount::getUserId, appUserCount.getUserId());
|
|
|
+ AppUserCount userCount = appUserCountMapper.selectOne(queryWrapper);
|
|
|
+ int res = 0;
|
|
|
+ if (userCount == null) {
|
|
|
+ appUserCount.setCreateTime(new Date());
|
|
|
appUserCount.setUpdateTime(new Date());
|
|
|
- }*/
|
|
|
- if(!appUserCount.isUpdate()) {
|
|
|
-
|
|
|
- if (appUserCount.getRechargeAmount() != null) {
|
|
|
- appUserCount.setRechargeAmount(userCount.getRechargeAmount() + appUserCount.getRechargeAmount());
|
|
|
- }
|
|
|
- if (appUserCount.getRechargeCommission() != null) {
|
|
|
- appUserCount.setRechargeCommission(userCount.getRechargeCommission() + appUserCount.getRechargeCommission());
|
|
|
- }
|
|
|
- if (appUserCount.getRechargeGive() != null) {
|
|
|
- appUserCount.setRechargeGive(userCount.getRechargeGive() + appUserCount.getRechargeGive());
|
|
|
- }
|
|
|
- if (appUserCount.getWithdrawalCommission() != null) {
|
|
|
- appUserCount.setWithdrawalAmount(userCount.getWithdrawalAmount() + appUserCount.getWithdrawalAmount());
|
|
|
- }
|
|
|
- if (appUserCount.getWithdrawalCommission() != null) {
|
|
|
- appUserCount.setWithdrawalCommission(userCount.getWithdrawalCommission() + appUserCount.getWithdrawalCommission());
|
|
|
- }
|
|
|
- if (appUserCount.getLiveUseAmount() != null) {
|
|
|
- appUserCount.setLiveUseAmount(userCount.getLiveUseAmount() + appUserCount.getLiveUseAmount());
|
|
|
- }
|
|
|
- if (appUserCount.getLiveCommission() != null) {
|
|
|
- appUserCount.setLiveCommission(userCount.getLiveCommission() + appUserCount.getLiveCommission());
|
|
|
- }
|
|
|
- if (appUserCount.getGameWinAmount() != null) {
|
|
|
- appUserCount.setGameWinAmount(userCount.getGameWinAmount() + appUserCount.getGameWinAmount());
|
|
|
- }
|
|
|
- if (appUserCount.getGameLoseAmount() != null) {
|
|
|
- appUserCount.setGameLoseAmount(userCount.getGameLoseAmount() + appUserCount.getGameLoseAmount());
|
|
|
- }
|
|
|
- if (appUserCount.getGameCommission() != null) {
|
|
|
- appUserCount.setGameCommission(userCount.getGameCommission() + appUserCount.getGameCommission());
|
|
|
- }
|
|
|
- if (appUserCount.getGameBetting() != null) {
|
|
|
- appUserCount.setGameBetting(userCount.getGameBetting() + appUserCount.getGameBetting());
|
|
|
+ res = appUserCountMapper.insert(appUserCount);
|
|
|
+ } else {
|
|
|
+ appUserCount.setId(userCount.getId());
|
|
|
+
|
|
|
+ appUserCount.setUpdateTime(new Date());
|
|
|
+ }*/
|
|
|
+ if (!appUserCount.isUpdate()) {
|
|
|
+
|
|
|
+ if (appUserCount.getRechargeAmount() != null) {
|
|
|
+ appUserCount.setRechargeAmount(userCount.getRechargeAmount() + appUserCount.getRechargeAmount());
|
|
|
+ }
|
|
|
+ if (appUserCount.getRechargeCommission() != null) {
|
|
|
+ appUserCount.setRechargeCommission(userCount.getRechargeCommission() + appUserCount.getRechargeCommission());
|
|
|
+ }
|
|
|
+ if (appUserCount.getRechargeGive() != null) {
|
|
|
+ appUserCount.setRechargeGive(userCount.getRechargeGive() + appUserCount.getRechargeGive());
|
|
|
+ }
|
|
|
+ if (appUserCount.getWithdrawalCommission() != null) {
|
|
|
+ appUserCount.setWithdrawalAmount(userCount.getWithdrawalAmount() + appUserCount.getWithdrawalAmount());
|
|
|
+ }
|
|
|
+ if (appUserCount.getWithdrawalCommission() != null) {
|
|
|
+ appUserCount.setWithdrawalCommission(userCount.getWithdrawalCommission() + appUserCount.getWithdrawalCommission());
|
|
|
+ }
|
|
|
+ if (appUserCount.getLiveUseAmount() != null) {
|
|
|
+ appUserCount.setLiveUseAmount(userCount.getLiveUseAmount() + appUserCount.getLiveUseAmount());
|
|
|
+ }
|
|
|
+ if (appUserCount.getLiveCommission() != null) {
|
|
|
+ appUserCount.setLiveCommission(userCount.getLiveCommission() + appUserCount.getLiveCommission());
|
|
|
+ }
|
|
|
+ if (appUserCount.getGameWinAmount() != null) {
|
|
|
+ appUserCount.setGameWinAmount(userCount.getGameWinAmount() + appUserCount.getGameWinAmount());
|
|
|
+ }
|
|
|
+ if (appUserCount.getGameLoseAmount() != null) {
|
|
|
+ appUserCount.setGameLoseAmount(userCount.getGameLoseAmount() + appUserCount.getGameLoseAmount());
|
|
|
+ }
|
|
|
+ if (appUserCount.getGameCommission() != null) {
|
|
|
+ appUserCount.setGameCommission(userCount.getGameCommission() + appUserCount.getGameCommission());
|
|
|
+ }
|
|
|
+ if (appUserCount.getGameBetting() != null) {
|
|
|
+ appUserCount.setGameBetting(userCount.getGameBetting() + appUserCount.getGameBetting());
|
|
|
+ }
|
|
|
}
|
|
|
+ res = appUserCountMapper.updateById(appUserCount);
|
|
|
}
|
|
|
- res = appUserCountMapper.updateById(appUserCount);
|
|
|
}
|
|
|
}
|
|
|
|