|
@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
+import com.cloudcross.ssp.base.dao.GenericIBatisDao;
|
|
|
import com.cloudcross.ssp.base.utils.freemarker.FreemarkerTemplateProcessor;
|
|
|
import com.cloudcross.ssp.base.web.SimpleController;
|
|
|
import com.cloudcross.ssp.common.utils.Pager;
|
|
@@ -45,7 +46,8 @@ public class AdvertiserReportController extends SimpleController {
|
|
|
private IDimensionService dimensionService;
|
|
|
@Autowired
|
|
|
private FreemarkerTemplateProcessor templateProcessor;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private GenericIBatisDao iBatisDao;
|
|
|
@RequestMapping
|
|
|
public String index(Model model,
|
|
|
@RequestParam HashMap<String, Object> paramMap,
|
|
@@ -195,20 +197,50 @@ public class AdvertiserReportController extends SimpleController {
|
|
|
paramMap.put("dimensionId", dimensionId);
|
|
|
paramMap.put("selecteddimensionName", dimensionName);
|
|
|
|
|
|
- int totalRow = adReportService.findCountForDeliverEffectAnalysisBack(paramMap);
|
|
|
+ //维度更新表格
|
|
|
+ if(dimensionId == null){
|
|
|
+ HashMap<String,Object> dimensionmap = dimensionService.selectDimensionIdBydefault(account.getId());
|
|
|
+ if(Integer.parseInt(dimensionmap.get("num").toString()) == 0){
|
|
|
+ model.addAttribute("dimensionLength",null);
|
|
|
+ model.addAttribute("dimensionTarget",null);
|
|
|
+ }else{
|
|
|
+ dimensionId = Long.valueOf(dimensionmap.get("id").toString());
|
|
|
+ paramMap.put("selecteddimensionName", dimensionmap.get("name"));
|
|
|
+ paramMap.put("dimensionId", dimensionId);
|
|
|
+ List<HashMap<String,Object>> list = getDimensionById(dimensionId);
|
|
|
+ if(list.size() >0 ){
|
|
|
+ model.addAttribute("dimensionLength",list.size());
|
|
|
+ model.addAttribute("dimensionTarget",list);
|
|
|
+ paramMap.put("dimensionStr", list.get(list.size()-1).get("dimensionStr"));
|
|
|
+ }else{
|
|
|
+ model.addAttribute("dimensionLength",null);
|
|
|
+ model.addAttribute("dimensionTarget",null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if(dimensionId == -1){
|
|
|
+ model.addAttribute("dimensionLength",null);
|
|
|
+ model.addAttribute("dimensionTarget",null);
|
|
|
+ }else{
|
|
|
+ List<HashMap<String,Object>> list = getDimensionById(dimensionId);
|
|
|
+ if(list.size() >0 ){
|
|
|
+ model.addAttribute("dimensionLength",list.size());
|
|
|
+ model.addAttribute("dimensionTarget",list);
|
|
|
+ paramMap.put("dimensionStr", list.get(list.size()-1).get("dimensionStr"));
|
|
|
+ }else{
|
|
|
+ model.addAttribute("dimensionLength",null);
|
|
|
+ model.addAttribute("dimensionTarget",null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+ int totalRow = adReportService.findCountForDeliverEffectAnalysisAdvertiser(paramMap);
|
|
|
Pager pager = new Pager();
|
|
|
pager.setPage(page);
|
|
|
pager.setTotalRow(totalRow);
|
|
|
|
|
|
- List<DeliverAnalysis> reportList = adReportService.findByTotalReportBack(paramMap, pager);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ List<DeliverAnalysis> reportList = adReportService.findByTotalReportAdvertiser(paramMap, pager);
|
|
|
|
|
|
-
|
|
|
- //若是没有符合条件的数据,则对应的选项皆显示为0
|
|
|
+ //若是没有符合条件的数据,则对应的选项皆显示为0
|
|
|
if(reportList.size() == 0){
|
|
|
DeliverAnalysis map = new DeliverAnalysis();
|
|
|
DeliverAnalysis deliver = new DeliverAnalysis();
|
|
@@ -224,26 +256,45 @@ public class AdvertiserReportController extends SimpleController {
|
|
|
map = deliver;
|
|
|
|
|
|
model.addAttribute("reportMap", map);
|
|
|
+ }else {
|
|
|
+ double impressionSum = 0;
|
|
|
+ double clickSum = 0;
|
|
|
+ double visitSum = 0;
|
|
|
+ double conversionSum = 0;
|
|
|
+ double consumeSum = 0;
|
|
|
+ double eCmpSum = 0;
|
|
|
+ double clickRatesum = 0;
|
|
|
+ double visitRatesum = 0;
|
|
|
+ double conversionRatesum = 0;
|
|
|
+ for(DeliverAnalysis d :reportList){
|
|
|
+ impressionSum = impressionSum+d.getImpression();
|
|
|
+ clickSum = clickSum + d.getClick();
|
|
|
+ visitSum = visitSum + d.getVisit();
|
|
|
+ conversionSum = conversionSum + d.getConversion();
|
|
|
+ consumeSum = consumeSum + d.getConsume();
|
|
|
+ eCmpSum = eCmpSum + d.geteCmp();
|
|
|
+
|
|
|
}
|
|
|
- else {
|
|
|
+ clickRatesum = 100*clickSum/impressionSum;
|
|
|
+ visitRatesum = 100*visitSum/clickSum;
|
|
|
+ conversionRatesum = 100*conversionSum/visitSum;
|
|
|
+
|
|
|
//数据报表中第一栏 全部 的显示
|
|
|
HashMap<String,Double> map = new HashMap<String,Double>();
|
|
|
- map.put("impressionSum", reportList.get(0).getImpressionSum());
|
|
|
- map.put("clickSum", reportList.get(0).getClickSum());
|
|
|
- map.put("visitSum", reportList.get(0).getVisitSum());
|
|
|
- map.put("conversionSum", reportList.get(0).getConversionSum());
|
|
|
- map.put("consumeSum", reportList.get(0).getConsumeSum());
|
|
|
- map.put("eCmpSum", reportList.get(0).geteCmpSum());
|
|
|
- map.put("clickRatesum", reportList.get(0).getClickRatesum());
|
|
|
- map.put("visitRatesum", reportList.get(0).getVisitRatesum());
|
|
|
- map.put("conversionRatesum", reportList.get(0).getConversionRatesum());
|
|
|
+ map.put("impressionSum", impressionSum);
|
|
|
+ map.put("clickSum", clickSum);
|
|
|
+ map.put("visitSum", visitSum);
|
|
|
+ map.put("conversionSum", conversionSum);
|
|
|
+ map.put("consumeSum", consumeSum);
|
|
|
+ map.put("eCmpSum", eCmpSum);
|
|
|
+ map.put("clickRatesum", clickRatesum);
|
|
|
+ map.put("visitRatesum", visitRatesum);
|
|
|
+ map.put("conversionRatesum", conversionRatesum);
|
|
|
model.addAttribute("reportMap", map);
|
|
|
- System.out.println("tttttttttt");
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
if(null == paramMap.get("advertiserId")) {
|
|
|
paramMap.put("selectedadvertiserId", "-1");
|
|
|
} else {
|
|
@@ -265,40 +316,6 @@ public class AdvertiserReportController extends SimpleController {
|
|
|
paramMap.put("selectedadgroupId", paramMap.get("adgroupId"));
|
|
|
}
|
|
|
|
|
|
- //维度更新表格
|
|
|
- if(dimensionId == null){
|
|
|
- HashMap<String,Object> dimensionmap =null; //dimensionService.selectDimensionIdBydefault();
|
|
|
- if(Integer.parseInt(dimensionmap.get("num").toString()) == 0){
|
|
|
- model.addAttribute("dimensionLength",null);
|
|
|
- model.addAttribute("dimensionTarget",null);
|
|
|
- }else{
|
|
|
- dimensionId = Long.valueOf(dimensionmap.get("id").toString());
|
|
|
- paramMap.put("selecteddimensionName", dimensionmap.get("name"));
|
|
|
- paramMap.put("dimensionId", dimensionId);
|
|
|
- List<HashMap<String,Object>> list = getDimensionById(dimensionId);
|
|
|
- if(list.size() >0 ){
|
|
|
- model.addAttribute("dimensionLength",list.size());
|
|
|
- model.addAttribute("dimensionTarget",list);
|
|
|
-
|
|
|
- }else{
|
|
|
- model.addAttribute("dimensionLength",null);
|
|
|
- model.addAttribute("dimensionTarget",null);
|
|
|
- }
|
|
|
- }
|
|
|
- }else if(dimensionId == -1){
|
|
|
- model.addAttribute("dimensionLength",null);
|
|
|
- model.addAttribute("dimensionTarget",null);
|
|
|
- }else{
|
|
|
- List<HashMap<String,Object>> list = getDimensionById(dimensionId);
|
|
|
- if(list.size() >0 ){
|
|
|
- model.addAttribute("dimensionLength",list.size());
|
|
|
- model.addAttribute("dimensionTarget",list);
|
|
|
-
|
|
|
- }else{
|
|
|
- model.addAttribute("dimensionLength",null);
|
|
|
- model.addAttribute("dimensionTarget",null);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
model.addAllAttributes(paramMap);
|
|
|
model.addAttribute("pager", pager);
|
|
@@ -326,82 +343,6 @@ public class AdvertiserReportController extends SimpleController {
|
|
|
|
|
|
return page("dimension");
|
|
|
}
|
|
|
-
|
|
|
- //维度管理
|
|
|
- @RequestMapping("/dimensionlist")
|
|
|
- public @ResponseBody List<Dimension> dimensionlist(Model model,
|
|
|
- @RequestParam HashMap<String, Object> paramMap,
|
|
|
- @RequestParam(defaultValue="1") int page) {
|
|
|
- List<Dimension> dimensionList = dimensionService.findByParams(paramMap, null);
|
|
|
- return dimensionList;
|
|
|
- }
|
|
|
-
|
|
|
- //增加维度
|
|
|
- @RequestMapping("/create")
|
|
|
- public String create() {
|
|
|
-
|
|
|
- return page("create");
|
|
|
- }
|
|
|
-
|
|
|
- //编辑维度
|
|
|
- @RequestMapping("/edit")
|
|
|
- public String edit(Model model,
|
|
|
- @RequestParam long id) {
|
|
|
- // 根据id从数据库中查询广告主对象。
|
|
|
- Dimension dimension = dimensionService.findById(id);
|
|
|
- String content = dimension.getContent();
|
|
|
- List<String> alllist = new ArrayList<String>();
|
|
|
- List<String> list = new ArrayList<String>();
|
|
|
- String[] allType = {"广告主","订单","活动","投放","创意","日期"};
|
|
|
- for (int i = 0; i < allType.length; i++) {
|
|
|
- alllist.add(allType[i]);
|
|
|
- }
|
|
|
- if(content!=null && !"".equals(content)){
|
|
|
- String[] contentArr = content.split("-");
|
|
|
- for (int j = 0; j < contentArr.length; j++) {
|
|
|
- if(alllist.contains(contentArr[j])){
|
|
|
- list.add(contentArr[j]);
|
|
|
- alllist.remove(contentArr[j]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- model.addAttribute("dimensionTypeList", list);
|
|
|
- model.addAttribute("notdimensionTypeList", alllist);
|
|
|
- model.addAttribute("dimension", dimension);
|
|
|
- return page("edit");
|
|
|
- }
|
|
|
-
|
|
|
- //删除
|
|
|
- @RequestMapping("/delete")
|
|
|
- public @ResponseBody
|
|
|
- String delete(Long[] id) {
|
|
|
- HashMap<String, Object> paramMap = new HashMap<String, Object>();
|
|
|
- if (ArrayUtils.isNotEmpty(id)) {
|
|
|
- paramMap.put("idList", id);
|
|
|
- dimensionService.deleteById(paramMap);
|
|
|
- }
|
|
|
- return OK;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //保存
|
|
|
- @RequestMapping("/save")
|
|
|
- public String save(
|
|
|
- @ModelAttribute("form") Dimension dimension) {
|
|
|
- // 校验参数
|
|
|
-
|
|
|
- System.out.println("ccc"+dimension.toString());
|
|
|
- System.out.println("ccc"+dimension.getId());
|
|
|
- if (dimension.getId() == null){
|
|
|
- dimensionService.add(dimension);
|
|
|
-
|
|
|
- }else{
|
|
|
- dimensionService.edit(dimension);
|
|
|
- }
|
|
|
- return redirect(page("dimension"));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
//下面是地域报表
|
|
|
|
|
|
@RequestMapping("/regionReport")
|
|
@@ -1261,47 +1202,235 @@ public class AdvertiserReportController extends SimpleController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //维度管理
|
|
|
- public List<HashMap<String,Object>> getDimensionById(
|
|
|
- @RequestParam long dimensionId) {
|
|
|
- List<HashMap<String,Object>> list = new ArrayList<HashMap<String,Object>>();
|
|
|
- Dimension dimension = dimensionService.findById(dimensionId);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 维度管理
|
|
|
+ */
|
|
|
+ //带分页的维度管理list页面
|
|
|
+ @RequestMapping("/dimension")
|
|
|
+ public String queryDimensionList(Model model,@RequestParam HashMap<String, Object> paramMap,@RequestParam(defaultValue="1") int page) {
|
|
|
+ //将当前登录账户ID放入Map中
|
|
|
+ paramMap.put("accountId", getLoginUser().getId());
|
|
|
+ //查询满足条件的维度记录总数
|
|
|
+ int totalRow = dimensionService.countByParams(paramMap);
|
|
|
+ //分页信息
|
|
|
+ Pager pager = new Pager();
|
|
|
+ pager.setPage(page);
|
|
|
+ pager.setTotalRow(totalRow);
|
|
|
+ //带分页的维度记录
|
|
|
+ List<Dimension> dimensionList = dimensionService.findByParams(paramMap, pager);
|
|
|
+
|
|
|
+ //model.addAllAttributes(paramMap);
|
|
|
+ //将查询结构放入model中,传到前台
|
|
|
+ model.addAttribute("pager", pager);
|
|
|
+ model.addAttribute("dimensionList", dimensionList);
|
|
|
+
|
|
|
+ return page("dimension");
|
|
|
+ }
|
|
|
+
|
|
|
+ //增加维度页面
|
|
|
+ @RequestMapping("/create")
|
|
|
+ public String create(Model model){
|
|
|
+ model.addAttribute("accountId", getLoginUser().getId());
|
|
|
+ return page("create");
|
|
|
+ }
|
|
|
+
|
|
|
+ //编辑维度
|
|
|
+ @RequestMapping("/edit")
|
|
|
+ public String edit(Model model,@RequestParam long id) {
|
|
|
+ //根据id查询维度。
|
|
|
+ Dimension dimension = dimensionService.findById(id);
|
|
|
+ //获取维度方案(以“-”间隔,如“A-B-C”)
|
|
|
String content = dimension.getContent();
|
|
|
- if(content != null && !"".equals(content)){
|
|
|
+ List<String> alllist = new ArrayList<String>();
|
|
|
+ List<String> list = new ArrayList<String>();
|
|
|
+ String[] allType = {"广告主","订单","活动","投放","创意","日期"};
|
|
|
+ for (int i = 0; i < allType.length; i++) {
|
|
|
+ alllist.add(allType[i]);//保存维度的所有方案
|
|
|
+ }
|
|
|
+ if(content!=null && !"".equals(content)){
|
|
|
+ //将组合维度方案拆分成
|
|
|
String[] contentArr = content.split("-");
|
|
|
- for (int i = 0; i < contentArr.length; i++) {
|
|
|
- HashMap<String,Object> map = new HashMap<String,Object>();
|
|
|
- map.put("dimension", contentArr[i]);
|
|
|
- map.put("dimensionTarget", getDimensionType(contentArr[i]));
|
|
|
- list.add(map);
|
|
|
+ for (int j = 0; j < contentArr.length; j++) {
|
|
|
+ if(alllist.contains(contentArr[j])){
|
|
|
+ list.add(contentArr[j]);//已选的维度方案
|
|
|
+ alllist.remove(contentArr[j]);//移除已选的维度方案,最终剩下未选的维度方案
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- return list;
|
|
|
+ model.addAttribute("accountId", getLoginUser().getId());
|
|
|
+ model.addAttribute("dimensionTypeList", list);
|
|
|
+ model.addAttribute("notdimensionTypeList", alllist);
|
|
|
+ model.addAttribute("dimension", dimension);
|
|
|
+ return page("edit");
|
|
|
+ }
|
|
|
+
|
|
|
+ //判断名称或类型是否存在
|
|
|
+ @RequestMapping("/isExist")
|
|
|
+ @ResponseBody
|
|
|
+ public String isExist(@ModelAttribute("form") Dimension dimension){
|
|
|
+ String success = "";
|
|
|
+
|
|
|
+ //添加或修改前判断name或content是否已存在
|
|
|
+ String name = dimension.getName();
|
|
|
+ String content = dimension.getContent();
|
|
|
+ Integer accountId = getLoginUser().getId();
|
|
|
+ List<Dimension> nameList = queryDimensionByNameAndAccountId(name,accountId);
|
|
|
+ List<Dimension> contentList = queryDimensionByContentAndAccountId(content,accountId);
|
|
|
+
|
|
|
+
|
|
|
+ //修改后根据ID来更新当前记录
|
|
|
+ //dimensionService.edit(dimension);
|
|
|
+ //修改页面和添加页面公用按钮,用ID来区分是添加还是修改
|
|
|
+ if (dimension.getId() == null){//id在数据库中自增长,新增的时候ID为null还没有生成
|
|
|
+ if(nameList.size()>0){//维度名称已存在
|
|
|
+ success = "YES";
|
|
|
+ return success;
|
|
|
+ }
|
|
|
+ if(contentList.size()>0){//维度方案已存在
|
|
|
+ success = "YES";
|
|
|
+ return success;
|
|
|
+ }
|
|
|
+ success = "NO";
|
|
|
+ }else{//修改保存
|
|
|
+ //修改前的维度记录
|
|
|
+ Dimension dimensioned = dimensionService.findById(dimension.getId());
|
|
|
+ //只修改了name
|
|
|
+ if(!dimensioned.getName().equals(dimension.getName())&&dimensioned.getContent().equals(dimension.getContent())){
|
|
|
+ //判断name是否存在
|
|
|
+ if(nameList.size() > 0){//维度名称已存在
|
|
|
+ success = "YES";
|
|
|
+ }else{//存在
|
|
|
+ success = "NO";//不存在
|
|
|
+ }
|
|
|
+ }else if(dimensioned.getName().equals(dimension.getName())&&!dimensioned.getContent().equals(dimension.getContent())){
|
|
|
+ //只修改了维度方案
|
|
|
+ //判断维度方案是否存在
|
|
|
+ if(contentList.size() > 0){
|
|
|
+ success = "YES";//维度方案已存在
|
|
|
+ }else{
|
|
|
+ success = "NO";
|
|
|
+ }
|
|
|
+ }else if(!dimensioned.getName().equals(dimension.getName())&&!dimensioned.getContent().equals(dimension.getContent())){
|
|
|
+ //维度名称,方案都修改
|
|
|
+ if(nameList.size() > 0){
|
|
|
+ success = "YES";//维度名称存在
|
|
|
+ return success;
|
|
|
+ }
|
|
|
+ if(contentList.size() > 0){
|
|
|
+ success = "YES";//维度方案存在
|
|
|
+ return success;
|
|
|
+ }
|
|
|
+ success = "NO";//不存在
|
|
|
+ }else{//没做任何修改
|
|
|
+ success = "NO";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return success;
|
|
|
+ }
|
|
|
+ //维度新增或修改页面保存功能
|
|
|
+ @RequestMapping("/save")
|
|
|
+ public String save(@ModelAttribute("form") Dimension dimension){
|
|
|
+ //修改页面和添加页面公用按钮,用ID来区分是添加还是修改
|
|
|
+ if (dimension.getId() == null){//id在数据库中自增长,新增的时候ID为null还没有生成
|
|
|
+ dimensionService.add(dimension);
|
|
|
+ }else{//修改保存
|
|
|
+ dimensionService.edit(dimension);
|
|
|
+ }
|
|
|
+ return redirect(page("dimension"));
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Dimension> queryDimensionByNameAndAccountId(String name,Integer accountId){
|
|
|
+ Map<String,Object> map = new HashMap<String,Object>();
|
|
|
+ map.put("name", name);
|
|
|
+ map.put("accountId", accountId);
|
|
|
+ return iBatisDao.getList("dimensionSqlMapper.queryDimensionByNameAndAccountId", map);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Dimension> queryDimensionByContentAndAccountId(String content,Integer accountId){
|
|
|
+ Map<String,Object> map = new HashMap<String,Object>();
|
|
|
+ map.put("content", content);
|
|
|
+ map.put("accountId", accountId);
|
|
|
+ return iBatisDao.getList("dimensionSqlMapper.queryDimensionByContentAndAccountId", map);
|
|
|
}
|
|
|
|
|
|
- public String getDimensionType(String dimension){
|
|
|
- String type = "";
|
|
|
- if(dimension.equals("广告主")){
|
|
|
- type = "advertiserName";
|
|
|
- }else if(dimension.equals("订单")){
|
|
|
- type = "orderName";
|
|
|
- }else if(dimension.equals("活动")){
|
|
|
- type = "campaignName";
|
|
|
- }else if(dimension.equals("投放")){
|
|
|
- type = "adGroupName";
|
|
|
- }else if(dimension.equals("创意")){
|
|
|
- type = "bannerName";
|
|
|
- }else if(dimension.equals("日期")){
|
|
|
- type = "reportDate";
|
|
|
+
|
|
|
+ //删除
|
|
|
+ @RequestMapping("/delete")
|
|
|
+ public @ResponseBody String delete(Long[] id) {
|
|
|
+ HashMap<String, Object> paramMap = new HashMap<String, Object>();
|
|
|
+ if (ArrayUtils.isNotEmpty(id)) {
|
|
|
+ paramMap.put("idList", id);
|
|
|
+ dimensionService.deleteById(paramMap);
|
|
|
}
|
|
|
- return type;
|
|
|
+ return OK;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //维度管理---下拉框的值
|
|
|
+ @RequestMapping("/dimensionlist")
|
|
|
+ public @ResponseBody List<Dimension> dimensionlist(Model model,
|
|
|
+ @RequestParam HashMap<String, Object> paramMap,
|
|
|
+ @RequestParam(defaultValue="1") int page) {
|
|
|
+ Account account = getLoginUser();
|
|
|
+ paramMap.put("accountId", account.getId());
|
|
|
+ List<Dimension> dimensionList = dimensionService.findByParams(paramMap, null);
|
|
|
+ return dimensionList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//修改默认值
|
|
|
@RequestMapping("/updateDimensionDefault")
|
|
|
public @ResponseBody String updateDimensionDefault(@RequestParam long dimensionId){
|
|
|
- //dimensionService.updateDimensionDefault(dimensionId);
|
|
|
+ Dimension dimension = this.dimensionService.findById(dimensionId);
|
|
|
+ dimensionService.updateDimensionDefault(dimension);
|
|
|
return OK;
|
|
|
}
|
|
|
|
|
|
+ //维度管理
|
|
|
+ public List<HashMap<String,Object>> getDimensionById(
|
|
|
+ @RequestParam long dimensionId) {
|
|
|
+ List<HashMap<String,Object>> list = new ArrayList<HashMap<String,Object>>();
|
|
|
+ Dimension dimension = dimensionService.findById(dimensionId);
|
|
|
+ String content = dimension.getContent();
|
|
|
+ if(content != null && !"".equals(content)){
|
|
|
+ String[] contentArr = content.split("-");
|
|
|
+ String dimensionStr = "";
|
|
|
+ HashMap<String,Object> map = new HashMap<String,Object>();
|
|
|
+ for (int i = 0; i < contentArr.length; i++) {
|
|
|
+ map.put("dimension", contentArr[i]);
|
|
|
+ map.put("dimensionTarget", getDimensionType(contentArr[i]));
|
|
|
+ dimensionStr += getDimensionType(contentArr[i])+",";
|
|
|
+ if(i == contentArr.length-1 && dimensionStr != ""){
|
|
|
+ dimensionStr = dimensionStr.substring(0,dimensionStr.length()-1);
|
|
|
+ map.put("dimensionStr", dimensionStr);
|
|
|
+ }
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getDimensionType(String dimension){
|
|
|
+ String type = "";
|
|
|
+ if(dimension.equals("广告主")){
|
|
|
+ type = "advertiserName";
|
|
|
+ }else if(dimension.equals("订单")){
|
|
|
+ type = "orderName";
|
|
|
+ }else if(dimension.equals("活动")){
|
|
|
+ type = "campaignName";
|
|
|
+ }else if(dimension.equals("投放")){
|
|
|
+ type = "adGroupName";
|
|
|
+ }else if(dimension.equals("创意")){
|
|
|
+ type = "bannerName";
|
|
|
+ }else if(dimension.equals("日期")){
|
|
|
+ type = "reportDate";
|
|
|
+ }
|
|
|
+ return type;
|
|
|
+ }
|
|
|
+
|
|
|
}
|