How to implement a characteristic homestay platform system based on Java?

About the author: a full-stack development project, engaged in the development and research of Java, Python, front-end, and small programs, interested in big data applications and development,

Main content: Java project, front-end project, Python project, small program development, big data project, microcontroller

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

Get the source code at the end of the article 

Thank you for your attention, please bookmark to avoid forgetting, like to show encouragement, comment to give suggestions, love you

Item number: BS-PT-095

Table of contents

1. Environmental introduction

2. Project introduction

Three, system display

3.1 Implementation of the front-end interface of the system

3.1.1 Realization of registration and login function interface

3.1.2 Realization of homestay recommendation function interface

3.1.3 Realization of homestay details interface

3.1.4 Implementation of my reservation interface

3.1.5 Realization of My Favorites Interface

3.1.6 Realization of Complaint and Suggestion Interface

3.2 Realization of system background functions

3.2.1 Realization of administrator login function

3.2.2 Realization of Personal Center Function

3.2.3 Realization of carousel map management function

3.2.4 Realization of user management function

3.2.5 Realization of Information Management Function

3.2.6 Realization of homestay management functions

3.2.7 Realization of attractions management functions

3.2.8 Realization of order management function

3.2.9 Realization of strategy management function

3.2.10 Realization of complaint and suggestion management function

Fourth, the core code display

5. Display of related works


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 + Jquery + Ajax + HTML

Application Algorithm: Collaborative Filtering Algorithm

2. Project introduction

With the end of the epidemic, the economic situation across the country is gradually improving. After three years, the demand for tourism has exploded to a certain extent. The outbreak of Spring Festival tourism is a good illustration. The recovery of the tourism industry will also take a certain amount of time. Three years have brought many tourism-related industries to a standstill. And the operation of the homestay is even worse.

How to use new technology, new technologies, and the Internet to promote and attract traffic for these homestay operators is the problem to be studied in this project. Based on the related application of JAVA technology, this topic develops an online publicity and reservation platform for characteristic homestays, in order to provide some help for these characteristic homestay operators, and to facilitate more travel enthusiasts to find more on this platform. A homestay that suits you will bring you a better experience.

This system mainly uses the SSM framework and MYSQL database. It is developed and implemented based on IDEA development tools. It has completed an online platform system for homestays, which enables front-end users to browse online and book homestays, share homestay travel strategies, map location homestays and other operations, background management User management Registered users, homestay information, travel guides and other basic information, and provides basic operations for user interaction, such as comments, favorites, feedback messages, etc.

The development and design of this system are mainly carried out around the homestay and its surrounding information. The important business modules mainly include homestay information, surrounding tourism information, homestay strategy, industry information, etc., to realize online booking by users, map location of homestay, and realize according to user preferences. Personalized homestay recommendation processing using collaborative filtering algorithm, etc. There are mainly two types of users, one is front-end registered users, and the other is platform management users. The following shows the use case diagrams of these two types of users, specifically as follows:

The user use case diagram is as follows:

(1) Front-end user use case diagram, as shown in Figure 1:

Figure 1 Front-end user use case diagram

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

Figure 2 Background User Use Case Diagram

The characteristic homestay management platform mainly manages some information related to homestay, realizes online information display and reservation, so as to promote consumers to better understand homestay and bring more traffic to homestay operators. The overall functional structure design diagram As shown in Figure 3 below.

 Figure 3 Functional 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 homestay information, related scenic spots information, homestay strategy information, industry information, etc. on the homestay platform, view details of various types of information, and comment online, and save favorite homestays or attractions.

   (4) Online reservation function module

After the front-end user logs in, enter the details page of the homestay introduction, click the reservation button, book the homestay online, and manage the homestay he booked in the personal center. After the background administrator approves, the reservation is considered successful.

   (5) B&B strategy module

Users can post online, write their own feelings about homestay accommodation, or travel strategy information of a certain scenic spot, and can manage their own posts online.

   (6) Personalized recommendation module

The B&B 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 B&Bs browsed by users, matching relevant B&Bs information, and display the recommendation in the recommendation module on the home page.

   (7) Full-text search module

    In the homestay management platform system, front-end users can search based on relevant keywords, and will match the full text of homestay information, scenic spot 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 homestay industry.

   (5) Homestay management: Mainly manage the published homestay information, introduce the location and characteristics of the homestay in detail, and specify the map location coordinates of the homestay in the background, which allows front-end users to directly locate the homestay location through Baidu Maps.

   (6) Attraction management: mainly manage the relevant scenic spot information near the homestay, and complete the operation of adding, deleting, modifying and checking the scenic spot information.

   (7) Order management: It mainly manages the order information of the front-end users. After the front-end members book the homestay, they need to be reviewed by the administrator in the background, and they can check in and use it after it takes effect.

   (8) Raiders management: Mainly manage the front-end B&B member user releases and B&B strategy information.

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

Three, system display

3.1 Realization of the front-end interface of the system

The interface design of the system mainly includes the design and realization of the system's login interface, main interface and various functional interfaces. The following shows the relevant functional modules implemented by the front-end member users of the featured homestay.

3.1.1 Implementation of the registration and login function interface

    After filling in the registration information on the user registration page, you can log in. If you forget the password, you can also reset the new password according to the account and the mobile phone number at the time of registration. The following shows the registration and login interface, as shown in Figure 4-1 and Figure 4. -2 shows:

Figure 4-1 Registration interface

Figure 4-2 Login interface

3.1.2 Realization of homestay recommendation function interface

   On the homepage of the featured homestay, relevant recommendations will be made based on the browsing records of the currently logged-in user. The collaborative filtering algorithm is used. If the user is not logged in, the one with the highest number of views will also be recommended according to the collaborative filtering algorithm. , as shown in Figure 4-3 below:

3.1.3 Realization of homestay details interface

   The user clicks to enter the homestay details page, and can browse and view the detailed information of the homestay. For the favorite homestay, you can bookmark it. If you want to stay, you can also make online reservations. You can also comment on the current homestay online, as shown in Figure 4-4. As shown in Figure 4-5:

Figure 4-4 homestay details interface

Figure 4-5 Online reservation interface

3.1.4 Implementation of my reservation interface

    After the front-end user logs in, he can view the homestay information he booked and perform corresponding management operations, as shown in Figure 4-6 below:

 Figure 4-6 My order interface

3.1.5 Realization of My Favorites Interface

    After the front-end users log in, they can view the information of their favorite homestays or scenic spots, and perform corresponding management operations, as shown in Figure 4-7 below:

Figure 4-7 My Favorites interface

3.1.6 Realization of Complaint and Suggestion Interface

    After the front-end user logs in, they can make complaints and suggestions online, and the background administrator will check and deal with it accordingly, as shown in Figure 4-8 below:

Figure 4-8 Complaint suggestion interface

3.2 Realization of system background functions

3.2.1 Realization of administrator login function

The background administrator of the characteristic homestay system enters the account password on the background login interface and submits the data to the background interface, checks the database and compares whether it is correct, and jumps to the background main page after successful login. As shown in Figure 4-9.

Figure 4-9 Administrator login interface

3.2.2 Realization of Personal Center Function

The background administrator of the characteristic homestay system can modify his password information after logging in to the background, enter the old password and new password and submit them to the data interface, and update the new password after judging that the old password is successful. As shown in Figure 4-10.

Figure 4-10 Personal password modification interface

3.2.3 Realization of Carousel Map Management Function

The background administrator of the characteristic homestay system can log in to the background to manage the carousel advertisement information displayed on the front-end homepage, and complete the operations of adding, viewing, modifying or deleting. As shown in Figure 4-11.

Figure 4-11 Carousel map management interface

3.2.4 Realization of user management function

The background administrator of the characteristic homestay system can log in to the background to manage the registered user information of the front-end, and complete the user's fuzzy query, modification and deletion operations. As shown in Figure 4-12.

Figure 4-12 User management interface

3.2.5 Realization of Information Management Function

The background administrator of the characteristic homestay system can log in to the backstage to manage the qualification information of the homestay industry displayed on the front end, and complete the related operations of news and news. As shown in Figure 4-13.

Figure 4-13 Education management interface

3.2.6 Realization of homestay management functions

The background administrator of the characteristic homestay system can log in to the background to manage the homestay details displayed on the front end and complete the related management operations of the homestay details. As shown in Figure 4-14.

Figure 4-14 Homestay management interface

3.2.7 Realization of attractions management functions

The background administrator of the characteristic homestay system can log in to the background to manage the detailed information of the scenic spots displayed on the front end, and complete the related management operations of the scenic spot details. As shown in Figure 4-15.

Figure 4-15 Attraction management interface

3.2.8 Realization of order management function

The background administrator of the characteristic homestay system can log in to the backstage to manage the homestay order information booked by the front-end user, and complete the related management operations of the order information. As shown in Figure 4-16.

Figure 4-16 Order management interface

3.2.9 Realization of strategy management function

The background administrator of the characteristic homestay system can log in to the background to manage the homestay strategy information published by the front-end users, and complete the related management operations of the strategy information. As shown in Figure 4-17.

Figure 4-17 Strategy management interface

3.2.10 Realization of complaint and suggestion management function

The background administrator of the characteristic homestay system can log in to the background to manage the complaint and suggestion information published by the front-end users, and complete the related management operations of the complaint information. As shown in Figure 4-18.

Figure 4-18 Complaint management interface

Fourth, the core code display


package com.sys.controller.admin;

import java.util.List;
import java.util.Map;

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;

@Controller("adminController")
@RequestMapping(value = "/admin")
public class AdminController extends MyController {


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

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

	@RequestMapping(value = "/tj1")
	public String tj1(Model model, HttpServletRequest request)throws Exception {
		String sql="select DATE_FORMAT(insertDate,'%Y-%m-%d') dates,sum(allPrice) price from t_order order by DATE_FORMAT(insertDate,'%Y-%m-%d')  desc";
		List<Map> list = db.queryForList(sql);
		model.addAttribute("list", list);
		System.out.println(list);
		return "/admin/tj/tj1";
	}


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


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

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 1=1 order by id desc limit 3";
		List listb = db.queryForList(sql);
		request.setAttribute("listb", listb);

		//协同过滤推荐算法
		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, "A2");


			String sqlall="select a.*  from t_product a where 1=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")});
		}
	}

	@RequestMapping(value = "/all")
	public String all(Model model, HttpServletRequest request,Long typesId,String productName,String px)
			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("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);

	}


}

5. Display of related works

Various graduation design works based on Java development, Python development, PHP development, C# development and other related languages

Front-end graduation design works developed and designed based on Nodejs, Vue and other front-end technologies

Related works based on WeChat applet and Android APP application development

Development and application of embedded IoT based on 51 single-chip microcomputer

AI intelligent application based on various algorithms

Various data management and recommendation systems based on big data

Cutting-edge technology, one-stop service, considerate after-sales to solve your worries

 

 

Guess you like

Origin blog.csdn.net/znzbs/article/details/131673426