| | |
| | | import com.xcong.excoin.modules.otc.vo.OrderListVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | public interface OtcOrderDao extends BaseMapper<OtcOrder> { |
| | |
| | | Integer selectMemberCntForEntrust(@Param("entrustMemberId") Long entrustMemberId); |
| | | |
| | | Integer selectTotalOrderCount(@Param("entrustMemberId") Long entrustMemberId, @Param("status") Integer status); |
| | | |
| | | BigDecimal selectMemberAvgPayTime(@Param("memberId") Long memberId); |
| | | |
| | | BigDecimal selectMemberAvgCoinTime(@Param("memberId") Long memberId); |
| | | } |
| | |
| | | Integer finishCnt = otcOrderDao.selectTotalOrderCount(mb.getMemberId(), OtcOrder.STATUS_FINISH); |
| | | BigDecimal finishRatio = BigDecimal.valueOf(finishCnt).divide(BigDecimal.valueOf(totalCnt), 4, BigDecimal.ROUND_DOWN); |
| | | // 平均付款时间 |
| | | |
| | | BigDecimal avgPayTime = otcOrderDao.selectMemberAvgPayTime(mb.getMemberId()); |
| | | // 平均放币时间 |
| | | BigDecimal avgCoinTime = otcOrderDao.selectMemberAvgCoinTime(mb.getMemberId()); |
| | | |
| | | mb.setBuyCnt(buyCnt); |
| | | mb.setTotalOrderCnt(totalCnt); |
| | | mb.setFinishRatio(finishRatio); |
| | | mb.setAvgPayTime(avgPayTime.intValue()); |
| | | mb.setAvgCoinTime(avgCoinTime.intValue()); |
| | | |
| | | otcMarketBussinessDao.updateById(mb); |
| | | } |
| | | } |
| | | } |
| | |
| | | and status #{status} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectMemberAvgPayTime" resultType="java.math.BigDecimal"> |
| | | select |
| | | IFNULL(sum(timestampdiff(SECOND, create_time, pay_time))/count(1), 0) |
| | | from otc_order |
| | | where status=3 and member_id=#{memberId} and order_type='B' |
| | | </select> |
| | | |
| | | <select id="selectMemberAvgCoinTime" resultType="java.math.BigDecimal"> |
| | | select |
| | | IFNULL(sum(timestampdiff(SECOND, pay_time, coin_time))/count(1), 0) |
| | | from otc_order |
| | | where status=3 and member_id=40 and order_type='S' |
| | | </select> |
| | | </mapper> |