| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0 0/5 * * * ? ") |
| | | // @Scheduled(cron = "0 0/5 * * * ? ") |
| | | public void marketBussinessJob() { |
| | | List<OtcMarketBussiness> list = otcMarketBussinessDao.selectList(null); |
| | | if (CollUtil.isNotEmpty(list)) { |
| | | for (OtcMarketBussiness mb : list) { |
| | | // 服务人数 |
| | | Integer buyCnt = otcOrderDao.selectMemberCntForEntrust(mb.getMemberId()); |
| | | // 总单数 |
| | | Integer totalCnt = otcOrderDao.selectTotalOrderCount(mb.getMemberId(), null); |
| | | // 完成率 |
| | | Integer finishCnt = otcOrderDao.selectTotalOrderCount(mb.getMemberId(), OtcOrder.STATUS_FINISH); |
| | | if (totalCnt != null && totalCnt != 0) { |
| | | BigDecimal finishRatio = BigDecimal.valueOf(finishCnt).divide(BigDecimal.valueOf(totalCnt), 4, BigDecimal.ROUND_DOWN); |
| | | // 买单数 |
| | | Integer buyTotalCnt = otcOrderDao.selectTotalOrderCount(mb.getMemberId(), null, OtcEntrustOrder.ORDER_TYPE_B); |
| | | // 买单完成率 |
| | | Integer buyFinishCnt = otcOrderDao.selectTotalOrderCount(mb.getMemberId(), OtcOrder.STATUS_FINISH, OtcEntrustOrder.ORDER_TYPE_B); |
| | | if (buyTotalCnt != null && buyTotalCnt != 0) { |
| | | BigDecimal finishRatio = BigDecimal.valueOf(buyFinishCnt).divide(BigDecimal.valueOf(buyTotalCnt), 4, BigDecimal.ROUND_DOWN); |
| | | mb.setFinishRatio(finishRatio); |
| | | } |
| | | |
| | | // 买单数 |
| | | Integer saleTotalCnt = otcOrderDao.selectTotalOrderCount(mb.getMemberId(), null, OtcEntrustOrder.ORDER_TYPE_S); |
| | | // 买单完成率 |
| | | Integer saleFinishCnt = otcOrderDao.selectTotalOrderCount(mb.getMemberId(), OtcOrder.STATUS_FINISH, OtcEntrustOrder.ORDER_TYPE_S); |
| | | if (saleTotalCnt != null && saleTotalCnt != 0) { |
| | | BigDecimal finishRatio = BigDecimal.valueOf(saleFinishCnt).divide(BigDecimal.valueOf(saleTotalCnt), 4, BigDecimal.ROUND_DOWN); |
| | | mb.setSaleFinishRatio(finishRatio); |
| | | } |
| | | // 平均付款时间 |
| | | BigDecimal avgPayTime = otcOrderDao.selectMemberAvgPayTime(mb.getMemberId()); |
| | |
| | | BigDecimal avgCoinTime = otcOrderDao.selectMemberAvgCoinTime(mb.getMemberId()); |
| | | |
| | | mb.setBuyCnt(buyCnt); |
| | | mb.setTotalOrderCnt(totalCnt); |
| | | mb.setTotalOrderCnt(buyTotalCnt); |
| | | mb.setSaleOrderCnt(saleTotalCnt); |
| | | mb.setAvgPayTime(avgPayTime.intValue()); |
| | | mb.setAvgCoinTime(avgCoinTime.intValue()); |
| | | |