|
@@ -31,6 +31,7 @@ import com.game.common.enums.DataSourceType;
|
|
import com.game.common.utils.DateUtils;
|
|
import com.game.common.utils.DateUtils;
|
|
import com.game.common.utils.SecurityUtils;
|
|
import com.game.common.utils.SecurityUtils;
|
|
import com.game.common.utils.StringUtils;
|
|
import com.game.common.utils.StringUtils;
|
|
|
|
+import com.game.system.service.ISysConfigService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import com.game.business.mapper.FinTranRecordMapper;
|
|
import com.game.business.mapper.FinTranRecordMapper;
|
|
@@ -65,6 +66,9 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
|
|
@Autowired
|
|
@Autowired
|
|
private AppUserCountTask appUserCountTask;
|
|
private AppUserCountTask appUserCountTask;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISysConfigService configService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询消费记录
|
|
* 查询消费记录
|
|
*
|
|
*
|
|
@@ -166,7 +170,7 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
|
|
if(null == toAppUser){
|
|
if(null == toAppUser){
|
|
return HttpRet.fail("受益用户不存在");
|
|
return HttpRet.fail("受益用户不存在");
|
|
}
|
|
}
|
|
- if(appUser.getDiamondCoinCash().longValue() < transfer.getMoney().longValue()){
|
|
|
|
|
|
+ if(appUser.getDiamondCoin().longValue() < transfer.getMoney().longValue()){
|
|
return HttpRet.fail("可转账金额不足");
|
|
return HttpRet.fail("可转账金额不足");
|
|
}
|
|
}
|
|
if(StringUtils.isBlank(appUser.getFundPassword())){
|
|
if(StringUtils.isBlank(appUser.getFundPassword())){
|
|
@@ -209,7 +213,7 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
|
|
FinTranAddedInfo addedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
|
|
FinTranAddedInfo addedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
|
|
FinTranRecord tran = FinTranRecord.initFinTranRecordSomeParams(addedInfo, FinTranType3.TRANSFER_TO_TEAM_DiamondCoin, FinTranType1.U_Outcome_Balance, appUser);
|
|
FinTranRecord tran = FinTranRecord.initFinTranRecordSomeParams(addedInfo, FinTranType3.TRANSFER_TO_TEAM_DiamondCoin, FinTranType1.U_Outcome_Balance, appUser);
|
|
tran.setDiamondCoinChange(transfer.getMoney() * -1);
|
|
tran.setDiamondCoinChange(transfer.getMoney() * -1);
|
|
- tran.setAfterDiamondCoin(appUser.getDiamondCoin() + transfer.getMoney());
|
|
|
|
|
|
+// tran.setAfterDiamondCoin(appUser.getDiamondCoin() + transfer.getMoney());
|
|
tran.setCurrencyType(TranCurrencyType.Balance.getType());
|
|
tran.setCurrencyType(TranCurrencyType.Balance.getType());
|
|
tran.setRemarks("团队转账");
|
|
tran.setRemarks("团队转账");
|
|
// finTranRecordService.insertFinTranRecord(tran);
|
|
// finTranRecordService.insertFinTranRecord(tran);
|
|
@@ -227,7 +231,7 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
|
|
FinTranAddedInfo toAddedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
|
|
FinTranAddedInfo toAddedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
|
|
FinTranRecord toTran = FinTranRecord.initFinTranRecordSomeParams(toAddedInfo, FinTranType3.TRANSFER_TO_TEAM_DiamondCoin, FinTranType1.U_Income_Coin_Balance, toAppUser);
|
|
FinTranRecord toTran = FinTranRecord.initFinTranRecordSomeParams(toAddedInfo, FinTranType3.TRANSFER_TO_TEAM_DiamondCoin, FinTranType1.U_Income_Coin_Balance, toAppUser);
|
|
toTran.setDiamondCoinChange(transfer.getMoney());
|
|
toTran.setDiamondCoinChange(transfer.getMoney());
|
|
- toTran.setAfterDiamondCoin(appUser.getDiamondCoin() + transfer.getMoney());
|
|
|
|
|
|
+// toTran.setAfterDiamondCoin(appUser.getDiamondCoin() + transfer.getMoney());
|
|
toTran.setCurrencyType(TranCurrencyType.Balance.getType());
|
|
toTran.setCurrencyType(TranCurrencyType.Balance.getType());
|
|
toTran.setFromUid(appUser.getUserid());
|
|
toTran.setFromUid(appUser.getUserid());
|
|
toTran.setRemarks("团队转账");
|
|
toTran.setRemarks("团队转账");
|
|
@@ -241,6 +245,56 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
|
|
return HttpRet.success("转账成功",true);
|
|
return HttpRet.success("转账成功",true);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @DSTransactional
|
|
|
|
+ @DataSource(DataSourceType.SLAVE)
|
|
|
|
+ public HttpRet<Boolean> coinTransfer(AppUserTeamTranserDto transfer) {
|
|
|
|
+ AppUser toAppUser = appUserService.selectAppUserByUserid(transfer.getToUserId());
|
|
|
|
+ AppUser appUser = appUserService.selectAppUserByUserid(SecurityUtils.getUserId());
|
|
|
|
+ if(null == toAppUser){
|
|
|
|
+ return HttpRet.fail("受益用户不存在");
|
|
|
|
+ }
|
|
|
|
+ if(appUser.getCoin().longValue() < transfer.getMoney().longValue()){
|
|
|
|
+ return HttpRet.fail("可转账金额不足");
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isBlank(appUser.getFundPassword())){
|
|
|
|
+ return HttpRet.fail("未设置支付密码");
|
|
|
|
+ }
|
|
|
|
+ if(!Md5Utils.md5(Md5Utils.md5(transfer.getFundPassword()) + appUser.getSalt()).equals(appUser.getFundPassword())){
|
|
|
|
+ return HttpRet.fail("支付密码错误");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String userIds = configService.selectConfigByKey("system.transer.userids");
|
|
|
|
+ if(!"-1".equals(userIds)){
|
|
|
|
+ if(!Arrays.asList(userIds.split(",")).contains(appUser.getUserid())){
|
|
|
|
+ return HttpRet.fail("当前用户无权限转账");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ FinTranAddedInfo addedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
|
|
|
|
+ FinTranRecord tran = FinTranRecord.initFinTranRecordSomeParams(addedInfo, FinTranType3.TRANSFER_TO_Coin, FinTranType1.U_Outcome_Coin, appUser);
|
|
|
|
+ tran.setCoinChange(transfer.getMoney() * -1);
|
|
|
|
+ tran.setCurrencyType(TranCurrencyType.Coin.getType());
|
|
|
|
+ tran.setRemarks("金币转账");
|
|
|
|
+ appUserService.updateUserAmount(tran);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ FinTranAddedInfo toAddedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
|
|
|
|
+ FinTranRecord toTran = FinTranRecord.initFinTranRecordSomeParams(toAddedInfo, FinTranType3.TRANSFER_TO_Coin, FinTranType1.U_Income_Coin, toAppUser);
|
|
|
|
+ toTran.setCoinChange(transfer.getMoney());
|
|
|
|
+ toTran.setCurrencyType(TranCurrencyType.Coin.getType());
|
|
|
|
+ toTran.setFromUid(appUser.getUserid());
|
|
|
|
+ toTran.setRemarks("金币转账");
|
|
|
|
+ appUserService.updateUserAmount(toTran);
|
|
|
|
+ //清除用户缓存
|
|
|
|
+ redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(appUser.getUserid())));
|
|
|
|
+ redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(toAppUser.getUserid())));
|
|
|
|
+ //更新用户可提现余额
|
|
|
|
+ appUserCountTask.updateWithdrawAble(appUser.getUserid());
|
|
|
|
+ return HttpRet.success("转账成功",true);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@DataSource(DataSourceType.SLAVE)
|
|
@DataSource(DataSourceType.SLAVE)
|
|
public List<FinTranRecord> transferRecord(AppUserTeamTranserRecordDto transerRecordDto) {
|
|
public List<FinTranRecord> transferRecord(AppUserTeamTranserRecordDto transerRecordDto) {
|