做市商 出售

master
fengyu.wang 4 years ago
parent a36cb7c7b5
commit cb783c3040
  1. 1
      blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/dto/ad/PublishAdParamDTO.java
  2. 31
      blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/service/impl/AdServiceImpl.java

@ -17,4 +17,5 @@ public class PublishAdParamDTO extends BaseDTO {
private BigDecimal minLimit; private BigDecimal minLimit;
private String[] payType; private String[] payType;
private String remark; private String remark;
private Boolean isTeacher;
} }

@ -15,6 +15,7 @@ import com.blockchain.server.otc.mapper.AdMapper;
import com.blockchain.server.otc.service.*; import com.blockchain.server.otc.service.*;
import com.codingapi.tx.annotation.ITxTransaction; import com.codingapi.tx.annotation.ITxTransaction;
import com.codingapi.tx.annotation.TxTransaction; import com.codingapi.tx.annotation.TxTransaction;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -75,16 +76,22 @@ public class AdServiceImpl implements AdService, ITxTransaction {
public void publishSellAd(PublishAdParamDTO param) { public void publishSellAd(PublishAdParamDTO param) {
//发布广告参数校验方法 //发布广告参数校验方法
Coin coin = publishAdVerify(param); Coin coin = publishAdVerify(param);
//检查市商否能发布更多广告 String adNumber;
checkMarketAdCount(param.getUserId(), CommonConstans.SELL, coin.getCoinName(), coin.getUnitName()); if (BooleanUtils.isFalse(param.getIsTeacher())) {
//检查卖家是否绑定支付方式 //检查市商否能发布更多广告
checkPublishPaysIsBinging(param); checkMarketAdCount(param.getUserId(), CommonConstans.SELL, coin.getCoinName(), coin.getUnitName());
//判断是否开启广告手续费 //检查卖家是否绑定支付方式
BigDecimal chargeRatio = checkAdServiceCharge(coin.getCoinServiceCharge(), param.getUserId()); checkPublishPaysIsBinging(param);
//新建广告数据,返回广告流水号 //判断是否开启广告手续费
String adNumber = insertAd(param, CommonConstans.SELL, chargeRatio); BigDecimal chargeRatio = checkAdServiceCharge(coin.getCoinServiceCharge(), param.getUserId());
//更新钱包并记录资金变动 //新建广告数据,返回广告流水号
publishSellAdHandleWallet(param, adNumber, chargeRatio); adNumber = insertAd(param, CommonConstans.SELL, chargeRatio);
//更新钱包并记录资金变动
publishSellAdHandleWallet(param, adNumber, chargeRatio);
} else {
//新建广告数据,返回广告流水号
adNumber = insertAd(param, CommonConstans.SELL, BigDecimal.ZERO);
}
//新增用户交易数据表 //新增用户交易数据表
dealStatsService.insertIsNotExist(param.getUserId()); dealStatsService.insertIsNotExist(param.getUserId());
//记录用户操作 //记录用户操作
@ -216,7 +223,9 @@ public class AdServiceImpl implements AdService, ITxTransaction {
//检查发布参数 //检查发布参数
checkPublishParam(param); checkPublishParam(param);
//判断用户是否可以发布广告 //判断用户是否可以发布广告
marketUserService.checkMarketUser(param.getUserId()); if (!BooleanUtils.isTrue(param.getIsTeacher())) {
marketUserService.checkMarketUser(param.getUserId());
}
//检查密码 //检查密码
walletService.isPassword(param.getPass()); walletService.isPassword(param.getPass());
//检查币对 //检查币对

Loading…
Cancel
Save