Forráskód Böngészése

上传用户点击查看节目的接口,查看所有上传记录

yaobo 7 éve
szülő
commit
21c0df8b67

+ 49 - 29
src/main/java/cn/efunbox/controller/ClickController.java

@@ -1,5 +1,6 @@
 package cn.efunbox.controller;
 
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -46,37 +47,56 @@ public class ClickController {
         return map;
     }
 
-    @RequestMapping("/search")
+    @RequestMapping("/add")
     @ResponseBody
-    public Map<String,Object> searchRecommend(){
-    	String ageStr = request.getParameter("age");
-		String sexStr = request.getParameter("sex");
-		String pageStr = request.getParameter("page");
-		String sizeStr = request.getParameter("size");
-		if(ageStr==null)
-			ageStr = "5";
-		if(sexStr==null)
-			sexStr = "1";
-		if(pageStr==null)
-			pageStr = "1";
-		if(sizeStr==null)
-			sizeStr = "10";
-		int age = Integer.valueOf(ageStr);
-		int sex = Integer.valueOf(sexStr);
-		int page = Integer.valueOf(pageStr);
-		int size = Integer.valueOf(sizeStr);
-		if(age<0 || age>20)
-			age = 5;
-		if(sex!=1 && sex!=2)
-			sex = 1;
-		if(page<1)
-			page = 1;
-		if(size<10)
-			size = 10;
+    public Map<String,Object> addClick(){
+    	Map<String, Object> map = new HashMap<String, Object>(2);
+        String age = request.getParameter("age")==null?"0":request.getParameter("age").trim();
+		String sex = request.getParameter("sex")==null?"1":request.getParameter("sex").trim();
+		String film_code = request.getParameter("film_code")==null?"":request.getParameter("film_code").trim();
+		String film_type = request.getParameter("film_type")==null?"1":request.getParameter("film_type").trim();
+		String mark_type = request.getParameter("mark_type")==null?"0":request.getParameter("mark_type").trim();
+		String is_vip = request.getParameter("is_vip")==null?"0":request.getParameter("is_vip").trim();
+		String film_grade = request.getParameter("film_grade")==null?"5":request.getParameter("film_grade").trim();
+		String film_star = request.getParameter("film_star")==null?"5":request.getParameter("film_star").trim();
+		String age_group = request.getParameter("age_group")==null?"0":request.getParameter("age_group").trim();
+		String series_count = request.getParameter("series_count")==null?"1":request.getParameter("series_count").trim();
+		String publish_date = request.getParameter("publish_date")==null?"0":request.getParameter("publish_date").trim();
+		String online_date = request.getParameter("online_date")==null?"0":request.getParameter("online_date").trim();
+		String area = request.getParameter("area")==null?"0":request.getParameter("area").trim();
+		String movie_type = request.getParameter("movie_type")==null?"0":request.getParameter("movie_type").trim();
+		String target_people = request.getParameter("target_people")==null?"0":request.getParameter("target_people").trim();
+		String language = request.getParameter("language")==null?"0":request.getParameter("language").trim();
+		String duration = request.getParameter("duration")==null?"0":request.getParameter("duration").trim();
+		if(film_code.isEmpty()){
+			map.put("code", 301);
+			return map;
+		}
+		int curTime = (int)(System.currentTimeMillis()/1000);
+		Click click = new Click();
+		click.setAge(Integer.valueOf(age));
+		click.setAge_group(Integer.valueOf(age_group));
+		click.setArea(Integer.valueOf(area));
+		click.setCreated(curTime);
+		click.setDuration(Integer.valueOf(duration));
+		click.setFilm_code(film_code);
+		click.setFilm_grade(Float.valueOf(film_grade));
+		click.setFilm_star(Float.valueOf(film_star));
+		click.setFilm_type(Integer.valueOf(film_type));
+		click.setIs_vip(Integer.valueOf(is_vip));
+		click.setLanguage(Integer.valueOf(language));
+		click.setMark_type(Integer.valueOf(mark_type));
+		click.setMovie_type(Integer.valueOf(movie_type));
+		click.setOnline_date(Integer.valueOf(online_date));
+		click.setPublish_date(Integer.valueOf(publish_date));
+		click.setSeries_count(Integer.valueOf(series_count));
+		click.setSex(Integer.valueOf(sex));
+		click.setTarget_people(Integer.valueOf(target_people));
 		
-		Map<String, Object> map = new HashMap<String, Object>(2);
-        map.put("code", 200);
-        map.put("rows", 1);
+		int ret = clickService.insert(click);
+		
+		map.put("code", 200);
+        map.put("rows", ret);
         return map;
     }
     

+ 8 - 7
src/main/java/cn/efunbox/dao/ClickMapper.java

@@ -6,16 +6,17 @@ import java.util.Map;
 import cn.efunbox.model.Click;
 
 public interface ClickMapper {
-    /**
-     * 插入一条记录
-     * @param person
-     */
-    int insert(Click click);
-    
+     
     /**
      * 查询所有
      * @return
      */
     List<Click> queryAll();
-
+    
+    /**
+     * 插入一条记录
+     * @param person
+     */
+    int insert(Click click);
+   
 }

+ 4 - 4
src/main/java/cn/efunbox/mapping/ClickMapper.xml

@@ -2,14 +2,14 @@
  <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.efunbox.dao.ClickMapper">
     <!-- 查询所有结果 -->  
-    <insert id="insert" parameterType="map">
-		insert into efunbox_click(age,sex,film_code,film_type,mark_type,is_vip,film_grade,film_star,age_group,series_count,publish_date,online_date,area,movie_type,target_people,language,duration,created) 
-		values(#{click.age},#{click.sex},#{click.film_code},#{click.film_type},#{click.mark_type},#{click.is_vip},#{click.film_grade},#{click.film_star},#{click.age_group},#{click.series_count},#{click.publish_date},#{click.online_data},#{click.area},#{click.movie_type},#{click.target_people},#{click.language},#{click.duration},#{click.created}) 
+     <insert id="insert" parameterType="Click">
+		insert into film_click(age,sex,film_code,film_type,mark_type,is_vip,film_grade,film_star,age_group,series_count,publish_date,online_date,area,movie_type,target_people,language,duration,created) 
+		values(#{age},#{sex},#{film_code},#{film_type},#{mark_type},#{is_vip},#{film_grade},#{film_star},#{age_group},#{series_count},#{publish_date},#{online_date},#{area},#{movie_type},#{target_people},#{language},#{duration},#{created}) 
 	</insert>
     
     <!-- 查询所有结果 -->  
     <select id="queryAll" resultType="Click" >  
-        select * from efunbox_click 
+        select * from film_click 
     </select>
     
 </mapper>

+ 2 - 2
src/main/java/cn/efunbox/mapping/RecommendMapper.xml

@@ -3,12 +3,12 @@
 <mapper namespace="cn.efunbox.dao.RecommendMapper">
     <!-- 查询所有结果 -->  
     <select id="queryAll" resultType="Recommend" >  
-        select * from efunbox_recmd  
+        select * from film_recmd  
     </select>
     
     <!-- 搜索 -->  
     <select id="search" parameterType="map" resultType="Recommend" >  
-        select * from efunbox_recmd 
+        select * from film_recmd 
         where age=#{param1} and sex=#{param2} 
 		order by score desc limit #{param3} offset #{param4}
     </select>

+ 60 - 22
src/main/java/cn/efunbox/model/Click.java

@@ -29,21 +29,59 @@ public class Click {
     private int created;	//创建时间
     
     /*
-     CREATE TABLE `efunbox_click` (
+     CREATE TABLE `film_click` (
                   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '唯一编号',
-                  `age` int(5) DEFAULT '5' COMMENT '年龄:1-99',
+                  `age` int(5) DEFAULT '0' COMMENT '年龄:1-99',
                   `sex` int(2) DEFAULT '1' COMMENT '性别:1为男,2为女',
                   `film_code` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '电影编号',
-                  `times` int(10) DEFAULT '1' COMMENT '点击次数',
-                  `score` int(10) DEFAULT '1' COMMENT '排序得分',
-                  `status` int(5) DEFAULT '1' COMMENT '是否显示:1为显示,-1为隐藏',
-                  `updated` int(10) DEFAULT '0' COMMENT '上次更新排序时间',
+                  `film_type` int(2) DEFAULT '1' COMMENT '电影类型 1、电影 2:剧集',
+                  `mark_type` int(2) DEFAULT '0' COMMENT '角标类型 1:new',
+                  `is_vip` int(2) DEFAULT '0' COMMENT '是否为vip 1:是',                  
+                  `film_grade` float(4,2) DEFAULT '5' COMMENT '电影评分',
+                  `film_star` float(4,2) DEFAULT '5' COMMENT '电影评星',
+                  `age_group` int(5) DEFAULT '0' COMMENT '适用年龄段',
+                  `series_count` int(5) DEFAULT '1' COMMENT '集数,电影为1',
+                  `publish_date` int(10) DEFAULT '0' COMMENT '发行时间',
+                  `online_date` int(10) DEFAULT '0' COMMENT '上线时间',
+                  `area` int(5) DEFAULT '0' COMMENT '地区',
+                  `movie_type` int(5) DEFAULT '0' COMMENT '类型',
+                  `target_people` int(5) DEFAULT '0' COMMENT '适合人群',
+                  `language` int(5) DEFAULT '0' COMMENT '语言',
+                  `duration` int(5) DEFAULT '0' COMMENT '电影时长,分钟',
                   `created` int(10) DEFAULT '0' COMMENT '创建时间',
                   PRIMARY KEY (`id`),
                   KEY `age_sex` (`age`,`sex`),
-                  KEY `score` (`score`)
-                ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='推荐节目统计结果'; 
+                  KEY `film_code` (`film_code`),
+                  KEY `film_type` (`film_type`)
+                ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='节目点击观看记录'; 
      */
+    
+    /*
+    CREATE TABLE `film_info` (
+				`codes` varchar(10) NOT NULL COMMENT '电影编号',
+				`names` varchar(30) DEFAULT NULL COMMENT '电影名称',
+				`english_name` varchar(50) DEFAULT NULL COMMENT '英语名称',
+				`simple_desc` varchar(30) DEFAULT NULL COMMENT '一句话描述',
+				`film_type` tinyint(2) DEFAULT NULL COMMENT '电影类型 1、电影 2:剧集',
+				`mark_type` tinyint(2) DEFAULT NULL COMMENT '角标类型 1:new',
+				`is_vip` tinyint(2) DEFAULT NULL COMMENT '是否为vip 1:是',
+				`film_grade` float(4,2) DEFAULT NULL COMMENT '电影评分',
+				`film_star` float(4,2) DEFAULT NULL COMMENT '电影评星',
+				`age_group` tinyint(3) DEFAULT NULL COMMENT '适用年龄段',
+				`series_count` smallint(4) DEFAULT NULL COMMENT '集数,电影为1',
+				`publish_date` date DEFAULT NULL COMMENT '发行时间',
+				`publis_company` varchar(50) DEFAULT NULL COMMENT '出品公司',
+				`area` varchar(50) DEFAULT NULL COMMENT '地区',
+				`movie_type` varchar(50) DEFAULT NULL COMMENT '类型',
+				`target_people` varchar(50) DEFAULT NULL COMMENT '适合人群',
+				`language` varchar(10) DEFAULT NULL COMMENT '语言',
+				`introduce` text COMMENT '详细介绍',
+				`duration` smallint(5) DEFAULT NULL COMMENT '电影时长,分钟',
+				`icon_url` varchar(50) DEFAULT NULL,
+				`background_url` varchar(50) DEFAULT NULL,
+				PRIMARY KEY (`codes`)
+		) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+   	*/
 
 	/**
 	 * @return the id
@@ -214,20 +252,6 @@ public class Click {
 	}
 
 	/**
-	 * @return the online_date
-	 */
-	public int getonline_date() {
-		return online_date;
-	}
-
-	/**
-	 * @param online_date the online_date to set
-	 */
-	public void setonline_date(int online_date) {
-		this.online_date = online_date;
-	}
-
-	/**
 	 * @return the area
 	 */
 	public int getArea() {
@@ -284,6 +308,20 @@ public class Click {
 	}
 
 	/**
+	 * @return the online_date
+	 */
+	public int getOnline_date() {
+		return online_date;
+	}
+
+	/**
+	 * @param online_date the online_date to set
+	 */
+	public void setOnline_date(int online_date) {
+		this.online_date = online_date;
+	}
+
+	/**
 	 * @return the duration
 	 */
 	public int getDuration() {

+ 2 - 2
src/main/java/cn/efunbox/service/impl/ClickServiceImpl.java

@@ -14,12 +14,12 @@ public class ClickServiceImpl implements IClickService {
     
     private ClickMapper clickMapper;
 
-    public ClickMapper getPersonMapper() {
+    public ClickMapper getClickMapper() {
         return clickMapper;
     }
     
     @Autowired
-    public void setPersonMapper(ClickMapper clickMapper) {
+    public void setClickMapper(ClickMapper clickMapper) {
         this.clickMapper = clickMapper;
     }