|
|
@ -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,6 +76,8 @@ 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; |
|
|
|
|
|
|
|
if (BooleanUtils.isFalse(param.getIsTeacher())) { |
|
|
|
//检查市商否能发布更多广告
|
|
|
|
//检查市商否能发布更多广告
|
|
|
|
checkMarketAdCount(param.getUserId(), CommonConstans.SELL, coin.getCoinName(), coin.getUnitName()); |
|
|
|
checkMarketAdCount(param.getUserId(), CommonConstans.SELL, coin.getCoinName(), coin.getUnitName()); |
|
|
|
//检查卖家是否绑定支付方式
|
|
|
|
//检查卖家是否绑定支付方式
|
|
|
@ -82,9 +85,13 @@ public class AdServiceImpl implements AdService, ITxTransaction { |
|
|
|
//判断是否开启广告手续费
|
|
|
|
//判断是否开启广告手续费
|
|
|
|
BigDecimal chargeRatio = checkAdServiceCharge(coin.getCoinServiceCharge(), param.getUserId()); |
|
|
|
BigDecimal chargeRatio = checkAdServiceCharge(coin.getCoinServiceCharge(), param.getUserId()); |
|
|
|
//新建广告数据,返回广告流水号
|
|
|
|
//新建广告数据,返回广告流水号
|
|
|
|
String adNumber = insertAd(param, CommonConstans.SELL, chargeRatio); |
|
|
|
adNumber = insertAd(param, CommonConstans.SELL, chargeRatio); |
|
|
|
//更新钱包并记录资金变动
|
|
|
|
//更新钱包并记录资金变动
|
|
|
|
publishSellAdHandleWallet(param, adNumber, 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); |
|
|
|
//判断用户是否可以发布广告
|
|
|
|
//判断用户是否可以发布广告
|
|
|
|
|
|
|
|
if (!BooleanUtils.isTrue(param.getIsTeacher())) { |
|
|
|
marketUserService.checkMarketUser(param.getUserId()); |
|
|
|
marketUserService.checkMarketUser(param.getUserId()); |
|
|
|
|
|
|
|
} |
|
|
|
//检查密码
|
|
|
|
//检查密码
|
|
|
|
walletService.isPassword(param.getPass()); |
|
|
|
walletService.isPassword(param.getPass()); |
|
|
|
//检查币对
|
|
|
|
//检查币对
|
|
|
|