| | |
| | | return new DirectExchange(EXCHANGE_ONE); |
| | | } |
| | | |
| | | @Bean |
| | | public DirectExchange delayExchange() { |
| | | return new DirectExchange(EXCHANGE_DELAY); |
| | | } |
| | |
| | | throw new GlobalException("可用金额不足"); |
| | | } |
| | | |
| | | memberWalletCoinDao.updateFrozenBalance(member.getId(), coinWallet.getId(), totalAmount); |
| | | memberWalletCoinDao.updateFrozenBalance(member.getId(), coinWallet.getId(), addDto.getAmount()); |
| | | } |
| | | |
| | | OtcMarketBussiness mb = otcMarketBussinessDao.selectMarketBussinessByMemberId(member.getId()); |
| | |
| | | private MemberWalletCoinDao memberWalletCoinDao; |
| | | |
| | | |
| | | @Scheduled(cron = "0/1 * * * * ? ") |
| | | // @Scheduled(cron = "0/1 * * * * ? ") |
| | | public void autoCancelOrder() { |
| | | List<OtcOrder> otcOrders = otcOrderDao.selectOrderListWithStatusAndType(OtcEntrustOrder.ORDER_TYPE_B, OtcOrder.STATUS_SUBMIT); |
| | | if (CollUtil.isNotEmpty(otcOrders)) { |
| | |
| | | } |
| | | |
| | | |
| | | // @RabbitListener(queues = RabbitMqConfig.QUEUE_DELAY) |
| | | public void delayOrder() { |
| | | log.info("---->{}", new Date()); |
| | | @RabbitListener(queues = RabbitMqConfig.QUEUE_DELAY) |
| | | public void delayOrder(String content) { |
| | | log.info("--{}-->{}", new Date(), content); |
| | | } |
| | | } |
| | |
| | | public void sendDelayOrderMsg(String content) { |
| | | log.info("-----{}", new Date()); |
| | | rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_DELAY, RabbitMqConfig.ROUTING_KEY_DELAY, content, message -> { |
| | | message.getMessageProperties().setExpiration(60 + ""); |
| | | message.getMessageProperties().setExpiration(1000 * 60 + ""); |
| | | return message; |
| | | }); |
| | | } |
| | |
| | | |
| | | <select id="selectMemberAvgCoinTime" resultType="java.math.BigDecimal"> |
| | | select |
| | | IFNULL(sum(timestampdiff(SECOND, pay_time, coin_time))/count(1), 0) |
| | | IFNULL(sum(timestampdiff(SECOND, pay_time, finish_time))/count(1), 0) |
| | | from otc_order |
| | | where status=3 and member_id=40 and order_type='S' |
| | | </select> |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Slf4j |
| | | @SpringBootTest |
| | | public class OtcTest { |
| | |
| | | |
| | | @Test |
| | | public void rabbitTest() { |
| | | otcProducter.sendMarketBussinessMsg("123456"); |
| | | otcProducter.sendDelayOrderMsg("123456"); |
| | | |
| | | while(true){ |
| | | try { |
| | | TimeUnit.SECONDS.sleep(1); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |