package com.sxl.controller;
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.sxl.controller.MyController;
import com.sxl.util.StringHelper;
@Controller("frontController")
@RequestMapping(value = "/front")
public class FrontController extends MyController {
@RequestMapping(value = "/index")
public String frame(Model model, HttpServletRequest request)
throws Exception {
String sql="select a.* from t_zx a where 1=1 ";
sql+=" order by id desc limit 5";
List list = db.queryForList(sql);
request.setAttribute("list", list);
sql = "select * from t_lbt";
List list3 = db.queryForList(sql);
request.setAttribute("list3", list3);
return "/front/index";
}
@RequestMapping(value = "/login")
public String login(Model model, HttpServletRequest request)
throws Exception {
return "/front/login";
}
@RequestMapping(value = "/v1")
public String v1(Model model, HttpServletRequest request)
throws Exception {
return "/front/v1";
}
@RequestMapping(value = "/v2")
public String v2(Model model, HttpServletRequest request)
throws Exception {
return "/front/v2";
}
@RequestMapping(value = "/v3")
public String v3(Model model, HttpServletRequest request)
throws Exception {
return "/front/v3";
}
@RequestMapping(value = "/all")
public String all(Model model, HttpServletRequest request,Long typesId,String productName)
throws Exception {
String sql="select a.* from t_product a where 1=1";
if(productName!=null&&!"".equals(productName)){
sql+=" and a.productName like '%"+productName+"%' ";
}
sql+=" order by id 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 {
String sql = "select a.* 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);
return "/front/detail";
}
@RequestMapping(value = "/myOrder")
public String myOrder(Model model, HttpServletRequest request)
throws Exception {
String sql = "select * from t_huiyuanxf 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 = "/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)
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 = "";
for (int i = 0; i < list.size(); i++) {
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);
}
total+=20;
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(), productDetail.subSequence(1, productDetail.length()), total+"", "等待处理" });
sql = "delete from t_shopcar where customerId="
+ getCustomer(request).get("id");
db.update(sql);
sql="update t_customer set jf = jf+"+jf+",account=account-"+total +" where id="+getCustomer(request).get("id");
db.update(sql);
if (result == 1) {
return renderData(true, "操作成功", null);
} else {
return renderData(false, "操作失败", 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 b.*,a.id ids,a.num num from t_shopcar a left join t_prod
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
游泳馆信息管理系统-毕业设计.zip (1543个子文件)
FrontController.class 27KB
DBHelper.class 11KB
FileController.class 10KB
LiuyanController.class 6KB
ProductController.class 6KB
HuiyuanController.class 5KB
HuiyuanxfController.class 5KB
ContactController.class 5KB
HuiyuanywController.class 5KB
WdxxController.class 5KB
AdminEmployeeController.class 5KB
AdminCustomerController.class 5KB
MyController.class 5KB
PinglunController.class 5KB
GongziController.class 5KB
FeiyongController.class 5KB
XiaoxiController.class 5KB
ZxController.class 5KB
ChangdiController.class 5KB
EmployeeLoginController.class 4KB
CustomerLoginController.class 4KB
LbtController.class 4KB
EmployeeController.class 4KB
CustomerController.class 4KB
TjController.class 3KB
AdminLoginController.class 3KB
AdminController.class 3KB
ProtalSessionHandlerInterceptor.class 2KB
PublicController.class 2KB
FileController$uploadFile.class 2KB
DBHelper$1.class 2KB
H-ui.css 127KB
bootstrap.css 115KB
bootstrap.min.css 98KB
animate.min.css 68KB
easyui.css 51KB
easyui.css 51KB
easyui.css 51KB
easyui.css 50KB
editor_ie7.css 47KB
easyui.css 47KB
editor_iequirks.css 46KB
editor_ie8.css 46KB
editor_ie.css 45KB
editor_gecko.css 45KB
editor.css 45KB
font-awesome-ie7.css 40KB
animation.css 37KB
font-awesome-ie7.min.css 37KB
font-awesome.css 27KB
font-awesome.min.css 22KB
font-awesome.css 21KB
font-awesome.css 21KB
video-js.css 21KB
bootstrap-theme.min.css 19KB
font-awesome.min.css 17KB
dialog_ie7.css 17KB
swiper.3.1.7.css 17KB
dialog_ie8.css 16KB
dialog_iequirks.css 16KB
dialog_ie.css 16KB
dialog_opera.css 16KB
dialog.css 15KB
select2.min.css 15KB
custom-styles.css 13KB
dropzone.css 11KB
video-js.min.css 11KB
style.css 11KB
cssCharts.css 10KB
tabs.css 8KB
tabs.css 8KB
tabs.css 8KB
tabs.css 8KB
checkbox3.min.css 7KB
H-ui.admin.css 7KB
style.css 7KB
houtai.css 7KB
fox.css 7KB
fox.css 7KB
style.css 6KB
tabs.css 6KB
laydate.css 6KB
layer.css 6KB
datagrid.css 5KB
datagrid.css 5KB
datagrid.css 5KB
datagrid.css 5KB
dataTables.bootstrap.css 5KB
datepicker.css 5KB
datagrid.css 5KB
datepicker.css 5KB
sample.css 5KB
content.css 4KB
skin.css 4KB
public.css 4KB
skin.css 4KB
skin.css 4KB
linkbutton.css 4KB
linkbutton.css 4KB
linkbutton.css 4KB
共 1543 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
资源评论
博士僧小星
- 粉丝: 1947
- 资源: 5905
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功