Helius
2021-05-20 563980920c7085f38b65da11e62ae22a76e8a110
modify
3 files modified
17 ■■■■ changed files
src/main/java/com/xcong/excoin/modules/otc/controller/OtcOrderController.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/service/OtcOrderService.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java 7 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/controller/OtcOrderController.java
@@ -33,15 +33,13 @@
    @ApiOperation(value = "我要购买")
    @PostMapping(value = "/buy")
    public Result buy(@RequestBody OtcOrderAddDto orderAddDto) {
        otcOrderService.buyOrder(orderAddDto);
        return Result.ok("购买成功");
        return otcOrderService.buyOrder(orderAddDto);
    }
    @ApiOperation(value = "我要出售")
    @PostMapping(value = "/sale")
    public Result sale(@RequestBody OtcOrderAddDto orderAddDto) {
        otcOrderService.saleOrder(orderAddDto);
        return Result.ok("出售成功");
        return otcOrderService.saleOrder(orderAddDto);
    }
    @ApiOperation(value = "用户订单列表")
src/main/java/com/xcong/excoin/modules/otc/service/OtcOrderService.java
@@ -11,9 +11,9 @@
public interface OtcOrderService extends IService<OtcOrder> {
    void buyOrder(OtcOrderAddDto orderAddDto);
    Result buyOrder(OtcOrderAddDto orderAddDto);
    void saleOrder(OtcOrderAddDto orderAddDto);
    Result saleOrder(OtcOrderAddDto orderAddDto);
    IPage<OrderListVo> findOrderListInPage(OrderListDto orderListDto);
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java
@@ -56,7 +56,7 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void buyOrder(OtcOrderAddDto orderAddDto) {
    public Result buyOrder(OtcOrderAddDto orderAddDto) {
        MemberEntity member = LoginUserUtils.getAppLoginUser();
        OtcEntrustOrder entrustOrder = otcEntrustOrderDao.selectById(orderAddDto.getId());
        if (entrustOrder == null) {
@@ -103,11 +103,13 @@
        otcEntrustOrderDao.updateRemainAmount(entrustOrder.getId(), orderAddDto.getUsdtAmount().negate());
        this.baseMapper.insert(otcOrder);
        this.baseMapper.insert(sale);
        return Result.ok("购买成功", otcOrder.getId());
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saleOrder(OtcOrderAddDto orderAddDto) {
    public Result saleOrder(OtcOrderAddDto orderAddDto) {
        MemberEntity member = LoginUserUtils.getAppLoginUser();
        OtcEntrustOrder entrustOrder = otcEntrustOrderDao.selectById(orderAddDto.getId());
        if (entrustOrder == null) {
@@ -171,6 +173,7 @@
        this.baseMapper.insert(buy);
        memberWalletCoinDao.updateFrozenBalance(member.getId(), wallet.getId(), orderAddDto.getUsdtAmount());
        return Result.ok("出售成功", otcOrder.getId());
    }
    @Override