package cn.com.countrygarden.bi.main.controller.marketing.app;

import cn.com.countrygarden.bi.main.core.Response;
import cn.com.countrygarden.bi.main.core.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;

@Controller("marketingAppQuotaController")
@RequestMapping("/api/biapp/marketing/quota")
public class QuotaController {

    /**
     * 完成指标排行
     *
     * @param commID
     * @param organCode
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/ranking", produces = "application/json;charset=utf-8", method = RequestMethod.GET)
    public Result ranking(@RequestParam(value = "CommID", defaultValue = "") String commID,
                          @RequestParam(value = "OrganCode", defaultValue = "") String organCode) {
        List<Map<String, Object>> response = new ArrayList<>();
        /*List<Map<String, String>> rakings = quotaService.rankingByOrganFromCache();

        Random random = new Random(99999);
        for (int i = 1; i <= 20; i++) {
            Map<String, Object> item = new HashMap<String, Object>() {{
                put("contractedAreaCompleteRate", random.nextFloat());
                put("currentContractedArea", random.nextFloat());
                put("currentChargeArea", random.nextFloat());
            }};
            item.put("organName", "区域 " + i);
            item.put("rank", i);
            response.add(item);
        }*/

        return Response.response();
    }
}
