Helius
2021-04-06 250529aeae8ef5314a9256a3a3d4ce8f75fec0f1
modify
3 files modified
19 ■■■■■ changed files
src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractHoldOrderServiceImpl.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/rabbit/consumer/FollowConsumer.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/rabbit/producer/FollowProducer.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractHoldOrderServiceImpl.java
@@ -853,7 +853,7 @@
            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("调整成功");
        }
src/main/java/com/xcong/excoin/rabbit/consumer/FollowConsumer.java
@@ -3,6 +3,7 @@
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;
@@ -39,10 +40,7 @@
    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());
    }
}
src/main/java/com/xcong/excoin/rabbit/producer/FollowProducer.java
@@ -3,6 +3,7 @@
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;
@@ -53,13 +54,9 @@
     *
     * @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);
    }