Authored by Zhang

<SRS> test.

package com.yoho.unions.channel.restapi;
import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.yoho.service.model.union.request.ChannelBlackListRequestBO;
import com.yoho.service.model.union.request.ChannelGroupRequestBO;
import com.yoho.service.model.union.request.MktReportFormReqVO;
import com.yoho.service.model.union.response.MktReportFormRspBO;
import com.yoho.service.model.union.response.PageBlackListRspBO;
import com.yoho.service.model.union.response.PageChannelGroupRspBO;
import com.yoho.service.model.union.response.PageMktReportFormRspBO;
import com.yoho.unions.channel.service.IChannelBlackListService;
import com.yoho.unions.channel.service.IMktCostReportFormService;
import com.yoho.unions.common.ApiResponse;
import com.yoho.unions.common.utils.PhoneUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.math.BigDecimal;
import java.util.List;
/**
* Created by yoho on 2017/4/26.
... ... @@ -20,4 +39,72 @@ public class MktCostReportFormController {
IMktCostReportFormService mktCostReportFormService;
@RequestMapping("/getMktReportForm")
@ResponseBody
public ApiResponse getMktReportForm(MktReportFormReqVO mktReportFormReqVO){
logger.info("enter getMktReportForm. param mktReportFormReqVO={}", mktReportFormReqVO);
try {
// PageMktReportFormRspBO result = mktCostReportFormService.getMktReportForm(mktReportFormReqVO);
Gson result = new Gson();
MktReportFormRspBO mktReportFormRspBO = new MktReportFormRspBO();
List<String> dateIdStrList = Lists.newArrayList();
List<BigDecimal> totalActuralCostList = Lists.newArrayList();
List<BigDecimal> iosActualCostList = Lists.newArrayList();
List<BigDecimal> androidActualCostList = Lists.newArrayList();
List<Integer> totalExpoureNumList = Lists.newArrayList();
List<Integer> iosExpoureNumList = Lists.newArrayList();
List<Integer> androidExpoureNumList = Lists.newArrayList();
List<Integer> totalActiveList = Lists.newArrayList();
List<Integer> iosActiveList = Lists.newArrayList();
List<Integer> androidActiveList = Lists.newArrayList();
List<Integer> totalNewUdidList = Lists.newArrayList();
List<Integer> iosNewUdidList = Lists.newArrayList();
List<Integer> androidNewUdidList = Lists.newArrayList();
for (Integer i = 6; i >=0; i++){
dateIdStrList.add("2017042" + i.toString());
totalActuralCostList.add(new BigDecimal(5000 - i * 100));
iosActualCostList.add(new BigDecimal(4000 - i * 80));
androidActualCostList.add(new BigDecimal(1000 - i * 20));
totalExpoureNumList.add(1000 - i * 100);
iosExpoureNumList.add(600 - i * 60);
androidExpoureNumList.add(400 - i * 40);
totalActiveList.add(2000 - i * 200);
iosActiveList.add(1500 - i * 150);
androidActiveList.add(500 - i * 50);
totalNewUdidList.add(100 - i * 10);
iosNewUdidList.add(70 - i * 7);
androidNewUdidList.add(30 - i * 3);
}
mktReportFormRspBO.setDateIdStrList(dateIdStrList);
mktReportFormRspBO.setTotalActualCostList(totalActuralCostList);
mktReportFormRspBO.setIosActualCostList(iosActualCostList);
mktReportFormRspBO.setAndroidActualCost(androidActualCostList);
mktReportFormRspBO.setTotalExpoureNumList(totalExpoureNumList);
mktReportFormRspBO.setIosExpoureNumList(iosExpoureNumList);
mktReportFormRspBO.setAndroidExpoureNumList(androidExpoureNumList);
mktReportFormRspBO.setTotalAppActiveList(totalActiveList);
mktReportFormRspBO.setIosAppActiveList(iosActiveList);
mktReportFormRspBO.setAndroidAppActiveList(androidActiveList);
mktReportFormRspBO.setTotalNewUserList(totalNewUdidList);
mktReportFormRspBO.setIosNewUserList(iosNewUdidList);
mktReportFormRspBO.setAndroidNewUserList(androidNewUdidList);
mktReportFormRspBO.setMaxActualCost(500);
mktReportFormRspBO.setMaxAppActive(400);
mktReportFormRspBO.setMaxExpoureNum(300);
mktReportFormRspBO.setMaxNewUdid(200);
result.toJson(mktReportFormRspBO);
return new ApiResponse.ApiResponseBuilder().code(200).data(result).message("success").build();
} catch (Exception e){
logger.warn("getMktReportForm occurs Exception e {}",e.getMessage());
return new ApiResponse.ApiResponseBuilder().code(500).message("失败").build();
}
}
}
... ...