xiaoyong931011
2021-05-18 a38d3fcc9ddf27353700f351736e172c1eece74c
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java
@@ -1,5 +1,6 @@
package com.xcong.excoin.modules.otc.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -8,16 +9,23 @@
import com.xcong.excoin.modules.member.entity.MemberAccountMoneyChangeEntity;
import com.xcong.excoin.modules.member.entity.MemberEntity;
import com.xcong.excoin.modules.member.mapper.MemberMapper;
import com.xcong.excoin.modules.otc.entity.OtcEntrustOrderEntity;
import com.xcong.excoin.modules.otc.entity.OtcMarketBussinessEntity;
import com.xcong.excoin.modules.otc.entity.OtcOrderAppealEntity;
import com.xcong.excoin.modules.otc.entity.OtcOrderEntity;
import com.xcong.excoin.modules.otc.mapper.OtcEntrustOrderMapper;
import com.xcong.excoin.modules.otc.mapper.OtcMarketBussinessMapper;
import com.xcong.excoin.modules.otc.mapper.OtcOrderAppealMapper;
import com.xcong.excoin.modules.otc.mapper.OtcOrderMapper;
import com.xcong.excoin.modules.otc.service.OtcService;
import com.xcong.excoin.modules.otc.vo.OtcAppealInfoVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
@Service
@RequiredArgsConstructor
@@ -27,6 +35,10 @@
    private OtcMarketBussinessMapper otcMarketBussinessMapper;
    @Resource
    private OtcOrderAppealMapper otcOrderAppealMapper;
    @Resource
    private OtcEntrustOrderMapper otcEntrustOrderMapper;
    @Resource
    private OtcOrderMapper otcOrderMapper;
    @Resource
    private MemberMapper memberMapper;
@@ -95,6 +107,7 @@
    }
    @Override
    @Transactional
    public FebsResponse dealIng(Long id) {
        OtcOrderAppealEntity otcOrderAppealEntity = otcOrderAppealMapper.selectById(id);
        Integer status = otcOrderAppealEntity.getStatus();
@@ -107,4 +120,59 @@
        return new FebsResponse().success();
    }
    @Override
    public IPage<OtcEntrustOrderEntity> otcEntrustList(OtcEntrustOrderEntity otcEntrustOrderEntity, QueryRequest request) {
        Page<OtcEntrustOrderEntity> page = new Page<>(request.getPageNum(), request.getPageSize());
        IPage<OtcEntrustOrderEntity> otcEntrustOrderEntitys = otcEntrustOrderMapper.otcEntrustList(page, otcEntrustOrderEntity);
        return otcEntrustOrderEntitys;
    }
    @Override
    public IPage<OtcOrderEntity> otcOrderList(OtcOrderEntity otcOrderEntity, QueryRequest request) {
        Page<OtcOrderEntity> page = new Page<>(request.getPageNum(), request.getPageSize());
        IPage<OtcOrderEntity> otcOrderEntitys = otcOrderMapper.otcOrderList(page, otcOrderEntity);
        return otcOrderEntitys;
    }
    @Override
    public OtcAppealInfoVo otcAppealInfo(long id) {
        OtcAppealInfoVo otcAppealInfoVo = new OtcAppealInfoVo();
        OtcOrderAppealEntity otcOrderAppealEntity = otcOrderAppealMapper.selectById(id);
        otcAppealInfoVo.setId(id);
        if(ObjectUtil.isNotEmpty(otcOrderAppealEntity)){
            String reason = otcOrderAppealEntity.getReason();
            otcAppealInfoVo.setReason(reason);
            String content = otcOrderAppealEntity.getContent();
            otcAppealInfoVo.setContent(content);
        }
        //获取对应的订单详情
        long orderId = otcOrderAppealEntity.getOrderId();
        OtcOrderEntity otcOrderEntity = otcOrderMapper.selectById(orderId);
        if(ObjectUtil.isNotEmpty(otcOrderEntity)){
            String orderNo = otcOrderEntity.getOrderNo();
            otcAppealInfoVo.setOrderNo(orderNo);
            BigDecimal unitPrice = otcOrderEntity.getUnitPrice();
            otcAppealInfoVo.setUnitPrice(unitPrice);
            BigDecimal coinAmount = otcOrderEntity.getCoinAmount();
            otcAppealInfoVo.setCoinAmount(coinAmount);
            BigDecimal totalAmount = otcOrderEntity.getTotalAmount();
            otcAppealInfoVo.setTotalAmount(totalAmount);
            Integer status = otcOrderEntity.getStatus();
            otcAppealInfoVo.setStatus(status);
            Date payTime = otcOrderEntity.getPayTime();
            otcAppealInfoVo.setPayTime(payTime);
            Date finishTime = otcOrderEntity.getFinishTime();
            otcAppealInfoVo.setFinishTime(finishTime);
        }
        //获取对应的商户信息
        long payMdId = otcOrderEntity.getPayMdId();
        OtcMarketBussinessEntity otcMarketBussinessEntity = otcMarketBussinessMapper.selectById(payMdId);
        if(ObjectUtil.isNotEmpty(otcMarketBussinessEntity)){
            String nikename = otcMarketBussinessEntity.getNikename();
            otcAppealInfoVo.setNikename(nikename);
        }
        return otcAppealInfoVo;
    }
}