|
|
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;
|
|
|
|
...
|
...
|
@@ -61,6 +50,15 @@ public class MktCostReportFormController { |
|
|
List<Integer> totalNewUdidList = Lists.newArrayList();
|
|
|
List<Integer> iosNewUdidList = Lists.newArrayList();
|
|
|
List<Integer> androidNewUdidList = Lists.newArrayList();
|
|
|
List<BigDecimal> totalActiveRatio = Lists.newArrayList();
|
|
|
List<BigDecimal> iosActiveRatio = Lists.newArrayList();
|
|
|
List<BigDecimal> androidActiveRatio = Lists.newArrayList();
|
|
|
List<BigDecimal> totalExpoureRatio = Lists.newArrayList();
|
|
|
List<BigDecimal> iosExpoureRatio = Lists.newArrayList();
|
|
|
List<BigDecimal> androidExpoureRatio = Lists.newArrayList();
|
|
|
List<BigDecimal> totalNewUdidRatio = Lists.newArrayList();
|
|
|
List<BigDecimal> iosNewUdidRatio = Lists.newArrayList();
|
|
|
List<BigDecimal> androidNewUdidRatio = Lists.newArrayList();
|
|
|
|
|
|
for (Integer i = 6; i >=0; i--){
|
|
|
dateIdStrList.add("2017042" + i.toString());
|
...
|
...
|
@@ -76,6 +74,16 @@ public class MktCostReportFormController { |
|
|
totalNewUdidList.add(100 - i * 10);
|
|
|
iosNewUdidList.add(70 - i * 7);
|
|
|
androidNewUdidList.add(30 - i * 3);
|
|
|
|
|
|
totalActiveRatio.add(getDivideData(totalActuralCostList.get(i), new BigDecimal(totalActiveList.get(i))));
|
|
|
iosActiveRatio.add(getDivideData(iosActualCostList.get(i), new BigDecimal(iosActiveList.get(i))));
|
|
|
androidActiveRatio.add(getDivideData(androidActualCostList.get(i), new BigDecimal(androidActiveList.get(i))));
|
|
|
totalExpoureRatio.add(getDivideData(totalActuralCostList.get(i), new BigDecimal(totalExpoureNumList.get(i))));
|
|
|
iosExpoureRatio.add(getDivideData(iosActualCostList.get(i), new BigDecimal(iosExpoureNumList.get(i))));
|
|
|
androidExpoureRatio.add(getDivideData(androidActualCostList.get(i), new BigDecimal(androidExpoureNumList.get(i))));
|
|
|
totalNewUdidRatio.add(getDivideData(totalActuralCostList.get(i), new BigDecimal(totalNewUdidList.get(i))));
|
|
|
iosNewUdidRatio.add(getDivideData(iosActualCostList.get(i), new BigDecimal(iosNewUdidList.get(i))));
|
|
|
androidActiveRatio.add(getDivideData(androidActualCostList.get(i), new BigDecimal(androidNewUdidList.get(i))));
|
|
|
}
|
|
|
|
|
|
mktReportFormRspBO.setDateIdStrList(dateIdStrList);
|
...
|
...
|
@@ -91,12 +99,10 @@ public class MktCostReportFormController { |
|
|
mktReportFormRspBO.setTotalNewUserList(totalNewUdidList);
|
|
|
mktReportFormRspBO.setIosNewUserList(iosNewUdidList);
|
|
|
mktReportFormRspBO.setAndroidNewUserList(androidNewUdidList);
|
|
|
mktReportFormRspBO.setMaxActualCost(500);
|
|
|
mktReportFormRspBO.setMaxAppActive(400);
|
|
|
mktReportFormRspBO.setMaxExpoureNum(300);
|
|
|
mktReportFormRspBO.setMaxNewUdid(200);
|
|
|
|
|
|
|
|
|
mktReportFormRspBO.setTopActualCost(5000);
|
|
|
mktReportFormRspBO.setTopAppActive(1000);
|
|
|
mktReportFormRspBO.setTopExpoureNum(2000);
|
|
|
mktReportFormRspBO.setTopNewUdid(100);
|
|
|
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).data(mktReportFormRspBO).message("success").build();
|
|
|
} catch (Exception e){
|
...
|
...
|
@@ -105,4 +111,12 @@ public class MktCostReportFormController { |
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private BigDecimal getDivideData(BigDecimal d1,BigDecimal d2){
|
|
|
|
|
|
if(d2.compareTo(new BigDecimal(0)) == 0){
|
|
|
return new BigDecimal(0);
|
|
|
}
|
|
|
return d1.divide(d2,2,BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
} |
...
|
...
|
|