|
@@ -150,8 +150,8 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @DataSource(DataSourceType.SLAVE)
|
|
|
@DSTransactional
|
|
|
+ @DataSource(DataSourceType.SLAVE)
|
|
|
public HttpRet<Boolean> transfer(AppUserTeamTranserDto transfer) {
|
|
|
AppUser toAppUser = appUserService.selectAppUserByUserid(transfer.getToUserId());
|
|
|
AppUser appUser = appUserService.selectAppUserByUserid(SecurityUtils.getUserId());
|
|
@@ -175,7 +175,7 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
|
|
|
queryWrapper.eq(FinTranRecord::getFromUid,SecurityUtils.getUserId());
|
|
|
queryWrapper.eq(FinTranRecord::getTranType1,FinTranType1.U_Outcome_Coin.getType());
|
|
|
queryWrapper.eq(FinTranRecord::getTranType3,FinTranType3.TRANSFER_TO_TEAM_DiamondCoin.getType());
|
|
|
- List<FinTranRecord> finTranRecords = finTranRecordMapper.selectList(queryWrapper);
|
|
|
+ List<FinTranRecord> finTranRecords = finTranRecordService.selecListByWrapper(queryWrapper);
|
|
|
if(null != finTranRecords && finTranRecords.size()>0){
|
|
|
double curMoney = finTranRecords.stream().mapToDouble(FinTranRecord::getDiamondCoinChange).sum();
|
|
|
if(curMoney >= limit){
|
|
@@ -197,6 +197,7 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
|
|
|
tran.setDiamondCoinChange(transfer.getMoney() * -1);
|
|
|
tran.setAfterDiamondCoin(appUser.getDiamondCoin() + transfer.getMoney());
|
|
|
tran.setCurrencyType(TranCurrencyType.Balance.getType());
|
|
|
+ tran.setRemarks("团队转账");
|
|
|
finTranRecordService.insertFinTranRecord(tran);
|
|
|
|
|
|
|
|
@@ -214,6 +215,7 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
|
|
|
toTran.setAfterDiamondCoin(appUser.getDiamondCoin() + transfer.getMoney());
|
|
|
toTran.setCurrencyType(TranCurrencyType.Balance.getType());
|
|
|
toTran.setFromUid(appUser.getUserid());
|
|
|
+ tran.setRemarks("团队转账");
|
|
|
finTranRecordService.insertFinTranRecord(toTran);
|
|
|
|
|
|
redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(appUser.getUserid())));
|
|
@@ -222,20 +224,22 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @DataSource(DataSourceType.SLAVE)
|
|
|
public List<FinTranRecord> transferRecord(AppUserTeamTranserRecordDto transerRecordDto) {
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
LambdaQueryWrapper<FinTranRecord> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.between(FinTranRecord::getCreateTime,transerRecordDto.getBeginTime(),transerRecordDto.getEndTime());
|
|
|
+ queryWrapper.between(FinTranRecord::getCreateTime,transerRecordDto.getBeginTime().concat(" 00:00:00"),transerRecordDto.getEndTime().concat(" 23:59:59"));
|
|
|
queryWrapper.eq(FinTranRecord::getTranType3,FinTranType3.TRANSFER_TO_TEAM_DiamondCoin.getType());
|
|
|
- queryWrapper.eq(FinTranRecord::getTranType1,FinTranType1.U_Income_Coin_Balance);
|
|
|
+ queryWrapper.eq(FinTranRecord::getTranType1,FinTranType1.U_Income_Coin_Balance.getType());
|
|
|
if(transerRecordDto.getType() == 0){
|
|
|
|
|
|
- queryWrapper.eq(FinTranRecord::getFromUid,SecurityUtils.getUserId());
|
|
|
+ queryWrapper.eq(FinTranRecord::getFromUid,userId);
|
|
|
if(null != transerRecordDto.getUserId()){
|
|
|
queryWrapper.eq(FinTranRecord::getToUid,transerRecordDto.getUserId());
|
|
|
}
|
|
|
}else if(transerRecordDto.getType() == 1){
|
|
|
|
|
|
- queryWrapper.eq(FinTranRecord::getToUid,SecurityUtils.getUserId());
|
|
|
+ queryWrapper.eq(FinTranRecord::getToUid,userId);
|
|
|
if(null != transerRecordDto.getUserId()){
|
|
|
queryWrapper.eq(FinTranRecord::getFromUid,transerRecordDto.getUserId());
|
|
|
}
|
|
@@ -243,4 +247,11 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
|
|
|
List<FinTranRecord> list = finTranRecordMapper.selectList(queryWrapper);
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+ @DataSource(DataSourceType.SLAVE)
|
|
|
+ @Override
|
|
|
+ public List<FinTranRecord> selecListByWrapper(LambdaQueryWrapper<FinTranRecord> queryWrapper){
|
|
|
+ List<FinTranRecord> list = finTranRecordMapper.selectList(queryWrapper);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
}
|