开发环境
开发工具:Eclipse/Myeclipse/IDEA JDK版本:Java8 数据库:MySQL5.7 运行环境:Tomcat
选题背景
随着计算机和网络的不断革新,世界已经进入了前所未有的电子时代。作为实用性强、应用范围广泛的会员管理系统也正在被越来越多的各类企业用于消费管理领域。然而,那些针对性强、企业理念清晰的大型超市也正发展迅速,这些大型超市应该具备一套实用便捷的会员积分管理系统来经营产品,让消费者和超市紧密联系起来。如今现有的会员管理系统已经不能充分满足超市用户的需求,用户需要更好的积分管理体系来体验丰富的管理方案,因此需要设计开发在效率、功能和技术上都有所提高的会员积分管理系统。 本文从超市会员管理的实质入手,从本质区别超市会员管理与其他商业消费的会员管理的根本区别,针对专一积分管理提出看法,希望让系统更适用于商业超市的发展。让积分制度实施在一个合适的领域内,并不是所谓的通用格式,而是一个适合超市的专属模式。因此设计开发一种适合超市使用的会员积分管理系统可以实效得解决问题,能够让超市的会员真实的感受到会员积分带来的好处。
系统模块设计结构图
系统设计模块划分
3.2.1 管理员功能
1)柜员账户列表,实现对柜员账户信息的管理。 2)新增柜员账户,实现添加柜员信息。 3)兑换商品列表,实现对兑换商品信息的查看、修改、删除操作。 4)新增兑换商品,实现添加系统中兑换商品信息。 5)会员类别管理,实现对系统中会员积分等级的设置。 6)积分类别选择,实现对系统中的会员积分兑换规则设置。 7)增加积分记录,实现查看柜员为会员兑换积分的工作记录。 8)兑换积分记录,实现查看柜员为会员兑换商品的工作记录。
3.2.2 柜员功能
1)用户列表管理,实现对会员信息的查看、修改、删除操作。 2)新增用户管理,实现添加会员信息。 3)会员积分管理,可以查看会员的积分和级别,并按照会员消费金额兑换积分。 4)兑换商品列表,可以查看兑换商品及所需积分,并可为会员兑换商品。 5)增加积分记录,实现查看柜员为会员兑换积分的工作记录。 6)兑换积分记录,实现查看柜员为会员兑换商品的工作记录。
代码参考
package com.action;
/**
*
*
*/
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.bean.ComBean;
import com.util.Constant;
import com.util.SmartFile;
import com.util.SmartUpload;
public class UpServlet extends HttpServlet {
private ServletConfig config;
/**
* Constructor of the object.
*/
public UpServlet() {
super();
}
final public void init(ServletConfig config) throws ServletException
{
this.config = config;
}
final public ServletConfig getServletConfig()
{
return config;
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding(Constant.CHARACTERENCODING);
response.setContentType(Constant.CONTENTTYPE);
HttpSession session = request.getSession();
String date=new SimpleDateFormat("yyyy-MM-dd HH:mm").format(Calendar.getInstance().getTime());
String date2=new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
try{
String method = null;
ComBean cb=new ComBean();
SmartUpload mySmartUpload = new SmartUpload();//init
int count = 0;
try{
mySmartUpload.initialize(config,request,response);
mySmartUpload.upload();
method = mySmartUpload.getRequest().getParameter("method").trim();
if(method.equals("JL")){//增加
/**
* String xm = ""; String url="";String xb=""; String sfz="";String xl="";String yx="";
String zy="";String cj="";String hj="";String sx=""; String lx=""; String dz="";
*/
String xm=mySmartUpload.getRequest().getParameter("xm");
String xb=mySmartUpload.getRequest().getParameter("xb");
String sfz=mySmartUpload.getRequest().getParameter("sfz");
String xl=mySmartUpload.getRequest().getParameter("xl");
String yx=mySmartUpload.getRequest().getParameter("yx");
String zy=mySmartUpload.getRequest().getParameter("zy");
String cj=mySmartUpload.getRequest().getParameter("cj");
String hj=mySmartUpload.getRequest().getParameter("hj");
String sx=mySmartUpload.getRequest().getParameter("sx");
String lx=mySmartUpload.getRequest().getParameter("lx");
String dz=mySmartUpload.getRequest().getParameter("dz");
SmartFile file = mySmartUpload.getFiles().getFile(0);
String fileExt=file.getFileExt();
String path="/pic";
count = mySmartUpload.save(path);
String member=(String)session.getAttribute("member");
String str=cb.getString("select id from jl where member='"+member+"'");
String sql="";
if(str==null){
sql="insert into jl( xm ,url, xb, sfz, xl, yx, zy, cj, hj, sx, lx, dz,member,flag)" +
"values('"+xm+"','"+path+"/"+file.getFileName()+"','"+xb+"' ,'"+sfz+"','"+xl+"','"+yx+"','"+zy+"','"+cj+"','"+hj+"'" +
",'"+sx+"','"+lx+"','"+dz+"','"+member+"','未审核')";
}
else{
sql="update jl set xm='"+xm+"',url='"+path+"/"+file.getFileName()+"',xb='"+xb+"' ,sfz='"+sfz+"',xl='"+xl+"'," +
"yx='"+yx+"',zy='"+zy+"',cj='"+cj+"',hj='"+hj+"'" +
",sx='"+sx+"',lx='"+lx+"',dz='"+dz+"' where member='"+member+"'";
}
int flag=cb.comUp(sql);
//int flag=pb.addBOOK(id,booktype, name, author, path+"/"+file.getFileName(), isbn, price, num, intro, jyjg,addtime);
if(flag==Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("member/jl/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("member/jl/index.jsp").forward(request, response);
}
}
else if(method.equals("upZT")){//修改
String id=mySmartUpload.getRequest().getParameter("id");
String title=mySmartUpload.getRequest().getParameter("title");
String fl=mySmartUpload.getRequest().getParameter("fl");
String content=mySmartUpload.getRequest().getParameter("infoContent");
SmartFile file = mySmartUpload.getFiles().getFile(0);
String fileExt=file.getFileExt();
String path="/pic";
count = mySmartUpload.save(path);
int flag=cb.comUp("update zt set title='"+title+"' ,url='"+path+"/"+file.getFileName()+"'," +
"fl='"+fl+"',content='"+content+"' where id='"+id+"'");
//int flag=pb.upBOOK(id, booktype, name, author, path+"/"+file.getFileName(), isbn, price, num, intro, jyjg,addtime);
if(flag==Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("admin/hzp/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("admin/hzp/index.jsp").forward(request, response);
}
}
else{
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}catch(Exception ex){
ex.printStackTrace();
//request.getRequestDispatcher("error.jsp").forward(request, response);
}
}catch(Exception e){
e.printStackTrace();
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}
}
程序运行截图