|
@@ -64,7 +64,6 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
public HttpResponseResult<UserAccountRecord> accountChange(UserAccountRecordDto accountRecordDto) {
|
|
|
if (null == accountRecordDto.getUserId() || null == accountRecordDto.getTransAmount()
|
|
|
|| null == accountRecordDto.getInOrOut() || null == accountRecordDto.getBizType()) {
|
|
@@ -135,7 +134,8 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
|
return HttpResponseResult.succeed(total);
|
|
|
}
|
|
|
|
|
|
- private HttpResponseResult<UserAccountRecord> doAccountChange(UserAccountRecordDto accountRecordDto) {
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ HttpResponseResult<UserAccountRecord> doAccountChange(UserAccountRecordDto accountRecordDto) {
|
|
|
//收入要校验金额
|
|
|
if (InOrOutEnum.IN.equals(accountRecordDto.getInOrOut())) {
|
|
|
UserOrder userOrder = orderService.getOne(Wrappers.<UserOrder>lambdaQuery()
|
|
@@ -150,19 +150,18 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
|
log.error("账户变更失败,param is " + JSONObject.toJSONString(accountRecordDto));
|
|
|
accountRecordDto.setErrFlag(1);
|
|
|
accountRecordDto.setErrMsg("账户变更异常,订单入账总金额大于购买金额,订单号:" + accountRecordDto.getOrderNo());
|
|
|
- accountRecordDto.setFrozenType(FrozenTypeEnum.FROZEN);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (FrozenTypeEnum.FROZEN.equals(accountRecordDto.getFrozenType())) {
|
|
|
- //校验冻结金额
|
|
|
- baseMapper.frozenChangeAccount(accountRecordDto.getUserId(), accountRecordDto.getTransAmount(), accountRecordDto.getInOrOut().getCode());
|
|
|
- } else if (FrozenTypeEnum.FROZEN_DEDUCT.equals(accountRecordDto.getFrozenType())) {
|
|
|
- baseMapper.frozenDeductChangeAccount(accountRecordDto.getUserId(), accountRecordDto.getTransAmount(), accountRecordDto.getInOrOut().getCode());
|
|
|
- } else if (FrozenTypeEnum.FROZEN_BACK.equals(accountRecordDto.getFrozenType())) {
|
|
|
- baseMapper.frozenBackChangeAccount(accountRecordDto.getUserId(), accountRecordDto.getTransAmount(), accountRecordDto.getInOrOut().getCode());
|
|
|
- } else {
|
|
|
- baseMapper.changeAccount(accountRecordDto.getUserId(), accountRecordDto.getTransAmount(), accountRecordDto.getInOrOut().getCode());
|
|
|
+ if (accountRecordDto.getErrFlag() == 0) {
|
|
|
+ if (FrozenTypeEnum.FROZEN.equals(accountRecordDto.getFrozenType())) {
|
|
|
+ baseMapper.frozenChangeAccount(accountRecordDto.getUserId(), accountRecordDto.getTransAmount(), accountRecordDto.getInOrOut().getCode());
|
|
|
+ } else if (FrozenTypeEnum.FROZEN_DEDUCT.equals(accountRecordDto.getFrozenType())) {
|
|
|
+ baseMapper.frozenDeductChangeAccount(accountRecordDto.getUserId(), accountRecordDto.getTransAmount(), accountRecordDto.getInOrOut().getCode());
|
|
|
+ } else if (FrozenTypeEnum.FROZEN_BACK.equals(accountRecordDto.getFrozenType())) {
|
|
|
+ baseMapper.frozenBackChangeAccount(accountRecordDto.getUserId(), accountRecordDto.getTransAmount(), accountRecordDto.getInOrOut().getCode());
|
|
|
+ } else {
|
|
|
+ baseMapper.changeAccount(accountRecordDto.getUserId(), accountRecordDto.getTransAmount(), accountRecordDto.getInOrOut().getCode());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
UserAccountVo detail = detail(accountRecordDto.getUserId());
|
|
@@ -170,6 +169,7 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
|
|| detail.getAmountUsable().doubleValue() < 0 || detail.getAmountFrozen().doubleValue() < 0) {
|
|
|
throw new BizException("账户变更失败");
|
|
|
}
|
|
|
+
|
|
|
if (accountRecordDto.getSaveRecord()) {
|
|
|
//插入账户变更记录
|
|
|
accountRecordDto.setAccountId(accountRecordDto.getUserId());
|