如何用Java实现一套特色民宿平台系统?

简介: 如何用Java实现一套特色民宿平台系统?

一,环境介绍

语言环境:Java:  jdk1.8

数据库:Mysql: mysql5.7

应用服务器:Tomcat:  tomcat8.5.31

开发工具:IDEA或eclipse

开发技术:SSM框架+Jquery+Ajax+HTML

应用算法:协同过滤算法

二,项目简介

随着疫情的告一段落,全国各地的经济形势也在逐渐好转,时隔三年的旅游需求有一定程度的爆发,春节旅游的爆发就是一个很好的说明。旅游业的恢复也需要一定的时间,三年的时间让很多原本旅游相关的行业基本处于停滞状态。而这其中的民宿运营更是雪上加霜。

如何利用新科技,新技术,利用互联网来为这些民宿运营者进行相应的推广而引流,就是本次课题要研究的问题。本课题基于JAVA技术的相关应用,开发出一个特色民宿的在线宣传和预定的平台,以期为这些广大的有特色的民宿运营者提供一些帮助,也方便更多的旅游爱好者在本平台找到更适合自己的民宿,带来更好的体验。

本系统主要使用了SSM框架和MYSQL数据库,基于IDEA开发工具来开发实现,完成了一个民宿在线平台系统,实现了前端用户在线浏览和民宿预定,分享民宿旅游攻略,地图定位民宿等操作,后台管理用户管理注册用户,民宿信息,旅游攻略等基本信息,并提供了用户互动的基本操作,比如评论、收藏、反馈留言等。

本系统的开发与设计主要围绕民宿及其周边信息开展,重要的业务模块主要包含民宿信息、周边旅游信息、民宿攻略、行业资讯信息等,实现用户在线预定,地图定位民宿位置,实现根据用户喜好采用协同过滤算法进行的个性化民宿推荐处理等。用户主要设计为两类,一类为前端注册用户,一类是平台管理用户,下面分别展示一下这两类用户的用例图,具体展示如下:

用户用例图如下:

(1)前端用户用例图,如图1:

图1 前端用户用例图

管理员用户用例图如下图2所示:

图2后台用户用例图

特色民宿管理平台,主要是管理和民宿相关的一些信息,实现在线信息展示及预定,以促进消费者更好的了解民宿,为民宿运营者带来更多客源流量,整体的功能结构设计图如下图3所示。

图3 功能结构图

前端用户的功能模块介绍:

(1)注册登录功能模块设计

前端用户进行相关操作时需要进行注册线上会员,填写个人账户信息和个人信息后注册成功后即可登陆。

  (2)个人信息管理功能模块设计

用户登录系统后,可以进入系统管理来修改密码,输入旧密码、新密码并确认密码,保证新密码和确认密码一致的情况下则修改成功,如果不一致则就修改失败。

  (3)信息浏览功能模块

前端用户可以在民宿平台上浏览民宿信息、相关景点信息、民宿攻略信息、行业资讯信息等,可以查看具体各类信息的详情,并可以在线评论,对于喜欢的民宿或景点,可以进行收藏。

  (4)在线预定功能模块

前端用户登陆后,进入民宿介绍的详情页面,可以点击预定按钮,在线预定民宿,并可以在个人中心中管理自己预定的民宿,待后台管理员审核通过后即算预定成功。

  (5)民宿攻略模块

用户可以在线进行发贴,书写自己的相关民宿住宿的感受,或某个景点的旅游攻略信息,并可以在线管理自己的贴子。

  (6)个性化推荐模块

民宿管理平台系统,会根据用户的浏览记录,进行相关的计算,采用协同过滤算法来给不同的用户进行相应的信息推荐,目前的数据模型主要是依据用户浏览的民宿特点,匹配相关性的民宿信息,在首页推荐模块进行推荐展示。

  (7)全文检索模块

   在民宿管理平台系统中,前端用户可以根据相关的关键词来进行搜索,会全文匹配民宿信息,景点信息等,根据标题说明来进行模糊匹配,将查找到的信息展现出来。

  (8)投诉建议

除了提供用户的在线评论和收藏等互动功能外,还提供了投诉建议模块,以便用户及时反馈相关的意见,由后台管理员进行处理。

后端用户的功能模块介绍:

  (1)个人信息管理:管理员登陆后台可以对个人的信息进行相应的管理操作。

  (2)用户管理:管理员可以对前端注册的用户信息进行相应的管理操作。

  (3)轮播图管理:对前端首页的轮播图信息进行相应的管理操作,可根据需求进行轮播图的更换等。

  (4)行业资讯管理:主要管理和发布民宿行业的相关动态新闻信息。

  (5)民宿管理:主要管理发布的民宿信息,详细的介绍民宿的位置,特点等,并在后台指定民宿的地图定位坐标,这使得前端用户可以直接通过百度地图定位民宿所在位置。

  (6)景点管理:主要管理民宿附近的相关景点信息,完成景点信息的增删改查操作。

  (7)订单管理:主要管理前端用户的下单信息,前端会员预定民宿后,需要管理员在后台进行审核,生效后方可入住使用。

  (8)攻略管理:主要管理前端民宿会员用户发布和民宿攻略信息。

  (9)投诉建议:对前端用户发布的投诉建议信息进行相关的管理操作。

三,系统展示

3.1 系统前台界面的实现

系统的界面设计主要包含了系统的登录界面、主界面以及各功能界面的设计与实现。 下面展示一下特色民宿的前端会员用户实现的相关功能模块。

3.1.1 注册登录功能界面的实现

   用户注册页面填写注册信息后即可进行登陆操作,如果忘记密码,还可以根据账户和注册时的手机号来重新设置新密码,下面展示一下注册和登陆界面,具体如下图4-1、图4-2所示:

图4-1  注册界面

图4-2  登陆界面

3.1.2 民宿推荐功能界面的实现

  在特色民宿的首页,会根据当前登陆用户的浏览记录,来进行相关性的推荐,这其中采用的是协同过滤算法,如果用户未登陆,也根据协同过滤算法将浏览量最高的给以进行推荐,具体如下图4-3所示:

3.1.3 民宿详情界面的实现

  用户点击进入民宿详情页面,可以浏览查看民宿的详情信息,对于喜欢的民宿可以进行收藏操作,如果想入住也可以进行在线预定,还可以在线对当前民宿进行评论操作,具体如下图4-4、图4-5所示:

图4-4  民宿详情界面

图4-5  在线预定界面

3.1.4 我的预定界面的实现

   前端用户登陆后可以查看自己预定的民宿信息,并进行相应的管理操作,具体如下图4-6所示:

图4-6  我的订单界面

3.1.5 我的收藏界面的实现

   前端用户登陆后可以查看自己收藏的民宿或景点信息,并进行相应的管理操作,具体如下图4-7所示:

图4-7  我的收藏界面

3.1.6 投诉建议界面的实现

   前端用户登陆后可以在线进行投诉建议留言的操作,后台管理员查看后会进行相应的处理,具体如下图4-8所示:

图4-8  投诉建议界面

3.2 系统后台功能的实现

3.2.1 管理员登录功能的实现

特色民宿系统的后台管理员在后台登陆界面输入账户密码后提交数据到后台接口,查询数据库后进行比对是否正确,登陆成功后跳转到后台主页面。如图4-9所示。

图4-9  管理员登录界面

3.2.2 个人中心功能的实现

特色民宿系统的后台管理员登陆后台可以修改自己的密码信息,输入旧密码和新密码后提交到数据接口,经过判断旧密码成功后再更新新密码。如图4-10所示。

图4-10  个人密码修改界面

3.2.3 轮播图管理功能的实现

特色民宿系统的后台管理员登陆后台可以管理前端首页展示的轮播图广告信息,完成新增、查看、修改或删除操作。如图4-11所示。

图4-11 轮播图管理界面

3.2.4 用户管理功能的实现

特色民宿系统的后台管理员登陆后台可以管理前端注册的会员用户信息,完成用户的模糊查询、修改和删除操作。如图4-12所示。

图4-12 用户管理界面

3.2.5 资讯管理功能的实现

特色民宿系统的后台管理员登陆后台可以管理前端展示的民宿行业的资读信息,完成资讯新闻的相关操作。如图4-13所示。

图4-13 资读管理界面

3.2.6 民宿管理功能的实现

特色民宿系统的后台管理员登陆后台可以管理前端展示的民宿详情信息,完成民宿详情的相关管理操作。如图4-14所示。

图4-14 民宿管理界面

3.2.7 景点管理功能的实现

特色民宿系统的后台管理员登陆后台可以管理前端展示的景点详情信息,完成景点详情的相关管理操作。如图4-15所示。

图4-15 景点管理界面

3.2.8 订单管理功能的实现

特色民宿系统的后台管理员登陆后台可以管理前端用户预定的民宿订单信息,完成订单信息的相关管理操作。如图4-16所示。

图4-16 订单管理界面

3.2.9 攻略管理功能的实现

特色民宿系统的后台管理员登陆后台可以管理前端用户发布的民宿攻略信息,完成攻略信息的相关管理操作。如图4-17所示。

图4-17 攻略管理界面

3.2.10 投诉建议管理功能的实现

特色民宿系统的后台管理员登陆后台可以管理前端用户发布的投诉建议信息,完成投诉信息的相关管理操作。如图4-18所示。

图4-18 投诉管理界面

四,核心代码展示

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);
  }
}

五,相关作品展示

基于Java开发、Python开发、PHP开发、C#开发等相关语言开发的各类毕业设计作品

基于Nodejs、Vue等前端技术开发设计的前端毕业设计作品

基于微信小程序和安卓APP应用开发的相关作品

基于51单片机等嵌入式物联网开发应用

基于各类算法实现的AI智能应用

基于大数据实现的各类数据管理和推荐系统

前沿技术、一站式服务、贴心售后解决你后顾之忧


相关文章
|
14天前
|
SQL 监控 数据可视化
完全开源!国内首个完全开源JAVA企业级低代码平台
JeeLowCode 是一款专为企业打造的 Java 企业级低代码开发平台,通过五大核心引擎(SQL、功能、模板、图表、切面)和四大服务体系(开发、设计、图表、模版),简化开发流程,降低技术门槛,提高研发效率。平台支持多端适配、国际化、事件绑定与动态交互等功能,广泛适用于 OA、ERP、IoT 等多种管理信息系统,帮助企业加速数字化转型。
|
9天前
|
人工智能 监控 数据可视化
Java智慧工地信息管理平台源码 智慧工地信息化解决方案SaaS源码 支持二次开发
智慧工地系统是依托物联网、互联网、AI、可视化建立的大数据管理平台,是一种全新的管理模式,能够实现劳务管理、安全施工、绿色施工的智能化和互联网化。围绕施工现场管理的人、机、料、法、环五大维度,以及施工过程管理的进度、质量、安全三大体系为基础应用,实现全面高效的工程管理需求,满足工地多角色、多视角的有效监管,实现工程建设管理的降本增效,为监管平台提供数据支撑。
25 3
|
14天前
|
运维 自然语言处理 供应链
Java云HIS医院管理系统源码 病案管理、医保业务、门诊、住院、电子病历编辑器
通过门诊的申请,或者直接住院登记,通过”护士工作站“分配患者,完成后,进入医生患者列表,医生对应开具”长期医嘱“和”临时医嘱“,并在电子病历中,记录病情。病人出院时,停止长期医嘱,开具出院医嘱。进入出院审核,审核医嘱与住院通过后,病人结清缴费,完成出院。
45 3
|
18天前
|
Java 数据库连接 数据库
深入探讨Java连接池技术如何通过复用数据库连接、减少连接建立和断开的开销,从而显著提升系统性能
在Java应用开发中,数据库操作常成为性能瓶颈。本文通过问题解答形式,深入探讨Java连接池技术如何通过复用数据库连接、减少连接建立和断开的开销,从而显著提升系统性能。文章介绍了连接池的优势、选择和使用方法,以及优化配置的技巧。
16 1
|
20天前
|
JavaScript Java 项目管理
Java毕设学习 基于SpringBoot + Vue 的医院管理系统 持续给大家寻找Java毕设学习项目(附源码)
基于SpringBoot + Vue的医院管理系统,涵盖医院、患者、挂号、药物、检查、病床、排班管理和数据分析等功能。开发工具为IDEA和HBuilder X,环境需配置jdk8、Node.js14、MySQL8。文末提供源码下载链接。
|
20天前
|
SQL 监控 数据可视化
完全开源!国内首个完全开源JAVA企业级低代码平台
JeeLowCode 是一款专为企业打造的 Java 企业级低代码开发平台,通过五大核心引擎(SQL、功能、模板、图表、切面)和四大服务体系(开发、设计、图表、模版),简化开发流程,降低技术门槛,提高研发效率。平台支持多端适配、国际化、事件绑定与动态交互等功能,广泛适用于 OA、ERP、IoT 等多种管理信息系统,帮助企业加速数字化转型。
完全开源!国内首个完全开源JAVA企业级低代码平台
|
23天前
|
移动开发 前端开发 JavaScript
java家政系统成品源码的关键特点和技术应用
家政系统成品源码是已开发完成的家政服务管理软件,支持用户注册、登录、管理个人资料,家政人员信息管理,服务项目分类,订单与预约管理,支付集成,评价与反馈,地图定位等功能。适用于各种规模的家政服务公司,采用uniapp、SpringBoot、MySQL等技术栈,确保高效管理和优质用户体验。
|
25天前
|
XML JSON 监控
告别简陋:Java日志系统的最佳实践
【10月更文挑战第19天】 在Java开发中,`System.out.println()` 是最基本的输出方法,但它在实际项目中往往被认为是不专业和不足够的。本文将探讨为什么在现代Java应用中应该避免使用 `System.out.println()`,并介绍几种更先进的日志解决方案。
47 1
java中获取当前系统日期
java中获取当前系统日期
JAVA 获取系统日期时间
JAVA 获取系统日期时间
299 0