Collaborative filtering algorithm | movie recommendation system | design and development of movie recommendation system based on user preference

Author Homepage: Programming Compass

About the author: High-quality creator in the Java field, CSDN blog expert, CSDN content partner, invited author of Nuggets, Alibaba Cloud blog expert, 51CTO invited author, many years of architect design experience, resident lecturer of Tencent classroom

Main content: Java project, Python project, front-end project, artificial intelligence and big data, graduation design, resume template, learning materials, interview question bank, technical mutual assistance

Favorites, likes, don't get lost, it's good to follow the author

Get the source code at the end of the article 

Item number: BS-PT-106

1. Environmental introduction

Locale: Java: jdk1.8

Database: Mysql: mysql5.7

Application server: Tomcat: tomcat8.5.31

Development tools: IDEA or eclipse

Development technology: SSM framework + JSP + collaborative filtering algorithm + map positioning system, etc.

2. Project introduction

Although the application of information technology has brought a lot of benefits, it also brought a big explosion of information and data. In the era of information scarcity, people expect to obtain more information and data in order to understand the world, but in the era of data explosion, people are often at a loss as to how to filter out the data that is useless to them and obtain effective data. Information. The research of this topic is based on the user preference to recommend the movie recommendation system, which mainly judges the user's preference according to the set relevant rules based on the user's operation behavior records on the platform, and uses the collaborative filtering algorithm to give the user Corresponding data recommendations. At the same time, when the user has no operation data record, that is, when the commonly used data is silent, it also recommends some movie data to the user according to the corresponding rules, in order to find some useful data for the user.

This system is mainly based on the Java development technology platform to achieve system development, using the SSM framework to complete the background service interface development and business logic processing of the movie recommendation system, using JSP pages to complete the data display, using AJAX and JQUERY to realize human-computer interaction asynchronous data request. The specific data recommendation mainly uses the data model of the collaborative filtering algorithm for data recommendation. The overall function of the system is complete, the interface is beautiful and elegant, and the human-computer interaction effect is good.

According to market research and user interviews, and analysis, it is known that there are two types of users in the movie recommendation system designed and implemented this time, one is front-end users, and the other is administrator users. These two types of users have different roles and operational function permissions, which are shown below in the form of a use case diagram.

The use case diagram of the front-end user is shown in Figure 1 below.

Figure 1 Front-end user use case diagram

Front-end user use case description: After the front-end user registers and logs in, they can mainly browse news information online, browse movie information by category, movie review information, movie strategy information released by users, view recommended movie information, make online feedback messages, book movie tickets, etc. , and at the same time, you can publish movie guides, view personal collection information, reservation information, etc. in the personal center.

The operation use case diagram of the administrator user is shown in Figure 2 below:

Figure 2 Administrator user use case diagram

Administrator user use case diagram description: The administrator logs in to the movie recommendation system, and his main responsibility is to manage the basic information of the platform, including front-end registered user information management, carousel map management, information management, movie management, genre management, movie description Review management, complaint management, reservation order management, strategy management, etc.

After a full demand analysis and architecture design of the entire movie recommendation system, the functional goals to be achieved by the movie recommendation system developed and designed are finally determined. The following shows the front-end user functional architecture and background management of the movie recommendation system. Functional Architecture Diagram. The functions of front-end users are shown in Figure 3 below.

 Figure 3 Front-end user function structure diagram

Functional module introduction for front-end users:

   (1) Registration and login function module design

 Front-end users need to register as an online member when performing related operations. After filling in personal account information and personal information, they can log in after successful registration.

   (2) Design of personal information management functional modules

After the user logs in to the system, he can enter the system management to modify the password, enter the old password, new password and confirm the password. If the new password is consistent with the confirmed password, the modification is successful, and if they are inconsistent, the modification fails.

   (3) Information browsing function module

Front-end users can browse movie information, related movie commentary information, movie strategy information, industry information, etc. on the movie platform, view details of various types of information, and comment online. For favorite movies or movie reviews, you can Make favorites.

   (4) Online reservation function module

After the front-end user logs in, enter the details page of the movie introduction, click the reservation button to book movies online, and manage the movies they have reserved in the personal center. After the background administrator approves, the reservation is considered successful.

   (5) Movie strategy module

Users can post online, write their feelings about the movies they watch, or the strategy information of a certain movie, and manage their own posts online.

   (6) Personalized recommendation module

The movie management platform system will perform relevant calculations based on the user's browsing records, and use collaborative filtering algorithms to recommend corresponding information to different users. The current data model is mainly based on the characteristics of the movies that users browse, matching relevant movies Information, recommended and displayed in the recommended module on the homepage.

   (7) Full-text search module

    In the movie management platform system, front-end users can search according to relevant keywords, and will match the full text of movie information, movie commentary information, etc., perform fuzzy matching according to the title description, and display the found information.

   (8) Complaints and Suggestions

In addition to providing users with interactive functions such as online comments and favorites, it also provides a complaint and suggestion module, so that users can feedback relevant opinions in a timely manner, and the background administrator will handle them.

Functional module introduction for back-end users:

   (1) Personal information management: The administrator can perform corresponding management operations on personal information by logging in to the background.

   (2) User management: The administrator can perform corresponding management operations on the user information registered at the front end.

   (3) Carousel map management: Carry out corresponding management operations on the carousel map information on the front-end home page, and replace the carousel map according to needs.

   (4) Industry information management: mainly manage and publish relevant dynamic news information of the film industry.

   (5) Movie management: It mainly manages released movie information, introduces movie prices, features, etc. in detail, and specifies the location coordinates of the movie theater map in the background, which allows front-end users to directly locate the location of the movie theater through Baidu Maps.

   (6) Movie commentary management: It mainly manages related movie commentary information near the movie, and completes the operation of adding, deleting, modifying and checking movie commentary information.

   (7) Order management: It mainly manages the order information of the front-end users. After the front-end members book a movie, it needs to be reviewed by the administrator in the background, and it can be used only after it takes effect.

   (8) Raider management: mainly manages front-end movie member user releases and movie guide information.

   (9) Complaints and Suggestions: Perform relevant management operations on complaints and suggestions issued by front-end users.

Three, system display

3.1 Display of front-end functional modules

3.1.1 Registration and login

The movie recommendation system provides front-end users with the basic functions of registration and login. This is also to ensure data security and data correspondence for users to make online reservations. The basic process of user login is shown in Figure 3.1 below.

 

Figure 3.1 Login flow chart

The user login interface is shown in Figure 5.2 below:

 

Figure 3.2 User login

The premise of logging in is to have registered account information. The basic process of user registration is shown in Figure 3.3 below:

 

Figure 3.3 Front-end user registration flow chart

 The front-end user registration interface of the movie recommendation system is shown in Figure 3.4 below:

 

Figure 3.4 Front-end user registration interface

3.1.2 Movie Category Browsing

After logging in to the system, users can view the released movie information online. The platform provides a global search operation by movie name, and at the same time can classify and query according to movie types, as shown in Figure 35 below.

Figure 3.5 Movie category browsing

   After the user clicks on the movie he is interested in, he will enter the movie details interface. In the movie details, he can view the specific information related to the movie (director, screenwriter, starring, introduction, etc.), and can also make online reservations, collections, comments, etc. Interactive operation, as shown in Figure 3.6 below.

 Figure 3.6 Movie Details Browsing

3.1.3 Movie recommendation

 After the user logs in to the system, the system can recommend relevant movie information to the user based on the data records of the user's operational behavior and based on the collaborative filtering algorithm used by the system, and display it directly on the home page of the system. The specific display is shown in Figure 3.7.

 

Figure 3.7 Movie recommendation

3.1.4 Browsing Industry News

After logging in to the system, the user can click on the blog post to enter the blog module, and the user can view the blog information published by the user online, as shown in Figure 4.8 below.

 

Figure 3.8 Movie News Browsing

3.1.5 Watching strategy

After logging in to the system, the user can click on the movie guide to view the movie guide information shared by each user. The user can publish the details of each movie watch guide on the platform, as shown in Figure 3.9 below.

 

Figure 3.9 Movie Guide

 3.1.6 Movie reviews

Movie commentary mainly displays some comments and analysis information of some celebrities about movies. Users can view them in these modules. The specific implementation of movie commentary is shown in Figure 3.10 below.

 

Figure 3.10 Personal Information Management

Fourth, the core code display

package com.sys.controller.admin;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;

import javax.servlet.http.HttpServletRequest;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.sys.controller.MyController;
import com.sys.controller.suanfa.Aprioti;
import com.sys.controller.suanfa.Itemset;
import com.sys.controller.xietong.XietongUtil;
import com.sxl.util.RandomValidateCode;
import com.sxl.util.StringHelper;

@Controller("frontController")
@RequestMapping(value = "/front")
public class FrontController extends MyController {

	/**
	 * 使用协同过滤算法进行相关推荐
	 * @param model
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/index")
	public String frame(Model model, HttpServletRequest request)
			throws Exception {
		String sql = "";
		sql = "select * from t_lbt";
		List list3 = db.queryForList(sql);
		request.setAttribute("list3", list3);

		sql = "select a.* from t_product a where typesId=1 order by id desc limit 3";
		List listb = db.queryForList(sql);
		request.setAttribute("listb", listb);
        //查询电影类型
		sql = "select * from t_types";
		model.addAttribute("typesList", db.queryForList(sql));
		//协同过滤推荐算法
		if(getCustomer(request)!=null){
			//如果该用户登录了,身份确定了, 则可以用协同过滤推荐

			List<Map> customerList = db.queryForList("select * from t_customer");
			List<Map> dataList = db.queryForList("select distinct productId, customerId  from t_productclick where productId is not null and customerId is not null ");
			int usersize = customerList.size();
			String customerId = getCustomer(request).get("id").toString();
			/**
			 * 输入用户-->物品条目  一个用户对应多个物品
			 * 用户ID	物品ID集合
			 *   A		a b d
			 *   B		a c
			 *   C		b e
			 *   D		c d e
			 */
			String[] userdata = new String[customerList.size()];
			for (int i = 0; i < customerList.size(); i++) {
				String customerid = customerList.get(i).get("id").toString();
				String aa="A"+customerid+"";
				for (int j = 0; j < dataList.size(); j++) {
					if(customerid.equals(dataList.get(j).get("customerId").toString())){
						aa+="@"+dataList.get(j).get("productId").toString();
					}
				}
				userdata[i]= aa+="@0";
				System.out.println("******"+aa);
			}
			String out = XietongUtil.xietongjob(usersize, userdata, "A"+customerId);


			String sqlall="select a.*  from t_product a where typesId=1 ";
			 sql=sqlall;
			if(out!=null&&!"".equals(out)){
				sql+=" and id in ("+out.substring(1,out.length())+")";
			}
			sql+="  order by rand() limit 8 ";
			//以上推荐算法最总结果在根据随机安排推荐

			//注!为了应对一开始人员访问数据量不够推荐算法使用的情况,就进行了数据补足,这个业务逻辑就非常完美了。
			List tuijianList = db.queryForList(sql);
			int a = 8;
			int b = 0;
			if(tuijianList==null||tuijianList.size()<8){
				if(tuijianList!=null){
					b = 8-tuijianList.size();
				}
				List list2 = db.queryForList(sqlall+" order by rand() limit "+b);
				tuijianList.addAll(list2);
			}else{

			}
			request.setAttribute("tuijianList", tuijianList);




		}else{
			//也就是说,如果网站用户未登录,则不能身份确认,所以用aprio算法
			//aprio推荐算法
			tuijiansuanfa(request);
		}




		return "/front/index";
	}


	/**
	 * 专门有个算法包
	 * 然后算法的逻辑也在这里,
	 * 而且把算法之外额逻辑也加了
	 * 注!为了应对一开始人员访问数据量不够推荐算法使用的情况,就进行了数据补足,这个业务逻辑就非常完美了。
	 *
	 * java推荐算法
	 * @param request
	 */
	public void tuijiansuanfa(HttpServletRequest request){
			Itemset originalItem = new Itemset();
			List<Map> lista = db.queryForList("select * from t_customer");
			for (int i = 0; i < lista.size(); i++) {
				TreeSet<String> itemset = new TreeSet<String>();
				List<Map> listb = db.queryForList("select * from t_productclick where customerId=?",new Object[]{lista.get(i).get("id")});
				for (int j = 0; j < listb.size(); j++) {
					itemset.add(listb.get(j).get("productId")+"");
				}
				originalItem.itemset.add(itemset);
			}
			Aprioti.originalItem=originalItem;
			List<Long> outList = Aprioti.aprioriProcess();
			String in ="";
			if(outList!=null&&outList.size()>0){
				for (int i = 0; i < outList.size(); i++) {
					in+=","+outList.get(i);
				}
			}
			String sqlall="select a.*  from t_product a where 1=1 ";
			String sql=sqlall;
			if(in!=null&&!"".equals(in)){
				sql+=" and id in ("+in.substring(1,in.length())+")";
			}
			sql+="  order by rand() limit 8 ";
			//以上推荐算法最总结果在根据随机安排推荐

			//注!为了应对一开始人员访问数据量不够推荐算法使用的情况,就进行了数据补足,这个业务逻辑就非常完美了。
			List tuijianList = db.queryForList(sql);
			int a = 8;
			int b = 0;
			if(tuijianList==null||tuijianList.size()<8){
				if(tuijianList!=null){
					b = 8-tuijianList.size();
				}
				List list2 = db.queryForList(sqlall+" order by rand() limit "+b);
				tuijianList.addAll(list2);
			}else{

			}
			request.setAttribute("tuijianList", tuijianList);
	}




	@RequestMapping(value = "/baidu1")
	public String baidu1(Model model, HttpServletRequest request)
			throws Exception {
		return "/front/baidu1";
	}

	@RequestMapping(value = "/baidu2")
	public String baidu2(Model model, HttpServletRequest request)
			throws Exception {
		return "/front/baidu2";
	}

	@RequestMapping(value = "/daohang1")
	public String daohang1(Model model, HttpServletRequest request,String id)
			throws Exception {
		Map map = db.queryForMap("select * from t_product where id="+id);
		model.addAttribute("map", map);
		return "/front/daohang1";
	}

	public String getjwd(HttpServletRequest request){
		Object jwdd= request.getSession().getAttribute("yhjwd");
		if(jwdd!=null){
			return jwdd.toString();
		}else{
			return "116.438189,39.9125";
		}
	}

	@RequestMapping(value = "/daohang2")
	public String daohang2(Model model, HttpServletRequest request,String id)
			throws Exception {
		Map map = db.queryForMap("select *from t_zx where id="+id);

		map = new HashMap();
		map.put("jwd", "116.661256,39.975119");


		model.addAttribute("map", map);



		String jwd = getjwd(request);
		System.out.println(jwd);
		System.out.println(map.get("jwd"));
		model.addAttribute("jwd", jwd);
		return "/front/daohang2";
	}






	@RequestMapping(value = "/login")
	public String login(Model model, HttpServletRequest request)
			throws Exception {
		return "/front/login";
	}

	public void saveClick(HttpServletRequest request,Long id){
		String sql="insert into t_productclick(productId,customerId,insertDate) values(?,?,now())";
		Map customer = getCustomer(request);
		if(customer!=null&&customer.size()>0){
			db.update(sql, new Object[]{id,getCustomer(request).get("id")});
		}
	}

	/**
	 * 查询信息
	 * @param model
	 * @param request
	 * @param typesId
	 * @param productName
	 * @param px
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/all")
	public String all(Model model, HttpServletRequest request,Long typesId,String productName,String px,Integer bqid)
			throws Exception {

		String sql="select a.* from t_types a where 1=1";
			sql+=" order by id desc";
			List typesList = db.queryForList(sql);
			request.setAttribute("typesList", typesList);
			 sql="select a.*,(select typesName from t_types b where a.typesId=b.id) typesName  from t_product a where 1=1";

			 if(typesId!=null&&!"".equals(typesId)){
				 sql+=" and a.typesId="+typesId;
			 }
			 if(productName!=null&&!"".equals(productName)){
				 sql+=" and a.productName like '%"+productName+"%' ";
			 }
			 if(bqid!=null){
				 sql+=" and bqid="+bqid;
			 }
			 if("1".equals(px)){
				 sql+=" order by id desc";
			 }else  if("2".equals(px)){
				 sql+=" order by price asc";
			 }else  if("3".equals(px)){
				 sql+=" order by price desc";
			 }else  if("4".equals(px)){
				 sql+=" order by djl desc";
			 }

				List list = db.queryForList(sql);
				request.setAttribute("list", list);

		return "/front/all";
	}

	@RequestMapping(value = "/jfdh")
	public String jfdh(Model model, HttpServletRequest request)
			throws Exception {

		String sql="select a.* from t_jfdh a where 1=1";

			sql+=" order by id desc";
			List list = db.queryForList(sql);
			request.setAttribute("list", list);
		return "/front/jfdh";
	}
	@RequestMapping(value = "/dhjfSave")
	public ResponseEntity<String> dhjfSave(Model model,
			HttpServletRequest request,Long id) throws Exception {
		Map map = db.queryForMap("select * from t_jfdh where id="+id);
		String jf = map.get("jfCost").toString();
		String jfName = map.get("jfName").toString();
		//订单
		String sql = "insert into t_order(orderNum,customerId,productDetail,allPrice,status,insertDate) values(?,?,?,?,?,now())";
		int result = db.update(sql, new Object[] { System.currentTimeMillis()+"",
				getCustomer(request).get("id").toString(), jfName+"积分兑换["+jf+"]", 0+"", "兑换完成" });
		sql="update t_customer set jf = jf-"+jf+" where id="+getCustomer(request).get("id");
		db.update(sql);

		//积分减少
		return renderData(true, "操作成功", null);
	}


	@RequestMapping(value = "/register")
	public String register(Model model, HttpServletRequest request)
			throws Exception {
		System.out.println("112312312");
		return "/front/register";
	}


	@RequestMapping(value = "/detail")
	public String detail(Model model, HttpServletRequest request, Long id)
			throws Exception {
		//保存点击
		saveClick(request, id);


		String sql = "select a.*,(select typesName from t_types b where a.typesId=b.id) typesName " +
				" from t_product a where id=" + id;
		Map map = db.queryForMap(sql);
		request.setAttribute("map", map);
		String sql2="select a.*,(select max(customerName) from t_customer b where a.customerId=b.id) customerName from t_pinglun_product a where productId=? order by id desc";
		List<Map> list = db.queryForList(sql2,new Object[]{id});
		model.addAttribute("list", list);
		db.update("update t_product set djl=djl+1 where id="+id);

		int scNum = db.queryForInt("select count(1) from t_sc where productId="+id);
		model.addAttribute("scNum", scNum);



		return "/front/detail";
	}

	@RequestMapping(value = "/myOrder")
	public String myOrder(Model model, HttpServletRequest request)
			throws Exception {
		String sql = "select a.*,(select max(customerName) from t_customer b where a.customerId=b.id) customerName  from t_order a where 1=1 ";

		if (1 == 1) {
			sql += "and customerId=" + getCustomer(request).get("id") + " ";
		}
		sql += " order by id desc";
		List list = db.queryForList(sql);
		request.setAttribute("orderList", list);
		return "/front/myOrder";
	}


	@RequestMapping(value = "/deleteOneOrder")
	public ResponseEntity<String> deleteOneOrder(Model model,
			HttpServletRequest request,Long id) throws Exception {
		String sql="delete from t_order where id="+id;
		db.update(sql);
		return renderData(true, "操作成功", null);
	}

	@RequestMapping(value = "/pjSave")
	public ResponseEntity<String> pjSave(Model model,
			HttpServletRequest request,Long id,String pj) throws Exception {
		String sql="update t_order set pj='"+pj+"'  where id="+id;
		db.update(sql);
		return renderData(true, "操作成功", null);
	}



	@RequestMapping(value = "/deletesc")
	public ResponseEntity<String> deletesc(Model model,
			HttpServletRequest request,Long id) throws Exception {
		String sql="delete from t_sc where id="+id;
		db.update(sql);
		return renderData(true, "操作成功", null);
	}
	@RequestMapping(value = "/deletexiaoxi")
	public ResponseEntity<String> deletexiaoxi(Model model,
			HttpServletRequest request,Long id) throws Exception {
		String sql="delete from t_xiaoxi where id="+id;
		db.update(sql);
		return renderData(true, "操作成功", null);
	}

	@RequestMapping(value = "/addShopcar")
	public ResponseEntity<String> addShopcar(Model model,
			HttpServletRequest request, Long id, Integer num) throws Exception {
		int result = 0;
		db.update("delete from t_shopcar where customerId="+getCustomer(request).get("id"));
		String sql = "insert into t_shopcar(productId,num,customerId) values(?,?,?)";
		result = db.update(sql, new Object[] { id, 1,
				getCustomer(request).get("id").toString() });
		return renderData(true, "操作成功", null);
	}


	@RequestMapping(value = "/pay3")
	public ResponseEntity<String> pay3(Model model, HttpServletRequest request,Long address)
			throws Exception {
		String sql = "select a.*,(select productName from t_product b where a.productId=b.id) productName,"
				+ "(select price from t_product b where a.productId=b.id) price,(select jf from t_product b where a.productId=b.id) jf  from t_shopcar a where customerId="
				+ getCustomer(request).get("id");
		sql += " order by id desc";
		List<Map> list = db.queryForList(sql);
		int total = 0;
		int jf = 0;
		String productDetail = "";
		String productId="";
		for (int i = 0; i < list.size(); i++) {
			productId = list.get(i).get("productId").toString();
			productDetail += "," + list.get(i).get("productName") + "["
					+ list.get(i).get("num") + "]";
			total += Integer.parseInt(list.get(i).get("price").toString())
					* Integer.parseInt(list.get(i).get("num").toString());

//			jf+=Integer.parseInt(list.get(i).get("jf").toString())
//					* Integer.parseInt(list.get(i).get("num").toString());

			String sql2="update t_product set nums=nums-"+list.get(i).get("num").toString()+" where id="+list.get(i).get("productId").toString();
			db.update(sql2);
		}

		Map addressMap = db.queryForMap("select * from t_address where id=?",new Object[]{address});
		sql = "insert into t_order(orderNum,customerId,productDetail,allPrice,status,insertDate,lxr,lxfs,address,productId) values(?,?,?,?,?,now(),?,?,?,?)";
		int result = db.update(sql, new Object[] { System.currentTimeMillis()+"",
				getCustomer(request).get("id").toString(),  productDetail.subSequence(1, productDetail.length()), total+"", "等待处理",addressMap.get("lxr"),addressMap.get("phone"),addressMap.get("xxdz"),productId });

		sql = "delete from t_shopcar where customerId="
				+ getCustomer(request).get("id");
		db.update(sql);
		if (result == 1) {
			return renderData(true, "操作成功", null);
		} else {
			return renderData(false, "操作失败", null);
		}
	}

//	@RequestMapping(value = "/addShopcar")
//	public ResponseEntity<String> addShopcar(Model model,
//			HttpServletRequest request, Long id, Integer num) throws Exception {
//		int result = 0;
//		// 判断该用户是否
//		String sql = "select * from t_shopcar where  productId=? and customerId=?";
//		Map map = db.queryForMap(sql, new Object[] { id.toString(),
//				getCustomer(request).get("id").toString() });
//		if (map != null && map.size() > 0) {
//			sql = "update t_shopcar set productId=?,num=num+" + num
//					+ " where id=?";
//			result = db.update(sql, new Object[] { id, map.get("id") });
//		} else {
//			sql = "insert into t_shopcar(productId,num,customerId) values(?,?,?)";
//			result = db.update(sql, new Object[] { id, num,
//					getCustomer(request).get("id").toString() });
//		}
//		if (result == 1) {
//			return renderData(true, "操作成功", null);
//		} else {
//			return renderData(false, "操作失败", null);
//		}
//	}

	@RequestMapping(value = "/checkIsLogin")
	public ResponseEntity<String> checkIsLogin(Model model,
			HttpServletRequest request) throws Exception {
		Map customer = getCustomer(request);
		if (customer != null && customer.size() > 0) {
			return renderData(true, "操作成功", null);
		} else {
			return renderData(false, "操作失败", null);
		}
	}

	@RequestMapping(value = "/pay")
	public ResponseEntity<String> pay(Model model, HttpServletRequest request,Long address)
			throws Exception {
		String orderDate = request.getParameter("orderDate");
		String zffs = request.getParameter("zffs");
		String sql = "select a.*,(select productName from t_product b where a.productId=b.id) productName,"
				+ "(select price from t_product b where a.productId=b.id) price,(select jf from t_product b where a.productId=b.id) jf  from t_shopcar a where customerId="
				+ getCustomer(request).get("id");
		sql += " order by id desc";
		List<Map> list = db.queryForList(sql);
		int total = 0;
		int jf = 0;
		String productDetail = "";
		String productId="";
		for (int i = 0; i < list.size(); i++) {
			productId = list.get(i).get("productId").toString();
			productDetail = list.get(i).get("productName").toString() ;

			sql = "insert into t_order(orderNum,customerId,productDetail,allPrice,status,insertDate,lxr,lxfs,address,productId,orderDate,zffs) values(?,?,?,?,?,now(),?,?,?,?,?,?)";
			db.update(sql, new Object[] { System.currentTimeMillis()+"",
					getCustomer(request).get("id").toString(),  productDetail, list.get(i).get("price").toString()+"", "等待处理",null,null,null,productId ,orderDate,zffs});
		}
		sql = "delete from t_shopcar where customerId="
				+ getCustomer(request).get("id");
		db.update(sql);
		return renderData(true, "操作成功", null);
	}

	@RequestMapping(value = "/shopcar")
	public String shopcar(Model model, HttpServletRequest request)
			throws Exception {

		Map customer = getCustomer(request);
		if (customer != null && customer.size() > 0) {
		} else {
			return "redirect:/front/register.html";
		}
		String sql="select a.* from t_address a where 1=1";
		if(1==1){sql+=" and customerId="+getCustomer(request).get("id") +" ";}
		sql+=" order by id desc";
		List addressList = db.queryForList(sql);
		request.setAttribute("addressList", addressList);

		 sql = "select b.*,a.id ids,a.num num   from t_shopcar a left join t_product b on a.productId=b.id  where 1=1 and customerId="
				+ getCustomer(request).get("id");
		sql += " order by id desc";
		System.out.println(sql);
		List<Map> list = db.queryForList(sql);
		request.setAttribute("list", list);
		System.out.println(list);
		int total = 0;
		if(list!=null&&list.size()>0){
			for (int i = 0; i < list.size(); i++) {
				total += Integer.parseInt(list.get(i).get("price").toString())
						* Integer.parseInt(list.get(i).get("num").toString());
			}
		}

		request.setAttribute("total", total);
		return "/front/shopcar";
	}

	@RequestMapping(value = "/save")
	public ResponseEntity<String> loginSave(Model model,
			HttpServletRequest request, String username, String password)
			throws Exception {
		String sql = "select * from t_customer where username=?";
		List<Map> list = db.queryForList(sql, new Object[] { username });
		String result = "1";
		if (list != null && list.size() > 0) {
			Map map = list.get(0);
			if (StringHelper.get(map, "password").equals(password)) {
				request.getSession().setMaxInactiveInterval(60 * 60 * 24);
				request.getSession().setAttribute("customerBean", map);
				result = "1";
			} else {
				result = "0";
			}
		} else {
			result = "0";
		}
		return renderData(true, result, null);
	}


	@RequestMapping(value = "/deleteOneShopCar")
	public ResponseEntity<String> deleteOneShopCar(Model model,
			HttpServletRequest request,Long id)
			throws Exception {
		String sql="delete from t_shopcar where id="+id;
		db.update(sql);
		return renderData(true, "", null);
	}

	@RequestMapping(value = "/updateShopCar")
	public ResponseEntity<String> updateShopCar(Model model,
			HttpServletRequest request,Long id,Integer num)
			throws Exception {
		String sql="update t_shopcar set num="+num+" where id="+id;
		System.out.println(sql);
		db.update(sql);
		return renderData(true, "", null);
	}

	@RequestMapping(value = "/registerSave")
	public ResponseEntity<String> registerSave(Model model,
			HttpServletRequest request, Long id, String username,
			String password, String customerName, String sex, String address,String headPic,
			String phone) throws Exception {
		String yzm = request.getParameter("yzm");
		String yzmnow = request.getSession().getAttribute(RandomValidateCode.RANDOMCODEKEY).toString().toUpperCase();
		if(!yzmnow.equals(yzm.toUpperCase())){
			return renderData(false, "5", null);
		}
		int a = db.queryForInt("select count(1) from t_customer where username=?",new Object[]{username});
		if(a>0){
			return renderData(false, "1", null);
		}
		int result = 0;
		if(headPic==null||"".equals(headPic)){
			headPic ="resource/front4/123.jpg";
		}
		String sql = "insert into t_customer(username,password,customerName,sex,address,phone,headPic) values(?,?,?,?,?,?,?)";
		result = db.update(sql, new Object[] { username, password, customerName, sex,
				address, phone,headPic });
		sql = "select * from t_customer order by id desc limit 1";
		List<Map> list = db.queryForList(sql);
		request.getSession().setMaxInactiveInterval(60 * 60 * 24);
		request.getSession().setAttribute("customerBean", list.get(0));

		return renderData(true, "操作成功", null);
	}

	@RequestMapping(value = "/out")
	public String out(Model model, HttpServletRequest request) throws Exception {
		request.getSession().removeAttribute("customerBean");
		return "redirect:/front/login.html";
	}

	@RequestMapping(value = "/mine")
	public String mine(Model model, HttpServletRequest request)
			throws Exception {
		Map customer = getCustomer(request);
		Map map = db.queryForMap("select * from t_customer where id=?",
				new Object[] { customer.get("id") });
		model.addAttribute("customer", map);
		return "/front/mine";
	}

	@RequestMapping(value = "/mineSave")
	public ResponseEntity<String> mineSave(Model model,
			HttpServletRequest request, Long id, String username,
			String password, String customerName, String sex, String address,String headPic,
			String phone) throws Exception {
		int result = 0;
		String sql = "update t_customer set customerName=?,sex=?,address=?,phone=?,headPic=? where id=?";
		result = db.update(sql, new Object[] { customerName, sex, address, phone,headPic, id });


		sql = "select * from t_customer where id="+id;
		List<Map> list = db.queryForList(sql);
		request.getSession().setMaxInactiveInterval(60 * 60 * 24);
		request.getSession().setAttribute("customerBean", list.get(0));


		return renderData(true, "操作成功", null);
	}

	@RequestMapping(value = "/password")
	public String password(Model model, HttpServletRequest request)
			throws Exception {
		return "/front/password";
	}

	@RequestMapping(value = "/changePassword")
	public ResponseEntity<String> changePassword(Model model,
			HttpServletRequest request, String oldPassword, String newPassword)
			throws Exception {
		Map customer = getCustomer(request);
		if (oldPassword.equals(customer.get("password").toString())) {
			String sql = "update t_customer set password=? where id=?";
			db.update(sql, new Object[] { newPassword, customer.get("id") });
			return renderData(true, "1", null);
		} else {
			return renderData(false, "1", null);
		}
	}



	@RequestMapping(value = "/scSave")
	public ResponseEntity<String> scSave(Model model,
			HttpServletRequest request, Long id, String pl) throws Exception {
		int result = 0;
		String customerId = getCustomer(request).get("id").toString();
		db.update("delete from t_sc  where productId=? and customerId=? ", new Object[] {id,customerId });
		String sql = "insert into t_sc(productId,customerId,insertDate) values(?,?,now())";
		result = db.update(sql, new Object[] {id,customerId });
		return renderData(true, "操作成功", null);
	}

	@RequestMapping(value = "/plSave")
	public ResponseEntity<String> plSave(Model model,
			HttpServletRequest request, Long id, String pl) throws Exception {
		int result = 0;
		String sql = "update t_order set pl=? where id=?";
		result = db.update(sql, new Object[] { pl, id });
		if (result == 1) {
			return renderData(true, "操作成功", null);
		} else {
			return renderData(false, "操作失败", null);
		}
	}

	@RequestMapping(value = "/contact")
	public String fk(Model model, HttpServletRequest request) throws Exception {
		return "/front/contact";
	}

	@RequestMapping(value = "/contactSave")
	public ResponseEntity<String> contactSave(Model model,
			HttpServletRequest request, String content, String phone)
			throws Exception {
		int result = 0;
		String sql = "insert into t_contact(customerId,phone,content,insertDate) values(?,?,?,now())";
		result = db.update(sql, new Object[] { getCustomer(request).get("id"),
				phone, content });
		if (result == 1) {
			return renderData(true, "操作成功", null);
		} else {
			return renderData(false, "操作失败", null);
		}
	}

	@RequestMapping(value = "/message")
	public String message(Model model, HttpServletRequest request)
			throws Exception {

		String sql = "select a.*,(select max(name) from t_customer b where a.customerId=b.id) customerName  from t_message a where 1=1 ";
		sql += " and customerId=" + getCustomer(request).get("id") + " ";
		sql += " order by id desc";
		List list = db.queryForList(sql);
		request.setAttribute("list", list);
		System.out.println(list);
		return "/front/message";
	}

	@RequestMapping(value = "/saveMessageContent")
	public ResponseEntity<String> saveMessageContent(Model model,
			HttpServletRequest request, String messageContent) throws Exception {
		Map customer = getCustomer(request);

		String sql = "insert into t_message(customerId,messageContent,insertDate,types) values(?,?,now(),1)";//1代表我
		int result = db
				.update(sql, new Object[] { getCustomer(request).get("id"),
						messageContent });
		return renderData(true, "1", null);
	}

	///前端增删改查例子开始//
	@RequestMapping(value = "/test")
	public String test(Model model, HttpServletRequest request,String flag,String testName)throws Exception {
		String sql="select a.*,(select max(name) from t_customer b where a.customerId=b.id) customerName  from t_test a where 1=1";
		if(testName!=null&&!"".equals(testName)){
			sql+=" and testName like '%"+testName+"%' ";
		}
		sql+="  and customerId="+getCustomer(request).get("id");
		sql+=" order by id desc";
		List list = db.queryForList(sql);
		request.setAttribute("list", list);
		return "/front/test";
	}

	@RequestMapping(value = "/testaddSave")
	public ResponseEntity<String> testaddSave(Model model,HttpServletRequest request,Long id,String flag
		,Integer customerId,String testName,String testContent,String testSex,String testDay,String testPic,String insertDate) throws Exception{
		int result = 0;
		if(id!=null){
			String sql="update t_test set testName=?,testContent=?,testSex=?,testDay=?,testPic=? where id=?";
			result = db.update(sql, new Object[]{testName,testContent,testSex,testDay,testPic,id});
		}else{
			String sql="insert into t_test(customerId,testName,testContent,testSex,testDay,testPic,insertDate) values(?,?,?,?,?,?,now())";
			result = db.update(sql, new Object[]{getCustomer(request).get("id"),testName,testContent,testSex,testDay,testPic});
		}
		if(result==1){
			return renderData(true,"操作成功",null);
		}else{
			return renderData(false,"操作失败",null);
		}
	}

	@RequestMapping(value = "/testDelete")
	public ResponseEntity<String> testDelete(Model model,HttpServletRequest request,Long id,String flag) throws Exception {

		String sql="delete from t_test where id=?";
		int result = db.update(sql, new Object[]{id});
		if(result==1){
			return renderData(true,"操作成功",null);
		}else{
			return renderData(false,"操作失败",null);
		}

	}

	@RequestMapping(value = "/testadd")
	public String testadd(Model model, HttpServletRequest request,Long id,String flag)throws Exception {
		if(id!=null){
			//修改
			String sql="select * from t_test where id=?";
			Map map = db.queryForMap(sql,new Object[]{id});
			model.addAttribute("map", map);
		}String sql="";
		return "/front/testadd";
	}



	///前端增删改查例子结束/

	@RequestMapping(value = "/find")
	public String find(Model model, HttpServletRequest request)
			throws Exception {
		return "/front/find";
	}


	@RequestMapping(value = "/findSave")
	public ResponseEntity<String> findSave(Model model,
			HttpServletRequest request, String username, String phone)
			throws Exception {
		String sql = "select * from t_customer where username=? and phone=?";
		List<Map> list = db.queryForList(sql, new Object[] { username,phone });
		System.out.println(list);
		String result = "1";
		if (list != null && list.size() > 0) {
			Map map = list.get(0);
			return renderData(true, result, null);
		} else {
			return renderData(false, result, null);
		}

	}

	@RequestMapping(value = "/findSaveConfirm")
	public ResponseEntity<String> findSaveConfirm(Model model,
			HttpServletRequest request, String username, String phone,String password)
			throws Exception {
		String sql = "update t_customer set password=? where  username=? and phone=?";
		db.update(sql, new Object[] {password, username,phone });
		return renderData(true, "", null);
	}


	@RequestMapping(value = "/lt")
	public String lt(Model model, HttpServletRequest request,String searchName,Long oneClassifyId)
			throws Exception {
		Map customer = getCustomer(request);


		String sql="select a.*,(select max(customerName) from t_customer b where b.id=a.customerId) customerName," +
				"(select count(1) from t_pinglun b where b.wdxxId=a.id) nums from t_wdxx a where 1=1  ";
		if(searchName !=null&&!"".equals(searchName)){
			sql+=" and a.title like '%"+searchName+"%'";
		}
		if(customer==null||customer.size()==0){
			sql+=" and a.nologin='是' ";
		}
		sql+=" order by id desc";
		List<Map> list = db.queryForList(sql);
		model.addAttribute("list", list);
		return "/front/lt";
	}

	@RequestMapping(value = "/wdxxList")
	public String wdxxList(Model model, HttpServletRequest request,String flag,String title)throws Exception {
		String sql="select a.*,(select max(customerName) from t_customer b where a.customerId=b.id) customerName  from t_wdxx a where 1=1";

		if(1==1){sql+=" and customerId="+getCustomer(request).get("id") +" ";}
	if(title!=null&&!"".equals(title)){
			sql+=" and title like '%"+title+"%'";
		}
		sql+=" order by id desc";
		List list = db.queryForList(sql);
		request.setAttribute("list", list);
		return "/front/wdxxList";
	}

	@RequestMapping(value = "/mineaddress")
	public String mineaddress(Model model, HttpServletRequest request,String flag,String title)throws Exception {
		String sql="select a.* from t_address a where 1=1";

		if(1==1){sql+=" and customerId="+getCustomer(request).get("id") +" ";}
		sql+=" order by id desc";
		List list = db.queryForList(sql);
		request.setAttribute("list", list);
		return "/front/mineaddress";
	}


	@RequestMapping(value = "/minesc")
	public String minesc(Model model, HttpServletRequest request,String flag,String title)throws Exception {
		String sql="select (select max(productName) from t_product b where b.id=a.productId) productName,(select max(productPic1) from t_product b where b.id=a.productId) productPic1,id,productId  from t_sc a where 1=1";
if(1==1){sql+=" and customerId="+getCustomer(request).get("id") +" ";}
		sql+=" order by id desc";
		List list = db.queryForList(sql);
		System.out.println(sql);
		request.setAttribute("list", list);
		return "/front/minesc";
	}

	@RequestMapping(value = "/minexiaoxi")
	public String minexiaoxi(Model model, HttpServletRequest request,String flag,String title)throws Exception {
		String sql=" select * from t_xiaoxi a where 1=1";
if(1==1){sql+=" and customerId="+getCustomer(request).get("id") +" ";}
		sql+=" order by id desc";
		List list = db.queryForList(sql);
		request.setAttribute("list", list);
		return "/front/minexiaoxi";
	}

	@RequestMapping(value = "/hywdxxList")
	public String hywdxxList(Model model, HttpServletRequest request,String flag,String title)throws Exception {
		Map customer = getCustomer(request);
		String sql="select a.*,(select max(name) from t_customer b where a.customerId=b.id) customerName  from t_wdxx a where 1=1";
		sql+=" and exists(select 1 from t_wdhy b where a.customerId=b.hhId and b.customerId="+customer.get("id")+") ";
	if(title!=null&&!"".equals(title)){
			sql+=" and title like '%"+title+"%'";
		}
		sql+=" order by id desc";
		List list = db.queryForList(sql);
		request.setAttribute("list", list);
		return "/front/wdxxList";
	}

	@RequestMapping(value = "/wdxxEditSave")
	public ResponseEntity<String> editSave(Model model,HttpServletRequest request,Long id,String flag
		,Integer customerId,String title,String pic,String content,Integer zan,String insertDate,String nologin,Long bkId) throws Exception{
		int result = 0;
		if(id!=null){
			String sql="update t_wdxx set title=?,pic=?,content=?,nologin=?,bkId=? where id=?";
			result = db.update(sql, new Object[]{title,pic,content,nologin,bkId,id});
		}else{
			String sql="insert into t_wdxx(customerId,title,pic,content,zan,insertDate,nologin,bkId) values(?,?,?,?,?,now(),?,?)";
			result = db.update(sql, new Object[]{getCustomer(request).get("id"),title,pic,content,0,nologin,bkId});
		}
		if(result==1){
			return renderData(true,"操作成功",null);
		}else{
			return renderData(false,"操作失败",null);
		}
	}


	@RequestMapping(value = "/mineaddressEditSave")
	public ResponseEntity<String> mineaddressEditSave(Model model,HttpServletRequest request,Long id,String province,String city,String area,String phone,String lxr,String xxdz) throws Exception{
		int result = 0;
		if(id!=null){
			String sql="update t_address set province=?,city=?,area=?,phone=?,lxr=?,xxdz=? where id=?";
			result = db.update(sql, new Object[]{province,city,area,phone,lxr,xxdz,id});
		}else{
			String sql="insert into t_address(customerId,province,city,area,phone,lxr,xxdz) values(?,?,?,?,?,?,?)";
			result = db.update(sql, new Object[]{getCustomer(request).get("id"),province,city,area,phone,lxr,xxdz});
		}
		if(result==1){
			return renderData(true,"操作成功",null);
		}else{
			return renderData(false,"操作失败",null);
		}
	}

	@RequestMapping(value = "/wdxxEditDelete")
	public ResponseEntity<String> editDelete(Model model,HttpServletRequest request,Long id,String flag) throws Exception {

		String sql="delete from t_wdxx where id=?";
		int result = db.update(sql, new Object[]{id});
		if(result==1){
			return renderData(true,"操作成功",null);
		}else{
			return renderData(false,"操作失败",null);
		}

	}

	@RequestMapping(value = "/wdxxEdit")
	public String wdxxEdit(Model model, HttpServletRequest request,Long id,String flag)throws Exception {
		if(id!=null){
			//修改
			String sql="select * from t_wdxx where id=?";
			Map map = db.queryForMap(sql,new Object[]{id});
			model.addAttribute("map", map);
		}String sql="";

		return "/front/wdxxEdit";
	}

	@RequestMapping(value = "/mineaddressEdit")
	public String mineaddressEdit(Model model, HttpServletRequest request,Long id,String flag)throws Exception {
		if(id!=null){
			//修改
			String sql="select * from t_address where id=?";
			Map map = db.queryForMap(sql,new Object[]{id});
			model.addAttribute("map", map);
		}String sql="";

		return "/front/mineaddressEdit";
	}

	@RequestMapping(value = "/wdxxShow")
	public String wdxxShow(Model model, HttpServletRequest request,Long id,String flag)throws Exception {
		if(id!=null){
			//修改
			String sql="select a.*,(select max(customerName) from t_customer b where a.customerId=b.id) customerName,(select count(1) from t_pinglun b where b.wdxxId=a.id) nums from t_wdxx a where id=?";
			Map map = db.queryForMap(sql,new Object[]{id});
			model.addAttribute("map", map);
		}
		String sql="select a.*,(select max(customerName) from t_customer b where a.customerId=b.id) customerName,(select max(headPic) from t_customer b where a.customerId=b.id) headPic from t_pinglun a where wdxxId=? order by id desc";
		List<Map> list = db.queryForList(sql,new Object[]{id});
		model.addAttribute("list", list);




		 sql="select a.*,(select max(customerName) from t_customer b where a.customerId=b.id) customerName  from t_wdxx a where 1=1 order by zan desc limit 4";
		List list3 = db.queryForList(sql);
		request.setAttribute("list3", list3);

		sql="select a.*,(select max(customerName) from t_customer b where a.customerId=b.id) customerName  from t_wdxx a where 1=1 order by id desc limit 4";
		List list4 = db.queryForList(sql);
		request.setAttribute("list4", list4);
		return "/front/wdxxShow";
	}

	@RequestMapping(value = "/wdxxDelete")
	public ResponseEntity<String> wdxxDelete(Model model,
			HttpServletRequest request, Long id) throws Exception {
		Map customer = getCustomer(request);
		String sql="delete from t_wdxx where  id=?";
		db.update(sql, new Object[]{id});
		return renderData(true, "操作成功", null);
	}

	@RequestMapping(value = "/addressDelete")
	public ResponseEntity<String> addressDelete(Model model,
			HttpServletRequest request, Long id) throws Exception {
		Map customer = getCustomer(request);
		String sql="delete from t_address where  id=?";
		db.update(sql, new Object[]{id});
		return renderData(true, "操作成功", null);
	}

	@RequestMapping(value = "/pinglunSave")
	public ResponseEntity<String> pinglunSave(Model model,HttpServletRequest request,Long id,String flag
		,String wdxxId,Integer customerId,String content,String insertDate) throws Exception{
		int result = 0;
		String sql="insert into t_pinglun(wdxxId,customerId,content,insertDate) values(?,?,?,now())";
		result = db.update(sql, new Object[]{wdxxId,getCustomer(request).get("id"),content});
		if(result==1){
			return renderData(true,"操作成功",null);
		}else{
			return renderData(false,"操作失败",null);
		}
	}


	@RequestMapping(value = "/productPinglunSave")
	public ResponseEntity<String> productPinglunSave(Model model,HttpServletRequest request,Long id,String flag
		,String productId,Integer customerId,String content,String insertDate) throws Exception{
		int result = 0;
		String sql="insert into t_pinglun_product(productId,customerId,content,insertDate) values(?,?,?,now())";
		result = db.update(sql, new Object[]{productId,getCustomer(request).get("id"),content});
		if(result==1){
			return renderData(true,"操作成功",null);
		}else{
			return renderData(false,"操作失败",null);
		}
	}

	@RequestMapping(value = "/zanSave")
	public ResponseEntity<String> zanSave(Model model,HttpServletRequest request,Long id) throws Exception{
		int result = 0;
		String sql="update t_wdxx set zan=zan+1 where id=?";
		result = db.update(sql, new Object[]{id});
		if(result==1){
			return renderData(true,"操作成功",null);
		}else{
			return renderData(false,"操作失败",null);
		}
	}


	@RequestMapping(value = "/zxList")
	public String zxList(Model model, HttpServletRequest request,String flag,String title)throws Exception {

		String sql="select a.* from t_zx a where 1=1 ";


	if(title!=null&&!"".equals(title)){
			sql+=" and title like '%"+title+"%'";
		}
		sql+=" order by id desc";
		List list = db.queryForList(sql);
		request.setAttribute("list", list);
		return "/front/zxList";
	}



	@RequestMapping(value = "/zxShow")
	public String zxShow(Model model, HttpServletRequest request,Long id,String flag)throws Exception {
		String sql="select * from t_zx where id=?";
		Map map = db.queryForMap(sql,new Object[]{id});
		model.addAttribute("map", map);
		 sql="select a.* from t_zx a where 1=1 ";
			sql+=" order by id desc limit 3";
			List list = db.queryForList(sql);
			request.setAttribute("list", list);
		return "/front/zxShow";
	}

	@RequestMapping(value = "/ltjlDelete")
	public ResponseEntity<String> ltjlDelete(Model model,HttpServletRequest request,Long id,String pl,String flag) throws Exception {
		System.out.println("getCustomer(request).get()==================="+getCustomer(request).get("id"));
		db.update("delete from t_liaotian where customerId=? or toId=?", new Object[]{getCustomer(request).get("id"),getCustomer(request).get("id")});
		return renderData(true,"操作成功",null);
	}

	@RequestMapping(value = "/liaotian")
	public String liaotian(Model model, HttpServletRequest request,Long id,String flag,Long toId)throws Exception {
		Map customer = getCustomer(request);
		if (customer != null && customer.size() > 0) {
		} else {
			return "redirect:/front/register.html";
		}


		String customerId = getCustomer(request).get("id").toString();
		String batchNum1 = customerId+"&&"+toId;
		String batchNum2 = toId+"&&"+customerId;
		List list = db.queryForList("select a.*,(select max(customerName) from t_customer b where a.customerId=b.id) customerName1," +
				"(select max(name) from t_user c where a.toId=c.id) customerName2 from t_liaotian a where batchNum in ('"+batchNum1+"','"+batchNum2+"') order by id asc");
		System.out.println("select a.*,(select max(customerName) from t_customer b where a.customerId=b.id) customerName1," +
				"(select max(name) from t_user c where a.toId=c.id) customerName2 from t_liaotian a where batchNum in ('"+batchNum1+"','"+batchNum2+"') order by id asc");
		model.addAttribute("list", list);


		System.out.println(list);
		return "/front/liaotian";
	}

	@RequestMapping(value = "/woxiaoxi")
	public String woxiaoxi(Model model, HttpServletRequest request,Long id,String flag,Long toId)throws Exception {
		String customerId = getCustomer(request).get("id").toString();
		String sql="select customerId,(select max(customerName) from t_customer b where b.id=a.customerId) customerName  from t_liaotian a where toId="+customerId+" group by customerId ";
		System.out.println(db.queryForList(sql));
		model.addAttribute("list", db.queryForList(sql));
		return "/front/woxiaoxi";
	}


	@RequestMapping(value = "/liaotianSave")
	public ResponseEntity<String> liaotianSave(Model model,HttpServletRequest request,Long toId,String content) throws Exception {
		String customerId = getCustomer(request).get("id").toString();
		String batchNum = customerId+"&&"+toId;
		db.update("insert into t_liaotian(customerId,toId,content,insertDate,batchNum,fq) values(?,?,?,now(),?,1)", new Object[]{customerId,toId,content,batchNum});
		return renderData(true,"操作成功",null);

	}


}

V. Project Summary

This topic mainly implements a movie information recommendation system based on user preferences. According to relevant analysis, this system mainly realizes the related operation functions of the two roles of front-end users and background management users, and specifically realizes online browsing, collection, commenting and reservation of movie information. function, and complete the data recommendation function of movie information according to the user's operation records. It mainly consists of the following chapters.

The first part mainly expounds the basic background and significance of developing this recommendation system through the introduction, and then describes the different research situations of the recommendation system at home and abroad and the related introduction and current status of the collaborative filtering algorithm application.

The second part introduces the SSM framework used in this system in detail, as well as the overall architecture model of the system and the type of database used.

The third part mainly analyzes the requirements of the system from various aspects and comprehensively, and demonstrates the feasibility of the system technology and operation, as well as the function points and non-functional requirements required by the system.

The fourth part mainly designs the overall architecture, functional architecture and business logic of the system based on the requirements of the system, and details the design of each small module, and also explains the database design and implementation of the system.

The fifth part mainly implements each functional module of the system and demonstrates the front-end page based on the system design in the previous part.

The sixth part of the test is to build a test environment and write test cases to complete the functional test of the system by clarifying the purpose and method of the test.

Guess you like

Origin blog.csdn.net/whirlwind526/article/details/131199942