class CubeToCubeWithLastBalancingMapper extends AbstractMapper<Cube, Cube> {



    private static final int COUNT_THRESHOLD = 50;

    private final int count;

    public CubeToCubeWithLastBalancingMapper() {
        this(null, 10);
    }

    public CubeToCubeWithLastBalancingMapper(int i) {
        this(null, i);
    }

    /**
     *
     * @param strategy 超时等待策略（null则设置为默认等待策略）
     * @param count 调仓记录数
     */
    public CubeToCubeWithLastBalancingMapper(TimeWaitingStrategy strategy, int count) {
        super(strategy);
        if(count <= 0) throw new IllegalArgumentException();
        this.count = Math.min(COUNT_THRESHOLD, count);
    }

    @Override
    public Cube mapLogic(Cube cube) throws Exception {

        if(cube == null || cube == EmptyObject.emptyCube) return EmptyObject.emptyCube;

        String target = URLMapper.CUBE_REBALANCING_JSON.toString();
        RequestParaBuilder builder = new RequestParaBuilder(target)
                .addParameter("cube_symbol", cube.getSymbol())
                .addParameter("count", count)
                .addParameter("page", 1);
        URL url = new URL(builder.build());
        String json = request(url);

        JsonNode node = mapper.readTree(json);
        processCube(cube, node);
        return cube;

    }

    private void processCube(Cube cube, JsonNode node) {<FILL_FUNCTION_BODY>}
}

        JsonNode list = node.get("list");

        List<Rebalancing.TrendBlock> history = new ArrayList<>();
        for (JsonNode jsonNode : list) {
            for (JsonNode jn : jsonNode.get("rebalancing_histories")) {
                String stock_name = jn.get("stock_name").asText();
                String stock_symbol = jn.get("stock_symbol").asText();
                String created_at = jn.get("created_at").asText();
                String prev_price = jn.get("prev_price").asText();
                String price = jn.get("price").asText();
                String prev_weight = jn.get("prev_weight").asText();
                String target_weight = jn.get("target_weight").asText();
                String weight = jn.get("weight").asText();
                String rebalancing_id = jn.get("rebalancing_id").asText();
                Rebalancing.TrendBlock trendBlock = new Rebalancing.TrendBlock(
                        stock_name,
                        stock_symbol,
                        created_at,
                        prev_price,
                        price,
                        prev_weight,
                        target_weight,
                        weight,
                        rebalancing_id);
                history.add(trendBlock);
            }

        }
        Rebalancing rebalancing = new Rebalancing(history);
        cube.setRebalancing(rebalancing);
    
<methods>public void <init>(org.decaywood.timeWaitingStrategy.TimeWaitingStrategy) ,public void <init>(org.decaywood.timeWaitingStrategy.TimeWaitingStrategy, java.lang.String) ,public org.decaywood.entity.Cube apply(org.decaywood.entity.Cube) <variables>