四川大学锦江学院计算机学院
管理员对员工操作的相关代码: package com.sell.action; import java.io.IOException; import org.apache.commons.codec.digest.DigestUtils; import org.apache.struts2.ServletActionContext; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import com.opensymphony.xwork2.ActionContext; import com.sell.base.BaseAction; import com.sell.domain.TEmployee; @SuppressWarnings(\@Controller @Scope(\public class IndexAction extends BaseAction
四川大学锦江学院计算机学院
tmlogin = employee.check(model.getEname(),model.getEpassword()); //检查用是否有权限登录 if(tmlogin!=null){ System.out.println(\ ActionContext.getContext().getSession().put(\ return \ }else{ System.out.println(\ //登录失败 addFieldError(\用户名或密码不正确!\ return \ } }else{ System.out.println(\ System.out.println(\ return \ } } /** * 退出处理 */ public String logout(){ ActionContext.getContext().getSession().remove(\ return \ } private String newPassword;//新密码 private String oldpassword; //原始密码 /** * 密码修改UI */ public String modifyUI(){ return \ } /** * 密码修改 */ public String modify(){ model = (TEmployee)ActionContext.getContext().getSession().get(\ employee.updatePsw(model,DigestUtils.md5Hex(newPassword)); ActionContext.getContext().put(\ return \ } /** * 验证密码是否正确 第 32 页
四川大学锦江学院计算机学院
} * @return * @throws IOException */ public String checkPsw() throws IOException{ boolean b = false; if(oldpassword!=null){ b = employee.checkPsw(oldpassword); } String result = b ? \ ServletActionContext.getResponse().getWriter().write(result); return null; } public String getNewPassword() { return newPassword; } public void setNewPassword(String newPassword) { this.newPassword = newPassword; } public String getOldpassword() { return oldpassword; } public void setOldpassword(String oldpassword) { this.oldpassword = oldpassword; } 管理员可以随时修改自己的密码,避免系统信息泄露。 密码修改如图5.4所示
图5.4 密码修改
第 33 页
四川大学锦江学院计算机学院
部分关键代码: /** * 密码修改 */ public String modify(){ model = (TEmployee)ActionContext.getContext().getSession().get(\mployee\); employee.updatePsw(model,DigestUtils.md5Hex(newPassword)); ActionContext.getContext().put(\, \); return \; } 4.3 交易管理模块设计
此模块的功能是:对货物的操作,如进货登记,销货登记,退货登记,以及在进货中对厂商的添加与查询。
4.3.1 进货登记
首先是进入到的是现存商品列表(库存列表),可显示查看到现存商品(库存)的相关信息,如需进货,只需点击新建即可添加新的货物商品。 图如 图5.6所示
在进货登记页面中,有相关功能—选择厂商、查看厂商列表,如果在厂商列表
第 34 页
四川大学锦江学院计算机学院
中没有商品的相关厂商,同时是可以对其添加新厂商(此功能只针对于管理员操作)。 进货登记图如图5.6所示。
图5.6 进货登记图
4.3.2 销货登记
在交易管理中,点击销货登记,先将是显示需要销货的列表(现存商品列表),在每一行中,可以再操作当作选择销售,在选择销货的时候,将显示销货信息,可以修改数量,进行销货,以及确定销售信息。
第 35 页