Browse Source

Merge branch 'master' of http://git.yaozhitech.com/yinli/yangguang

chenjz 3 years ago
parent
commit
8cced928b3

+ 23 - 1
src/main/java/com/ylcm/sys/controller/SpecialAnalysisController.java

@@ -1,5 +1,7 @@
1 1
 package com.ylcm.sys.controller;
2 2
 
3
+import java.util.List;
4
+
3 5
 import javax.annotation.Resource;
4 6
 import javax.servlet.http.HttpServletResponse;
5 7
 
@@ -8,9 +10,11 @@ import org.springframework.ui.ModelMap;
8 10
 import org.springframework.web.bind.annotation.RequestMapping;
9 11
 
10 12
 import com.baomidou.mybatisplus.core.metadata.IPage;
13
+import com.ylcm.sys.common.Constants;
11 14
 import com.ylcm.sys.form.AdSpecialAnalysisQueryForm;
12 15
 import com.ylcm.sys.service.SpecialAnalysisService;
13 16
 import com.ylcm.sys.vo.AdSpecialAnalysisVO;
17
+import com.ylcm.sys.vo.AdSpecialTopVO;
14 18
 
15 19
 import lombok.extern.slf4j.Slf4j;
16 20
 import net.sf.json.JSONObject;
@@ -30,7 +34,7 @@ public class SpecialAnalysisController extends BaseController{
30 34
 		return "analysis/special_analysis";
31 35
 	}
32 36
 	
33
-	@RequestMapping(value = "/ajax_brand_analysis_list.do")
37
+	@RequestMapping(value = "/ajax_special_analysis_list.do")
34 38
 	public void ajaxSearchList(HttpServletResponse response, AdSpecialAnalysisQueryForm queryForm) {
35 39
 		try {
36 40
 			
@@ -40,6 +44,24 @@ public class SpecialAnalysisController extends BaseController{
40 44
 			 */
41 45
 			JSONObject jsonobj = new JSONObject();
42 46
 			jsonobj.put("data", page);
47
+			jsonobj.put("code", Constants.CODE_SUCCESS);
48
+			ajaxJson(jsonobj.toString(), response);
49
+		} catch (Exception e) {
50
+			log.error(e.getMessage(), e);
51
+			ajaxJson("{\"code\":\"0\",\"msg\":\"获取列表失败\"}", response);
52
+		}
53
+	}
54
+	
55
+	//产品专题广告投放排名
56
+	@RequestMapping(value = "/list_special_product_rank.do")
57
+	public void list_special_product_rank(HttpServletResponse response, Integer type, String startDate, String endDate) {
58
+		try {
59
+			
60
+			List<AdSpecialTopVO> list = specialAnalysisService.specialTop(type, startDate, endDate);
61
+			
62
+			JSONObject jsonobj = new JSONObject();
63
+			jsonobj.put("data", list);
64
+			jsonobj.put("code", Constants.CODE_SUCCESS);
43 65
 			ajaxJson(jsonobj.toString(), response);
44 66
 		} catch (Exception e) {
45 67
 			log.error(e.getMessage(), e);

+ 10 - 0
src/main/java/com/ylcm/sys/mapper/AdSpecialMapper.java

@@ -1,5 +1,7 @@
1 1
 package com.ylcm.sys.mapper;
2 2
 
3
+import java.util.List;
4
+
3 5
 import org.apache.ibatis.annotations.Param;
4 6
 
5 7
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -7,6 +9,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
7 9
 import com.ylcm.sys.domain.AdSpecial;
8 10
 import com.ylcm.sys.form.AdSpecialAnalysisQueryForm;
9 11
 import com.ylcm.sys.vo.AdSpecialAnalysisVO;
12
+import com.ylcm.sys.vo.AdSpecialTopVO;
10 13
 
11 14
 /**
12 15
  * <p>
@@ -19,4 +22,11 @@ import com.ylcm.sys.vo.AdSpecialAnalysisVO;
19 22
 public interface AdSpecialMapper extends BaseMapper<AdSpecial> {
20 23
 
21 24
 	IPage<AdSpecialAnalysisVO> getPage(IPage<AdSpecial> page, @Param("queryBean") AdSpecialAnalysisQueryForm analysisQueryForm);
25
+	
26
+	/**
27
+	 * 产品专题广告投放排名
28
+	 * @param type
29
+	 * @return
30
+	 */
31
+	List<AdSpecialTopVO> specialTop(@Param("type") Integer type, @Param("startDate") String startDate, @Param("endDate") String endDate);
22 32
 }

+ 9 - 0
src/main/java/com/ylcm/sys/service/SpecialAnalysisService.java

@@ -1,8 +1,11 @@
1 1
 package com.ylcm.sys.service;
2 2
 
3
+import java.util.List;
4
+
3 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 6
 import com.ylcm.sys.form.AdSpecialAnalysisQueryForm;
5 7
 import com.ylcm.sys.vo.AdSpecialAnalysisVO;
8
+import com.ylcm.sys.vo.AdSpecialTopVO;
6 9
 
7 10
 
8 11
 public interface SpecialAnalysisService {
@@ -12,4 +15,10 @@ public interface SpecialAnalysisService {
12 15
 	 * @return
13 16
 	 */
14 17
 	IPage<AdSpecialAnalysisVO> page(AdSpecialAnalysisQueryForm queryForm);
18
+	
19
+	/**
20
+	 * 专题top30
21
+	 * @param type 0产品 1栏目
22
+	 */
23
+	List<AdSpecialTopVO> specialTop(Integer type, String startDate, String endDate);
15 24
 }

+ 9 - 0
src/main/java/com/ylcm/sys/service/impl/SpecialAnalysisServiceImpl.java

@@ -1,5 +1,7 @@
1 1
 package com.ylcm.sys.service.impl;
2 2
 
3
+import java.util.List;
4
+
3 5
 import javax.annotation.Resource;
4 6
 
5 7
 import org.springframework.stereotype.Service;
@@ -11,6 +13,7 @@ import com.ylcm.sys.form.AdSpecialAnalysisQueryForm;
11 13
 import com.ylcm.sys.mapper.AdSpecialMapper;
12 14
 import com.ylcm.sys.service.SpecialAnalysisService;
13 15
 import com.ylcm.sys.vo.AdSpecialAnalysisVO;
16
+import com.ylcm.sys.vo.AdSpecialTopVO;
14 17
 
15 18
 @Service
16 19
 public class SpecialAnalysisServiceImpl implements SpecialAnalysisService {
@@ -23,5 +26,11 @@ public class SpecialAnalysisServiceImpl implements SpecialAnalysisService {
23 26
 		return adSpecialMapper.getPage(new Page<AdSpecial>(queryForm.getPageNo(), queryForm.getPageSize()), queryForm);
24 27
 	}
25 28
 
29
+	@Override
30
+	public List<AdSpecialTopVO> specialTop(Integer type, String startDate, String endDate) {
31
+		return adSpecialMapper.specialTop(type, startDate, endDate);
32
+	}
33
+
34
+	
26 35
 	
27 36
 }

+ 52 - 0
src/main/java/com/ylcm/sys/task/SpecialTopTask.java

@@ -0,0 +1,52 @@
1
+package com.ylcm.sys.task;
2
+
3
+import java.time.LocalDate;
4
+import java.time.format.DateTimeFormatter;
5
+
6
+import org.springframework.scheduling.annotation.Scheduled;
7
+import org.springframework.stereotype.Component;
8
+
9
+import com.ylcm.sys.service.SpecialAnalysisService;
10
+
11
+import lombok.extern.slf4j.Slf4j;
12
+
13
+@Component
14
+@Slf4j
15
+public class SpecialTopTask {
16
+
17
+	private SpecialAnalysisService specialAnalysisService;
18
+	/**
19
+	 * 一周的每天运行 产品专题广告投放排名
20
+	 */
21
+	@Scheduled(cron = "0 0 0/2 * * ?")
22
+	public void topTaskWeek(){
23
+		log.info("产品专题广告投放排名---start");
24
+		LocalDate now = LocalDate.now();
25
+		LocalDate day7before = now.minusDays(7);
26
+		specialAnalysisService.specialTop(0, now.format(DateTimeFormatter.ISO_DATE), day7before.format(DateTimeFormatter.ISO_DATE));
27
+		specialAnalysisService.specialTop(1, now.format(DateTimeFormatter.ISO_DATE), day7before.format(DateTimeFormatter.ISO_DATE));
28
+		log.info("产品专题广告投放排名---end");
29
+	}
30
+	
31
+	/**
32
+	 * 月的每天运行一次
33
+	 */
34
+	@Scheduled(cron = "0 0 1 * * ?")
35
+	public void topTaskMonth(){
36
+		log.info("产品专题广告投放排名---start");
37
+		LocalDate now = LocalDate.now();
38
+		LocalDate day7before = now.minusDays(30);
39
+		specialAnalysisService.specialTop(0, now.format(DateTimeFormatter.ISO_DATE), day7before.format(DateTimeFormatter.ISO_DATE));
40
+		specialAnalysisService.specialTop(1, now.format(DateTimeFormatter.ISO_DATE), day7before.format(DateTimeFormatter.ISO_DATE));
41
+		
42
+		LocalDate day365before = now.minusDays(365);
43
+		specialAnalysisService.specialTop(0, now.format(DateTimeFormatter.ISO_DATE), day365before.format(DateTimeFormatter.ISO_DATE));
44
+		specialAnalysisService.specialTop(1, now.format(DateTimeFormatter.ISO_DATE), day365before.format(DateTimeFormatter.ISO_DATE));
45
+		
46
+		log.info("产品专题广告投放排名---end");
47
+	}
48
+	
49
+	
50
+	
51
+	
52
+}

+ 0 - 2
src/main/java/com/ylcm/sys/vo/AdSpecialAnalysisVO.java

@@ -17,11 +17,9 @@ public class AdSpecialAnalysisVO {
17 17
     private String brandName;
18 18
     
19 19
     @ApiModelProperty(value = "一级行业")
20
-    @TableField("first_ind")
21 20
     private String firstInd;
22 21
 
23 22
     @ApiModelProperty(value = "二级行业")
24
-    @TableField("second_ind")
25 23
     private String secondInd;
26 24
 
27 25
     @ApiModelProperty(value = "广告主")

+ 20 - 0
src/main/java/com/ylcm/sys/vo/AdSpecialTopVO.java

@@ -0,0 +1,20 @@
1
+package com.ylcm.sys.vo;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Data;
5
+
6
+@Data
7
+public class AdSpecialTopVO {
8
+
9
+	@ApiModelProperty("产品/栏目名")
10
+	private String productName;
11
+	
12
+	@ApiModelProperty("一级行业")
13
+	private String firstInd;
14
+	
15
+	@ApiModelProperty("频次")
16
+	private Integer frequency;
17
+	
18
+	@ApiModelProperty("时长")
19
+	private Integer duration;
20
+}

+ 21 - 0
src/main/resource/mapper/AdSpecialMapper.xml

@@ -38,5 +38,26 @@
38 38
     		</if>
39 39
     	</where>
40 40
     </select>
41
+    
42
+    <select id="specialTop" resultType="com.ylcm.sys.vo.AdSpecialTopVO">
43
+    	SELECT 
44
+    		product_name,sum(show_duration) show_duration,SUM(1) frequency
45
+		FROM
46
+			ad_special
47
+		<where>
48
+			<if test="type != null">
49
+				AND type = 0
50
+			</if>
51
+			<if test="startDate != null and startDate != ''">
52
+				AND show_date >= #{startDate}
53
+			</if>
54
+			<if test="endDate != null and endDate != ''">
55
+				AND #{endDate} >= show_date
56
+			</if>
57
+		</where> 
58
+
59
+		GROUP BY product_name
60
+		ORDER BY sum(show_duration) DESC LIMIT 30
61
+    </select>
41 62
 
42 63
 </mapper>

+ 27 - 40
src/main/webapp/static/js/analysis/special_analysis.js

@@ -56,13 +56,13 @@ function changeTab(day){
56 56
 	}
57 57
 	$(".text").input();
58 58
 	getBrandAnalysisList(1);
59
-	getPlacementDetailList(1);
59
+	/*getPlacementDetailList(1);
60 60
 	getPieData(cur_type);
61 61
 	getRatingCharts(cur_type);
62 62
 	getNetChart(cur_type,'');
63 63
 	getDoubanChart(cur_type);
64 64
 	getRankList(cur_type);
65
-	changeTagName();
65
+	changeTagName();*/
66 66
 }
67 67
 
68 68
 function changeType(type){
@@ -89,56 +89,43 @@ function getBrandAnalysisList(page){
89 89
 	var pageSize = "10", data = {
90 90
 		"pageNo": page,
91 91
 		"pageSize": pageSize,
92
-		"name": $("#keyword").val(),
92
+		"keyword": $("#keyword").val(),
93
+		"type": $("#type").val(),
93 94
 		"second_ind":$("#second_ind").val(),
94 95
 		"beginDate": $("#start_time").val(),
95 96
 		"endDate": $("#end_time").val()
96 97
 	}, html = "";
97 98
 	$("#brand_analysis_page, #brand_analysis_list").empty();
98
-	ajax("ajax_brand_analysis_list.do",data,function(res){
99
-		if(res.code == 1 && res.list.length > 0){
100
-			$.each(res.list, function(index, item){
99
+	ajax("ajax_special_analysis_list.do",data,function(res){
100
+		if(res.code == 1 && res.data.records.length > 0){
101
+			$.each(res.data.records, function(index, item){
101 102
 				if(index == 0){
102 103
 					cur_brand = item.brand;
103 104
 				}
104
-				//eg:1|歌手/1|快乐大本营/1|快乐大本营
105
-				var types = item.types ? item.types.split("/") : [];
106
-				var count_1 = [],count_2 = [],count_3 = [],count_4 = [];
107
-				for(var i in types){
108
-					if(types[i].split('|')[0] == "1")
109
-						count_1.push(types[i].split('|')[1]);
110
-					else if(types[i].split('|')[0] == "2")
111
-						count_2.push(types[i].split('|')[1]);
112
-					else if(types[i].split('|')[0] == "3")
113
-						count_3.push(types[i].split('|')[1]);
114
-					else if(types[i].split('|')[0] == "4")
115
-						count_4.push(types[i].split('|')[1]);
116
-				}
117
-				count_1 = unique(count_1);
118
-				count_2 = unique(count_2);
119
-				count_3 = unique(count_3);
120
-				count_4 = unique(count_4);
121 105
 				html += "<tr data-brand='"+item.brand+"'>"+
122 106
 					"<td>"+$.orderNum(page,pageSize,index)+"</td>"+
123
-					"<td>"+item.brand+"</td>"+
124
-                    "<td>"+(item.second_ind ? item.second_ind : '-')+"</td>"+ //"<td>"+(item.advertiser ? item.advertiser : '-')+"</td>"+
125
-					"<td>"+(item.model_count ? item.model_count : '-')+"</td>"+
126
-					"<td>"+count_1.length+"</td>"+
127
-					"<td>"+count_2.length+"</td>"+
128
-					"<td>"+count_3.length+"</td>"+
129
-					"<td>"+count_4.length+"</td>"+
130
-					"<td>"+item.sum_frequency+"</td>"+
131
-					"<td>"+item.sum_length+"</td>"+
132
-					"<td>"+item.sum_price+"</td>"+
107
+					"<td>"+item.mediaName+"</td>"+
108
+                    "<td>"+item.showTime+"</td>"+
109
+					"<td>"+item.showDate+"</td>"+
110
+					"<td>"+item.showEnv+"</td>"+
111
+					"<td>"+item.tvName+"</td>"+
112
+					"<td>"+item.showDuration+"</td>"+
113
+					"<td>"+item.productName+"</td>"+
114
+					"<td>"+item.brandName+"</td>"+
115
+					"<td>"+item.firstInd+"</td>"+
116
+					"<td>"+item.secondInd+"</td>"+
117
+					"<td>"+item.advMaster+"</td>"+
118
+					"<td>"+item.phone+"</td>"+
119
+					"<td>"+item.price+"</td>"+
133 120
 					"<td><input type='checkbox' class='checkbox {click:itemCheck}' name='item' "+($.cookie.get("benchCheckNum").indexOf(item.brand) != -1 ? 'checked':'')+" value='"+item.brand+"' /><label></label></td>"+
134 121
 				"</tr>";
135 122
 			});
136 123
 			$("#brand_analysis_list").html(html);
137 124
 			$.radio();
138 125
 			$.checkbox();
139
-			var newpage = new createPage(res.count,page,pageSize,3,"brandAnalysisPageGo");
126
+			var newpage = new createPage(res.data.total,page,pageSize,3,"brandAnalysisPageGo");
140 127
 			$("#brand_analysis_page").html(newpage.pageHtml);
141
-			$('#brand_analysis_count').html(res.count);
128
+			$('#brand_analysis_count').html(res.data.count);
142 129
 			/**
143 130
 			 * 点击事件
144 131
 			 */
@@ -160,12 +147,12 @@ brandAnalysisPageGo = getBrandAnalysisList;
160 147
 
161 148
 function getPlacementDetailList(page){
162 149
 	page = page || 1;
163
-	var pageSize = "10",name =  $("#keyword").val(),beginDate = $("#start_time").val(),
150
+	var pageSize = "10",keyword =  $("#keyword").val(),beginDate = $("#start_time").val(),
164 151
 		endDate = $("#end_time").val(),data = {
152
+		"type": $("#type").val(),
165 153
 		"pageNo": page,
166 154
 		"pageSize": pageSize,
167
-		"brand":cur_brand,
168
-		"name": name,
155
+		"keyword": keyword,
169 156
 		"beginDate": beginDate,
170 157
 		"endDate": endDate
171 158
 	}, html = "";
@@ -423,7 +410,7 @@ function getDoubanChart(type){
423 410
 
424 411
 
425 412
 /**
426
- * 节目及品牌软性广告投放排名
413
+ * 产品专题广告投放排名
427 414
  */
428 415
 function getRankList(type){
429 416
 	var data = {
@@ -432,7 +419,7 @@ function getRankList(type){
432 419
 			"beginDate": $("#start_time").val(),
433 420
 			"endDate": $("#end_time").val()
434 421
 		},html="";
435
-	ajax("list_program_brand_rank.do",data,function(res){
422
+	ajax("list_special_product_rank.do",data,function(res){
436 423
 		if(res.code == 1 && res.data){
437 424
 			if(res.data.programRankList.length > 0){
438 425
 				var list = sortProgramRankList(res.data.programRankList,program_arr);