基于javaweb+mysql的ssm实现进销存系统(java+ssm+bootstrap+jsp+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM实现进销存系统(java+ssm+bootstrap+jsp+mysql)
项目介绍
进销存库存管理系统源码,采用了ssm框架,功能结构非常简单明了,界面也比较清爽大气,非常适合学生和Java新手拿来学习使用。 本项目主要分为管理员、销售、采购员三种角色; 管理员主要功能包括: 用户信息管理:用户查询、用户添加; 货物信息管理:货物查询、库存查询; 入库单信息管理:入库单新建、入库单审核; 出库信息管理:出库单新建、出库单审核; 销售主要功能包括: 出库信息管理:出库单新建; 采购员主要功能包括: 货物信息管理:库存查询 入库单信息管理:入库单新建;
环境要求:
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项目: 否;
6.数据库:MySql 5.7版本;
技术栈
-
后端:Spring SpringMVC MyBatis
-
前端:JSP+css+javascript+bootstrap+jQuery
//字符串拼接 将每次随机的字符 进行拼接
code += random[index];
}
//将拼接好的字符串赋值给展示的Value
codeV.value = code;
}
//下面就是判断是否== 的代码,无需解释
function validate() {
var name = $("#username").val();
var password = $("#password").val();
var requestDate = {};
requestDate["name"] = name;
requestDate["password"] = password;
var str = JSON.stringify(requestDate);
if (name == "") {
alert("请填写登录名");
return;
}
if (password == "") {
alert("请填写密码");
return;
}
$.ajax({
type : "get",
dataType : 'json',//默认转化对象
async : true,
url : "user/login", //提交到一般处理程序请求数据
data : {
"requestDate" : str
},
error : function() {
alert("登录失败,请与管理员联系!")
},
success : function(data) {
var suc = data.succ;
if (suc == "false") {
alert("登录失败,请确认用户名与密码");
}else if(suc == "no_auth"){
alert("状态不可用,请联系管理员");
}else {
alert("登录成功")
window.location.href = "user/sy.do";
}
}
});
}
</script>
</head>
<body
style="background: #fff url(${pageContext.request.contextPath}/moban/images/bg.jpg) repeat top left;">
@Override
public List bb() {
// TODO Auto-generated method stub
return sd.bb();
}
@Override
public List hws(String hw) {
// TODO Auto-generated method stub
return sd.hws(hw);
}
@Override
public Sh hwss(int id) {
// TODO Auto-generated method stub
return sd.hwss(id);
}
@Override
public List bbs() {
// TODO Auto-generated method stub
return sd.bbs();
}
}
@Service
public class HwServiceImpl implements HwService{
@Autowired
private HwDao hd;
@Override
public List sp(Hw hw) {
// TODO Auto-generated method stub
return hd.sp(hw);
}
@Override
public int spxj(Hw hw) {
public interface HwService {
int jj(int id);
List sp(Hw hw);
int spxj(Hw hw);
int xjrk(Hw hw);
Hw dy(int id);
int ckkk(Hw hw);
Hw dys(String name);
int updateHw(Hw hw);
}
public interface HwDao {
List sp(Hw hw);
int spxj(Hw hw);
int xjrk(Hw hw);
int jj(int id);
Hw dy(int id);
int ckkk(Hw hw);
Hw dys(String name);
int updateHw(Hw hw);
}
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>营销系统登录</title>
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/moban/css/index.css" />
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/moban/css/animate-custom.css" />
<script type="text/javascript">
//设置此处的原因是每次进入界面展示一个随机的验证码,不设置则为空
$().ready(function() {
//createCode();
});
//设置一个全局的变量,便于保存验证码
var code;
function createCode() {
//首先默认code为空字符串
code = '';
//设置长度,这里看需求,我这里设置了4
var codeLength = 4;
<input type="text" name="gy" class="textbox textbox_225" value="${hw.gy} " placeholder="供应商..."/>
</li>
<li>
<span class="item_name" style="width:120px;">联系电话:</span>
<input type="tel" name="phone" class="textbox textbox_225" value="${hw.phone} " placeholder="联系电话..."/>
</li>
<li>
<span class="item_name" style="width:120px;"></span>
<input type="submit" class="link_btn" value="提交"/>
</li>
</ul>
</div>
</form>
</section>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<!--xmlns:context="http://www.springframework.org/schema/context"-->
<!--除了控制器都扫描,和SpringMVC相反-->
<context:component-scan base-package="org.shop">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"></context:exclude-filter>
</context:component-scan>
<!--Spring的配置文件,这里主要配置和业务逻辑有关的-->
<!--数据源,事务控制。。-->
<context:property-placeholder location="classpath:dbconfig.properties"/>
<!--<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:dbconfig.properties"/>
</bean>-->
<bean id="pooledDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
System.out.println(json);
//System.out.println(list);
return "gly/bb";
}
//********************************采购******************************************
@RequestMapping("tzkccg")
public String tzkccg(Model model, Hw hw) {
hw.setSj(0);
hw.setSh(1);
model.addAttribute("list", h.sp(hw));
return "cg/kc";
}
@RequestMapping("tzrkcg")
public String tzrkcg() {
return "cg/rkd";
}
@RequestMapping("rkcg")
public String zjrkcg(Hw hw, HttpSession session) throws ParseException {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH");
String time = df.format(System.currentTimeMillis());
hw.setDate(df.parse(time));
hw.setSj(0);
hw.setSh(0);
String zrr = (String) session.getAttribute("name");
hw.setZrr(zrr);
h.xjrk(hw);
return "redirect:tzrkcg";
}
@RequestMapping("tzzupss")
public String tzzupss(Model model,HttpSession session) {
int id=(int) session.getAttribute("id");
User user = u.findid(id);
model.addAttribute("user", user);
return "cg/user";
}
//*************************************销售**************************************
@RequestMapping("tzckxs")
public String tzckxs(Model model, Hw hw) {
}
@RequestMapping("rks")
public String rk(int id, Hw hw) throws ParseException {
hw.setSj(0);
hw.setSh(1);
hw.setId(id);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH");
String time = df.format(System.currentTimeMillis());
hw.setDate(df.parse(time));
h.spxj(hw);
return "redirect:tzrksh";
}
@RequestMapping("tzck")
public String tzck(Model model, Hw hw) {
hw.setSh(1);
hw.setSj(1);
List list = h.sp(hw);
model.addAttribute("list", list);
return "gly/ckd";
}
@RequestMapping("ckid")
public String ckid(int id, Model model, HttpSession session) {
Hw list = h.dy(id);
int jj = list.getNumber();
session.setAttribute("jj", jj);
session.setAttribute("gg", list.getMoney());
model.addAttribute("list", list);
return "gly/ckl";
}
@RequestMapping("ckl")
public String ckl(Sh shh, HttpSession session) {
shh.setDate(new Date(System.currentTimeMillis()));
shh.setSh(0);
BigDecimal jgBigDecimal = new BigDecimal(shh.getJg().trim());
BigDecimal moneyBigDecimal = new BigDecimal(shh.getMoney().trim());
BigDecimal subtract = jgBigDecimal.subtract(moneyBigDecimal);
//double g = Double.parseDouble() - Double.valueOf();
//System.out.println(g);
User user = u.findid(id);
mode.addAttribute("user", user);
return "gly/user";
}
@RequestMapping("tzzup")
public String tzzup(Model model,HttpSession session) {
int id=(int) session.getAttribute("id");
User user = u.findid(id);
model.addAttribute("user", user);
return "gly/user";
}
@RequestMapping("upyh")
public String upyh(User user) throws ParseException {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH");
String time = df.format(System.currentTimeMillis());
user.setDate(new Date(System.currentTimeMillis()));
u.userup(user);
return "redirect:sy";
}
@RequestMapping("tzhw")
public String tzhw(Model model, Hw hw) {
hw.setSj(1);
hw.setSh(1);
model.addAttribute("list", h.sp(hw));
return "gly/hw";
}
@RequestMapping("xj")
public String spxj(int id, Hw hw) throws ParseException {
hw.setSh(1);
hw.setSj(0);
hw.setId(id);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH");
String time = df.format(System.currentTimeMillis());
hw.setDate(df.parse(time));
h.spxj(hw);
return "redirect:tzhw";
}
@RequestMapping("tzkc")
public String tzkc(Model model, Hw hw) {
hw.setSj(0);
hw.setSh(1);
model.addAttribute("list", h.sp(hw));
return "gly/kc";
}
@RequestMapping("sj")
public String spsj(int id, Hw hw) throws ParseException {
hw.setSh(1);
hw.setSj(1);
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public String getMoney() {
return money;
}
public void setMoney(String money) {
this.money = money;
}
public String getGy() {
return gy;
}
public void setGy(String gy) {
this.gy = gy;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public int getSj() {
return sj;
}
public void setSj(int sj) {
this.sj = sj;
}
public int getSh() {
return sh;
}
public void setSh(int sh) {
<li>
<label onselectstart="return false"><input type="checkbox" id="J_sorttable" name="style"/><var id="lang_orderbycontent"></var></label>
</li>
</ul>
<div class="clear"></div>
</div>
<div class="section">
<h3><var id="lang_tableSize"></var></h3>
<ul>
<li>
<label><input type="radio" id="J_autoSizeContent" name="size"/><var id="lang_autoSizeContent"></var></label>
</li>
<li>
<label><input type="radio" id="J_autoSizePage" name="size"/><var id="lang_autoSizePage"></var></label>
</li>
</ul>
<div class="clear"></div>
</div>
<div class="section">
<h3><var id="lang_borderStyle"></var></h3>
<ul>
<li>
<span><var id="lang_color"></var></span>
<input type="text" class="tone" id="J_tone" readonly='readonly' />
</li>
</ul>
<div class="clear"></div>
</div>
</div>
<div class="right">
<div class="section">
<h3><var id="lang_example"></var></h3>
<div class="preview" id="J_preview">
</div>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
public interface UserDao {
User login(User user);
int touser(User user);
List findall(User user);
int delete(int id);
User findid(int id);
int userup(User user);
}
public interface ShService {
int ck(Sh sh);
int cksh(Sh sh);
int jj(int id);
List cc(int sh);
List bb();
List hws(String hw);
Sh hwss(int id);
List bbs();
}
public interface ShDao {
int ck(Sh sh);
int cksh(Sh sh);
int jj(int id);
List cc(int sh);
List bb();
List hws(String hw);
Sh hwss(int id);
List bbs();
}
<!-- -->
<!--事务控制的配置-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<!--控制住数据源-->
<property name="dataSource" ref="pooledDataSource"></property>
</bean>
<!--开启基于注解的事务,使用xml配置形式的事务(必要主要的都是使用配置式)-->
<aop:config>
<!--切入点表达式-->
<aop:pointcut expression="execution(* org.shop.service..*(..))" id="txPoint" />
<!--配置事务增强-->
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPoint" />
</aop:config>
<!--配置事务增强,事务如何切入-->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<!--所有方法都是事务方法-->
<tx:method name="*"/>
<!--以get开始的所有方法-->
<tx:method name="get" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- -->
<!--Spring配置文件的核心点(数据源、与MyBatis的整合、事务控制-->
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
<!--SpringMVC的配置,包含网站跳转逻辑的控制配置-->
<context:component-scan base-package="org.shop" use-default-filters="false">
<!--只扫描控制器-->
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"></context:include-filter>
</context:component-scan>
<!--配置视图解析器,方便页面返回-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"></property>
</li>
<li>
<span class="item_name" style="width:120px;" name="t1">角色分配:</span>
<select class="select" name="t1">
<option value="0" name="t1" <c:if test="${user.t1 == 0}">selected</c:if> >管理员</option>
<option value="1" name="t1" <c:if test="${user.t1 == 1}">selected</c:if> >经理</option>
<option value="2" name="t1" <c:if test="${user.t1 == 2}">selected</c:if> >销售</option>
<option value="3" name="t1" <c:if test="${user.t1 == 3}">selected</c:if> >采购</option>
</select>
</li>
<li>
<span class="item_name" style="width:120px;" name="t2">验证:</span>
<select class="select" name="t2">
<option value="0" name="t2" <c:if test="${user.t2 == 0}">selected</c:if> >通过</option>
<option value="1" name="t2" <c:if test="${user.t2 == 1}">selected</c:if> >不通过</option>
</select>
</li>
<li>
<span class="item_name" style="width:120px;"></span>
<input type="submit" class="link_btn" value="更新/保存"/>
</li>
</ul>
</div>
</form>
</section>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>后台管理系统</title>
<meta name="author" content="DeathGhost" />
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/assets/css/style.css">
<!--[if lt IE 9]>
<![endif]-->
<script
src="${pageContext.request.contextPath}/assets/js/jquery.mCustomScrollbar.concat.min.js"></script>
<script>
(function($) {
$(window).load(
function() {
}
public void setDate(Date date) {
this.date = date;
}
public int getT1() {
return t1;
}
public void setT1(int t1) {
this.t1 = t1;
}
public int getT2() {
return t2;
}
public void setT2(int t2) {
this.t2 = t2;
}
public String getT3() {
return t3;
}
public void setT3(String t3) {
this.t3 = t3;
}
public String getT4() {
return t4;
}
public void setT4(String t4) {
this.t4 = t4;
}
}
public class Sh {
private int id;
private String hw;//货物名称
private String name;//客户名称
private String money;//进货价格
private String jg;//出货价格
private String lr;//利润
private String phone;//客户联系方式
private int sh;
private Date date;
private int sl;
private String zrr;
public String getZrr() {
return zrr;
}
public void setZrr(String zrr) {
this.zrr = zrr;
}
public int getSl() {
<delete id="jj" parameterType="int">
delete from hw where id=#{id}
</delete>
<update id="updateHw" parameterType="org.shop.pojo.Hw" >
update hw set date=#{date},number=#{number},name=#{name},money=#{money},gy=#{gy},phone=#{phone} where id=#{id}
</update>
</mapper>
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="edittable.css">
</head>
<body>
<div class="wrapper">
<div class="left">
<div class="section">
<h3><var id="lang_tableStyle"></var></h3>
<ul>
<li>
<label onselectstart="return false"><input type="checkbox" id="J_title" name="style"/><var id="lang_insertTitle"></var></label>
</li>
<li>
<label onselectstart="return false"><input type="checkbox" id="J_titleCol" name="style"/><var id="lang_insertTitleCol"></var></label>
</li>
</ul>
<ul>
<li>
<label onselectstart="return false"><input type="checkbox" id="J_caption" name="style"/><var id="lang_insertCaption"></var></label>
</li>
<li>
<label onselectstart="return false"><input type="checkbox" id="J_sorttable" name="style"/><var id="lang_orderbycontent"></var></label>
</li>
</ul>
<div class="clear"></div>
</div>
<div class="section">
<h3><var id="lang_tableSize"></var></h3>
<ul>
<li>
}
}
@RequestMapping("sy")
public String denglu(HttpSession session, String t2, Model model, String name, User user) {
int qx = (int) session.getAttribute("t1"); // 角色
// model.addAttribute("list", u.findall());
if (qx == 0) { // 管理员
model.addAttribute("list", u.findall(user));
return "gly/yh";
} else if (qx == 1) { // 管理员
model.addAttribute("list", u.findall(user));
return "gly/yh";
} else if (qx == 2) { // 销售
return "redirect:tzckxs";
} else if (qx == 3) { // 采购员
return "redirect:tzkccg";
}
return "redirect:/";
}
@RequestMapping("touser")
public String touser(User user) throws ParseException {
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH");
// String time = df.format(System.currentTimeMillis());
user.setDate(new Date(System.currentTimeMillis()));
user.setT1(2);
user.setT2(0);
u.touser(user);
return "redirect:tzlogin";
}
@RequestMapping("delete")
public String delete(int id) {
u.delete(id);
return "redirect:sy";
}
@RequestMapping("tjyh")
public String tzyh() {
return "gly/upyh";
}
@RequestMapping("insert")
public String insert(User user) throws ParseException {
//SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH");
//String time = df.format(new Date(System.currentTimeMillis()));
user.setDate(new Date(System.currentTimeMillis()));
width: 70px;
}
</style>
</head>
<body>
<div class="section">
<span><var id="lang_tdBkColor"></var></span>
<input type="text" id="J_tone"/>
</div>
<script type="text/javascript">
var tone = $G("J_tone"),
colorPiker = new UE.ui.ColorPicker({
editor:editor
}),
colorPop = new UE.ui.Popup({
editor:editor,
content:colorPiker
});
domUtils.on(tone, "click", function () {
colorPop.showAnchor(tone);
});
domUtils.on(document, 'mousedown', function () {
colorPop.hide();
});
colorPiker.addListener("pickcolor", function () {
tone.value = arguments[1];
colorPop.hide();
});
colorPiker.addListener("picknocolor", function () {
tone.value="";
colorPop.hide();
});
dialog.onok=function(){
editor.execCommand("edittd",tone.value);
};
var start = editor.selection.getStart(),
cell = start && domUtils.findParentByTagName(start, ["td", "th"], true);
if(cell){
var color = domUtils.getComputedStyle(cell,'background-color');
if(/^#/.test(color)){
<a href="tzkc">库存查询</a>
</dd>
</dl>
</li>
<li>
<dl>
<dt>入库单信息管理</dt>
<dd>
<a href="tzrk" class="active">入库单新建</a>
</dd>
<dd>
<a href="tzrksh">入库单审核</a>
</dd>
</dl>
</li>
<li>
<dl>
<dt>出库信息管理</dt>
<dd>
<a href="tzck" >出库单新建</a>
</dd>
<dd>
<a href="tzcksh">出库单审核</a>
</dd>
</dl>
</li>
<!-- <li>
<dl>
<dt>报表管理</dt>
<dd>
<a href="tzbb">生成报表</a>
</dd>
</dl>
</li> -->
</ul>
</aside>
<section class="rt_wrap content mCustomScrollbar">
<form action="update_hw_act" method="post">
<input type="hidden" name="id" value="${hw.id}">
<div class="rt_content">
<div class="page_title">
<h2 class="fl">请输入货物信息</h2>
</div>
<ul class="ulColumn2">
<li>
<span class="item_name" style="width:120px;">货物名称:</span>
<input type="text" name="name" class="textbox textbox_225" value="${hw.name} " placeholder="货物名称..."/>
</li>
<li>
<span class="item_name" style="width:120px;">数量:</span>
<input type="text" name="number" class="textbox textbox_225" value="${hw.number} " placeholder="数量..."/>