| | |
| | | @Override |
| | | public void add() { |
| | | MemberEntity member = LoginUserUtils.getAppLoginUser(); |
| | | member = memberDao.selectById(member.getId()); |
| | | |
| | | OtcMarketBussiness mb = this.baseMapper.selectMarketBussinessByMemberId(member.getId()); |
| | | if (mb != null) { |
| | | throw new GlobalException("该用户已经是市商或正在审核"); |
| | | if (MemberEntity.IS_TRADER_Y.equals(member.getIsTrader())) { |
| | | throw new GlobalException("已经是市商"); |
| | | } |
| | | |
| | | OtcMarketBussiness mb = this.baseMapper.selectMarketBussinessByMemberId(member.getId()); |
| | | OtcMarketBussiness otcMb = new OtcMarketBussiness(); |
| | | otcMb.setMemberId(member.getId()); |
| | | otcMb.setAvgCoinTime(0); |
| | | otcMb.setAvgPayTime(0); |
| | | otcMb.setTotalOrderCnt(0); |
| | | otcMb.setBuyCnt(0); |
| | | otcMb.setFinishRatio(BigDecimal.ZERO); |
| | | otcMb.setStatus(OtcMarketBussiness.CHECK_WAIT); |
| | | if (mb != null) { |
| | | if (OtcMarketBussiness.CHECK_PASS.equals(mb.getStatus()) || OtcMarketBussiness.CHECK_WAIT.equals(mb.getStatus())) { |
| | | throw new GlobalException("已经是市商或正在审核"); |
| | | } |
| | | |
| | | this.baseMapper.insert(otcMb); |
| | | otcMb = mb; |
| | | otcMb.setStatus(OtcMarketBussiness.CHECK_WAIT); |
| | | this.baseMapper.updateById(otcMb); |
| | | } else { |
| | | otcMb.setMemberId(member.getId()); |
| | | otcMb.setAvgCoinTime(0); |
| | | otcMb.setAvgPayTime(0); |
| | | otcMb.setTotalOrderCnt(0); |
| | | otcMb.setBuyCnt(0); |
| | | otcMb.setFinishRatio(BigDecimal.ZERO); |
| | | otcMb.setStatus(OtcMarketBussiness.CHECK_WAIT); |
| | | |
| | | this.baseMapper.insert(otcMb); |
| | | } |
| | | } |
| | | |
| | | @Override |