作者主页:夜未央5788
简介:Java领域优质创作者、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.数据库:MySql 5.7版本;
6.是否Maven项目: 否;
技术栈
1. 后端:spring+structs+hibernate
2. 前端:JSP+css+javascript+bootstrap+jQuery+easyui+echarts
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
管理员账号密码:admin/123456
销售人员账号密码:user/123456
运行截图
管理员界面
销售角色
相关代码
登录Action
@Controller("loginAction")
@Scope("prototype")
public class LoginAction extends ActionSupport {
//============依赖注入start================
@Autowired
private ManageService manageService;//管理
@Autowired
private UserService userService;//用户
//===========依赖注入end==================
//-------------------------华丽分割线---------------------------------------------
//============自定义参数start=============
private Integer role;
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
private String userName;//用户名
private String passWord;//密码
private String code;//统一社会信用代码:
private Integer type;//1新型材料、2生物医药、3富硒食品、4安康丝绸、5清洁能源、6装备制造
private String zczb;//注册资本
private String name;//企业名称
private String djjg;//登记机关
private String address;//地址
private String fr;//法定代表人
private String info;//企业简介包含 经营内容和数据分析
private Integer isSh;//是否审核 0否 1是
//============自定义参数end=============
//-------------------------华丽分割线---------------------------------------------
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassWord() {
return passWord;
}
public void setPassWord(String passWord) {
this.passWord = passWord;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getZczb() {
return zczb;
}
public void setZczb(String zczb) {
this.zczb = zczb;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDjjg() {
return djjg;
}
public void setDjjg(String djjg) {
this.djjg = djjg;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getFr() {
return fr;
}
public void setFr(String fr) {
this.fr = fr;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public Integer getIsSh() {
return isSh;
}
public void setIsSh(Integer isSh) {
this.isSh = isSh;
}
//============文件上传start=============
private File file;
//提交过来的file的名字
private String fileFileName;
//提交过来的file的MIME类型
private String fileContentType;
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
public String getFileFileName() {
return fileFileName;
}
public void setFileFileName(String fileFileName) {
this.fileFileName = fileFileName;
}
public String getFileContentType() {
return fileContentType;
}
public void setFileContentType(String fileContentType) {
this.fileContentType = fileContentType;
}
//============文件上传end=============
//-------------------------华丽分割线---------------------------------------------
public String login() {
return "login";
}
public String home() {
return "success";
}
//登录
public String toLogin(){
if(role==2){//销售
String hql = "from User where userName = :userName and passWord = :passWord and isDelete = 0 ";
Map<String,Object> alias = new HashMap<String,Object>();
alias.put("userName",userName);
alias.put("passWord", passWord);
List<User> userList= userService.getByHQL(hql, alias);
if(userList.size()>0){
//将用户信息放入session
HttpSession session = ServletActionContext.getRequest()
.getSession();
session.setAttribute("userId",userList.get(0).getId() );
session.setAttribute("user", userList.get(0));
session.setAttribute("role", 1);
return "index";
}else{
return "login";
}
}else{
String hql = "from Manage where name = :userName and passWord = :passWord";
Map<String,Object> alias = new HashMap<String,Object>();
alias.put("userName",userName);
alias.put("passWord", passWord);
List<Manage> manageList=manageService.getByHQL(hql, alias);
if(manageList.size()>0){
//将用户信息放入session
HttpSession session = ServletActionContext.getRequest()
.getSession();
session.setAttribute("role", 2);
session.setAttribute("userName", manageList.get(0).getRealName());
session.setAttribute("userId2",manageList.get(0).getId() );
session.setAttribute("manage", manageList.get(0));
session.setAttribute("roleId", role);
return "index";
}else{
return "login";
}
}
}
管理Action
@Controller("manageAction")
@Scope("prototype")
public class ManageAction extends ActionSupport implements ModelDriven<Manage>{
private static final long serialVersionUID = 1L;
//==========model==============
private Manage manage;
@Override
public Manage getModel() {
if(manage==null) manage = new Manage();
return manage;
}
//==========model==============
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private ManageService manageService;
//依赖注入 end dao/service/===
//-------------------------华丽分割线---------------------------------------------
//============自定义参数start=============
//============自定义参数end=============
//-------------------------华丽分割线---------------------------------------------
//============文件上传start=======================================================
private File file;
//提交过来的file的名字
private String fileFileName;
//提交过来的file的MIME类型
private String fileContentType;
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
public String getFileFileName() {
return fileFileName;
}
public void setFileFileName(String fileFileName) {
this.fileFileName = fileFileName;
}
public String getFileContentType() {
return fileContentType;
}
public void setFileContentType(String fileContentType) {
this.fileContentType = fileContentType;
}
//============文件上传end=========================================================
//-------------------------华丽分割线---------------------------------------------//
//=============公=======共=======方=======法==========区=========start============//
/**
* 列表分页查询
* private String name;
private String passWord;
private String realName;//真实名
private int type;//管理员类型 1 是超级管理员 2 是普通管理员
*/
public String manage(){
Map<String,Object> alias = new HashMap<String,Object>();
StringBuffer sb = new StringBuffer();
sb = sb.append("from Manage where 1=1 and type = 2");
if(manage!=null && manage.getName() !=null && !"".equals(manage.getName())){
sb.append(" and name like :name");
alias.put("name", "%" +manage.getName()+ "%");
}
sb = sb.append(" order by id desc");
Pager<Manage> pagers = manageService.findByAlias(sb.toString(),alias);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("Manage", manage);
return SUCCESS;
}
/**
* 跳转到添加页面
* @return
*/
public String add(){
return SUCCESS;
}
/**
* 执行添加
* @return
*/
public String exAdd(){
manage.setType(2);
manageService.save(manage);
ActionContext.getContext().put("url", "/manage_manage.do");
return "redirect";
}
/**
* 查看详情页面
* @return
*/
public String view(){
Manage n = manageService.getById(manage.getId());
ActionContext.getContext().put("Manage", n);
return SUCCESS;
}
/**
* 跳转修改页面
* @return
*/
public String update(){
Manage n = manageService.getById(manage.getId());
ActionContext.getContext().put("Manage", n);
return SUCCESS;
}
/**
* 执行修改
* @return
*/
public String exUpdate(){
//Manage n = manageService.getById(manage.getId());
manage.setType(2);
manageService.update(manage);
ActionContext.getContext().put("url", "/manage_manage.do");
return "redirect";
}
ShopAction
@Controller("shopAction")
@Scope("prototype")
public class ShopAction extends ActionSupport implements ModelDriven<Shop>{
private static final long serialVersionUID = 1L;
//==========model==============
private Shop shop;
@Override
public Shop getModel() {
if(shop==null) shop = new Shop();
return shop;
}
//==========model==============
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private ShopService shopService;
//依赖注入 end dao/service/===
//-------------------------华丽分割线---------------------------------------------
//============自定义参数start=============
//============自定义参数end=============
//-------------------------华丽分割线---------------------------------------------
//============文件上传start=======================================================
private File file;
//提交过来的file的名字
private String fileFileName;
//提交过来的file的MIME类型
private String fileContentType;
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
public String getFileFileName() {
return fileFileName;
}
public void setFileFileName(String fileFileName) {
this.fileFileName = fileFileName;
}
public String getFileContentType() {
return fileContentType;
}
public void setFileContentType(String fileContentType) {
this.fileContentType = fileContentType;
}
//============文件上传end=========================================================
//-------------------------华丽分割线---------------------------------------------//
//=============公=======共=======方=======法==========区=========start============//
/**
* 列表分页查询
*/
public String shop(){
Map<String,Object> alias = new HashMap<String,Object>();
StringBuffer sb = new StringBuffer();
sb = sb.append("from Shop where 1=1 and isDelete = 0 ");
if(shop!=null && shop.getName() !=null && !"".equals(shop.getName() )){
sb.append(" and name like :name ");
alias.put("name", "%" +shop.getName() + "%" );
}
sb = sb.append("order by id desc");
Pager<Shop> pagers = shopService.findByAlias(sb.toString(),alias);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("Obj", shop);
return SUCCESS;
}
/**
* 跳转到添加页面
* @return
*/
public String add(){
return SUCCESS;
}
/**
* 执行添加
* @return
*/
public String exAdd(){
shop.setIsDelete(0);
shopService.save(shop);
ActionContext.getContext().put("url", "/shop_shop.do");
return "redirect";
}
如果也想学习本系统,下面领取。回复:112ssh
今天的文章SSH便利店管理系统分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/8682.html