yujian
2019-09-20 7ad7905f32ef6b2d67bbd45260a0413be904fa8d
fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralTaskRecordServiceImpl.java
@@ -190,9 +190,9 @@
   }
   @Override
   @Transactional
   @Transactional(rollbackFor=Exception.class)
   public Integer receiveGoldCoinALL(Long uid) throws IntegralTaskRecordException {
      UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
      UserInfoExtra userInfoExtra = userInfoExtraService.getByUidForUpdate(uid);
      if (userInfoExtra == null)
         throw new IntegralTaskRecordException(1, "用户信息不全");
@@ -205,31 +205,27 @@
         if (addDetail(uid, record))
            totalGoldCoin += record.getGoldCoin();
      }
      Integer goldCoin = userInfoExtra.getGoldCoin();
      if (goldCoin == null)
         goldCoin = 0;
      UserInfoExtra extra = new UserInfoExtra();
      extra.setId(userInfoExtra.getId());
      extra.setGoldCoin(goldCoin + totalGoldCoin);
      try {
         userInfoExtraService.saveUserInfoExtra(extra);
      } catch (UserInfoExtraException e) {
         throw new IntegralTaskRecordException(1, "用户信息不全");
      }
      return extra.getGoldCoin();
      goldCoin = goldCoin + totalGoldCoin;
      // 更新金币
      userInfoExtraService.updateGoldCoin(userInfoExtra.getId(), goldCoin);
      return goldCoin;
   }
   @Override
   @Transactional
   @Override
   @Transactional(rollbackFor=Exception.class)
   public Integer receiveGoldCoin(Long uid, Set<Long> idList) throws IntegralTaskRecordException {
      if (idList == null || idList.size() == 0) {
         throw new IntegralTaskRecordException(1, "id为空");
      }
      UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
      UserInfoExtra userInfoExtra = userInfoExtraService.getByUidForUpdate(uid);
      if (userInfoExtra == null) {
         throw new IntegralTaskRecordException(1, "用户信息不全");
      }
@@ -248,25 +244,21 @@
         if (addDetail(uid, record))
            totalGoldCoin += record.getGoldCoin();
      }
      Integer goldCoin = userInfoExtra.getGoldCoin();
      if (goldCoin == null)
         goldCoin = 0;
      UserInfoExtra extra = new UserInfoExtra();
      extra.setId(userInfoExtra.getId());
      extra.setGoldCoin(goldCoin + totalGoldCoin);
      try {
         userInfoExtraService.saveUserInfoExtra(extra);
      } catch (UserInfoExtraException e) {
         throw new IntegralTaskRecordException(1, "用户信息不全");
      }
      goldCoin = goldCoin + totalGoldCoin;
      // 更新金币
      userInfoExtraService.updateGoldCoin(userInfoExtra.getId(), goldCoin);
      return extra.getGoldCoin();
      return goldCoin;
   }
   @Transactional
   public boolean addDetail(Long uid, IntegralTaskRecord record) throws IntegralTaskRecordException {
      Long uid2 = record.getUid();
      if (uid2 == null || uid.longValue() != uid2.longValue())
         return false; // 用户id不符合