| | |
| | | package com.xcong.excoin.modules.otc.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xcong.excoin.common.LoginUserUtils; |
| | | import com.xcong.excoin.common.exception.GlobalException; |
| | | import com.xcong.excoin.common.system.service.CommonService; |
| | | import com.xcong.excoin.modules.member.dao.MemberDao; |
| | | import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao; |
| | | import com.xcong.excoin.modules.member.entity.MemberEntity; |
| | | import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; |
| | |
| | | private final OtcEntrustOrderDao otcEntrustOrderDao; |
| | | private final CommonService commonService; |
| | | private final MemberWalletCoinDao memberWalletCoinDao; |
| | | private final MemberDao memberDao; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | throw new GlobalException("无法出售"); |
| | | } |
| | | |
| | | if (StrUtil.isBlank(orderAddDto.getPassword())) { |
| | | throw new GlobalException("资金密码不能为空"); |
| | | } |
| | | |
| | | MemberEntity memberEntity = memberDao.selectById(member.getId()); |
| | | if (!SecureUtil.md5(orderAddDto.getPassword()).equals(memberEntity.getTradePassword())) { |
| | | throw new GlobalException("资金密码错误"); |
| | | } |
| | | |
| | | BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice()); |
| | | if (cny.compareTo(orderAddDto.getCnyAmount()) != 0) { |
| | | throw new GlobalException("数量与金额不符"); |