Merge branch 'activity' of http://120.27.238.55:7000/r/exchange into activity
| | |
| | | sendOrderBombMsg(holdOrderEntity.getId(), holdOrderEntity.getOpeningType(), forceClosingPrice, holdOrderEntity.getSymbol(), holdOrderEntity.getOperateNo(), holdOrderEntity.getMemberId()); |
| | | |
| | | if (ContractOrderEntity.CONTRACTTYPE_DOCUMENTARY == holdOrderEntity.getContractType()) { |
| | | followProducer.sendChangeFollowOrderBond(holdOrderEntity.getId(), changeBondDto.getAmount(), changeBondDto.getType()); |
| | | followProducer.sendChangeFollowOrderBond(changeBondDto); |
| | | } |
| | | return Result.ok("调整成功"); |
| | | } |
| | |
| | | List<FollowFollowerOrderRelationEntity> relations = followFollowerOrderRelationDao.selectFollowHoldOrderByTradeOrderNo(contractHoldOrderEntity.getOrderNo()); |
| | | if (CollUtil.isNotEmpty(relations)) { |
| | | for (FollowFollowerOrderRelationEntity relation : relations) { |
| | | if (contractHoldOrderEntity.getId().equals(relation.getOrderId())) { |
| | | continue; |
| | | } |
| | | ContractHoldOrderEntity followHoldOrder = contractHoldOrderDao.selectById(relation.getOrderId()); |
| | | MemberEntity memberEntity = memberDao.selectById(relation.getMemberId()); |
| | | MemberWalletContractEntity wallet = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberEntity.getId(), CoinTypeEnum.USDT.name()); |
| | |
| | | } else { |
| | | if (followHoldOrder.getBondAmount().subtract(followHoldOrder.getPrePaymentAmount()).subtract(bond).compareTo(BigDecimal.ZERO) < 0) { |
| | | log.info("超出保证金最大减少金额-1"); |
| | | LogRecordUtils.insertFollowerNotice(memberEntity.getId(), NoticeConstant.CHANGE_BOND_TITLE, NoticeConstant.CHANGE_BOND_ADD_CONTENT_FAIL); |
| | | LogRecordUtils.insertFollowerNotice(memberEntity.getId(), NoticeConstant.CHANGE_BOND_TITLE, NoticeConstant.CHANGE_BOND_REDUCE_CONTENT_FAIL); |
| | | continue; |
| | | } |
| | | |
| | |
| | | BigDecimal canReduceMax = followHoldOrder.getBondAmount().subtract(followHoldOrder.getPrePaymentAmount()).add(profitOrLoss); |
| | | if (canReduceMax.subtract(bond).compareTo(BigDecimal.ZERO) < 0) { |
| | | log.info("超出保证金最大减少金额-2"); |
| | | LogRecordUtils.insertFollowerNotice(memberEntity.getId(), NoticeConstant.CHANGE_BOND_TITLE, NoticeConstant.CHANGE_BOND_ADD_CONTENT_FAIL); |
| | | LogRecordUtils.insertFollowerNotice(memberEntity.getId(), NoticeConstant.CHANGE_BOND_TITLE, NoticeConstant.CHANGE_BOND_REDUCE_CONTENT_FAIL); |
| | | continue; |
| | | } |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.rabbitmq.client.Channel; |
| | | import com.xcong.excoin.configurations.RabbitMqConfig; |
| | | import com.xcong.excoin.modules.contract.parameter.dto.ChangeBondDto; |
| | | import com.xcong.excoin.modules.documentary.service.FollowOrderOperationService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.amqp.core.Message; |
| | |
| | | followOrderOperationService.addFollowerOrder(Long.parseLong(content)); |
| | | } |
| | | |
| | | // @RabbitListener(queues = RabbitMqConfig.QUEUE_FOLLOW_CHANGE_BOND) |
| | | @RabbitListener(queues = RabbitMqConfig.QUEUE_FOLLOW_CHANGE_BOND) |
| | | public void changeFollowOrderBond(Message message, Channel channel) { |
| | | String content = new String(message.getBody()); |
| | | log.info("==收到跟单保证金调整消息 : {}", content); |
| | | Map map = JSONObject.parseObject(content, Map.class); |
| | | Integer id = (Integer) map.get("id"); |
| | | BigDecimal bond = (BigDecimal) map.get("bond"); |
| | | Integer type = (Integer) map.get("type"); |
| | | followOrderOperationService.changeFollowOrdersBond(id.longValue(), bond, type); |
| | | ChangeBondDto changeBondDto = JSONObject.parseObject(content, ChangeBondDto.class); |
| | | followOrderOperationService.changeFollowOrdersBond(changeBondDto.getId(), changeBondDto.getAmount(), changeBondDto.getType()); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.xcong.excoin.configurations.RabbitMqConfig; |
| | | import com.xcong.excoin.modules.contract.parameter.dto.ChangeBondDto; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import net.sf.json.JSON; |
| | | import org.springframework.amqp.rabbit.connection.CorrelationData; |
| | |
| | | * |
| | | * @param id |
| | | */ |
| | | public void sendChangeFollowOrderBond(Long id, BigDecimal changeBond, Integer type) { |
| | | public void sendChangeFollowOrderBond(ChangeBondDto changeBondDto) { |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", id); |
| | | map.put("bond", changeBond); |
| | | map.put("type", type); |
| | | String msg = JSONObject.toJSONString(map); |
| | | String msg = JSONObject.toJSONString(changeBondDto); |
| | | log.info("发送跟单保证金调整消息: {}, {}", msg, correlationData.getId()); |
| | | rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_A, RabbitMqConfig.ROUTINGKEY_FOLLOW_CHANGE_BOND, msg, correlationData); |
| | | } |