基于javaweb的SSM在线相机商城系统(java+ssm+jsp+jquery+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

320123022402

330123022402

340123022402

350123022402

360123022402

370123022402

基于javaweb的SSM在线相机商城系统(java+ssm+jsp+jquery+mysql)

项目介绍

分为两个角色,一个管理员,一个普通用户 管理员角色包含以下功能: 管理员登录,相机品牌管理,相机库存管理,相机商品管理,相机订单管理,相机售后管理,新闻资讯管理,物流管理等功能。 用户角色包含以下功能: 商城首页,查看详情评论商品,用户注册后登录,查看购物车,按分类查看商品,提交订单,选择地址支付页面,查看订单,查看收藏,申请售后,留言等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目  6.数据库:MySql 5.7等版本均可;

技术栈

  1. 后端:Spring springmvc mybatis 2. 前端:JSP+css+javascript+jQuery

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2.使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
     * Compare boolean.
*
* @param time1 the time 1
* @param time2 the time 2
* @return the boolean
* @throws ParseException the parse exception
*/
public static boolean compare(String time1, String time2) throws ParseException {
//如果想比较日期则写成"yyyy-MM-dd"就可以了
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
//将字符串形式的时间转化为Date类型的时间
Date a = sdf.parse(time1);
Date b = sdf.parse(time2);
//Date类的一个方法,如果a早于b返回true,否则返回false
if (a.before(b))
return true;
else
return false;
/*
* 如果你不喜欢用上面这个太流氓的方法,也可以根据将Date转换成毫秒
if(a.getTime()-b.getTime()<0)
return true;
else
return false;
*/
}

}



package com.util;


/**
* The type Smart upload.
*/
public class SmartUpload
{
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
		map.put("upass", MD5.getDigest(upass));
List<Member> list = memberDAO.selectAll(map);
if(list.size()==0){
return "redirect:skipLogin.do?suc=suc";
}else{
request.getSession().setAttribute("sessionmember", list.get(0));
return "redirect:index.do";
}
}

/**
* Register string.
*
* @param member the member
* @param request the request
* @return the string
*/
//注册
@RequestMapping("Register")
public String Register(Member member, HttpServletRequest request){
member.setUpass(MD5.getDigest(member.getUpass()));
member.setUtype("普通用户");
member.setDelstatus("0");
member.setSavetime(Info.getDateStr());
member.setJf(0);
member.setCardtype("普卡");
memberDAO.add(member);
return "redirect:skipReg.do?suc=suc";
}

/**
* Check uname.
*
* @param uname the uname
* @param request the request
* @param response the response
*/
//检查用户名的唯一性
@RequestMapping("checkUname")
public void checkUname(String uname, HttpServletRequest request, HttpServletResponse response){
try {
PrintWriter out = response.getWriter();
HashMap map = new HashMap();
map.put("uname", uname);
List<Member> list = memberDAO.selectAll(map);
if(list.size()==0){
out.print(0);
}else{
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

optionstr = permap.get(zdname.split("~")[0]).toString();


} else {
for (String str : zdname.split(";")) {
String zdstr = str.split("~")[0];
String zdnamestr = str.split("~")[1].equals("无名") ? "" : (str.split("~")[1] + ":");
optionstr += zdnamestr + permap.get(zdstr) + " - ";
}
}


if (optionstr.indexOf(" - ") > -1) optionstr = optionstr.substring(0, optionstr.length() - 3);
select += "<option value=\"" + optionstr + "\">" + optionstr + "</option>";
}
select += "</select>";
return select;
}

/**
* Gets .
*
* @param name the name
* @param tablename the tablename
* @param zdname the zdname
* @param where the where
* @return the
*/
public static String getradio(String name, String tablename, String zdname, String where) {
String radio = "";
int dxii = 0;
for (HashMap permap : new CommDAO().select("select * from " + tablename + " where " + where + " order by id desc")) {
String check = "";
if (dxii == 0) check = "checked=checked";

String optionstr = "";
for (String str : zdname.split(";")) {
String zdstr = str.split("~")[0];
String zdnamestr = str.split("~")[1].equals("无名") ? "" : (str.split("~")[1] + ":");
optionstr += zdnamestr + permap.get(zdstr) + " - ";
}
if (optionstr.length() > 0) optionstr = optionstr.substring(0, optionstr.length() - 3);

radio += "<label><input type='radio' name='" + name + "' " + check + " value=\"" + optionstr + "\">" + optionstr + "</label>\n";
dxii++;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
		

return "zffs";
}

/**
* Fukuan string.
*
* @param request the request
* @return the string
*/
//订单付款
@RequestMapping("fukuan")
public String fukuan(HttpServletRequest request){
Member member = (Member)request.getSession().getAttribute("sessionmember");
Member mmm = memberDAO.findById(member.getId());
String id = request.getParameter("id");
String sjtotal = request.getParameter("sjtotal");
String ticketid = request.getParameter("ticketid");
String addrid = request.getParameter("addrid");
String zffs = request.getParameter("zffs");
String shfs = request.getParameter("shfs");
//double yue = mmm.getMoney();
//查优惠券


double doublesjtotal = Double.parseDouble(sjtotal);
if(ticketid != null && !ticketid.equals("")){
Ticket ticket = ticketDAO.findById(Integer.valueOf(ticketid));
doublesjtotal = doublesjtotal - Double.valueOf(ticket.getMoney());
}
//boolean flag = true;
//double sxyue = yue-doublesjtotal;

//if(sxyue>=0){

Ordermsg ordermsg = ordermsgDAO.findById(Integer.parseInt(id));


Address address = addressDAO.findById(Integer.parseInt(addrid));
ordermsg.setAddress(address);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
                    mlist.add(list.get(i));
}
}
} catch (RuntimeException re) {
re.printStackTrace();
throw re;
}


return mlist;
}

}
package com.controller;







/**
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
     */
//后台查询活动
@RequestMapping("/admin/showNews")
public String shownews(int id,HttpServletRequest request){
News news = newsDAO.findById(id);
request.setAttribute("news", news);
saveobject.getCart(request);
saveobject.getCategoryObject(request);

return "admin/newsedit";
}


/**
* News show string.
*
* @param id the id
* @param request the request
* @return the string
*/
//前台查询活动
@RequestMapping("newsShow")
public String newsShow(int id,HttpServletRequest request){
News news = newsDAO.findById(id);
request.setAttribute("news", news);
HashMap map = new HashMap();
map.put("goodstype", "购买相机");
saveobject.hotSales("",request);
saveobject.getCart(request);
saveobject.getCategoryObject(request);
List<Product> zphlist = saveobject.hotSales("",request);
request.setAttribute("zphlist", zphlist);
return "newsx";
}

/**
* News edit string.
*
* @param news the news
* @param request the request
* @return the string
*/
//编辑活动
@RequestMapping("/admin/newsEdit")
public String newsEdit(News news,HttpServletRequest request){
newsDAO.update(news);
request.setAttribute("news", news);
return "redirect:newsList.do";
}


/**
* News del string.
*


项目链接:
https://javayms.github.io?id=361122572008200ts
https://javayms.pages.dev?id=361122572008200ts