一、项目介绍
管理员管理用户和用人单位和发布的职位信息,用人单位发布职位,查看投递该职位的用户情况,用户可以投递简历。当然了,各个角色都可以对相关信息进行增删改查。
二、环境需要
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. 后端:mysql+Spring+hibernate+Struts 2
2. 前端:HTML+CSS+JavaScript+jsp
四、使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
五、运行截图
用户角色
六、相关代码
登录控制器
@Controller("loginAction")
@Scope("prototype")
public class LoginAction extends ActionSupport implements ModelDriven<User>{
private User user;
@Autowired
private UserService userService;
private int otherId;
@Autowired
private ExtensionService extensionService;
@Autowired
private SpecialService specialService;
@Autowired
private NewsService newsService;
@Autowired
private AdvertisementService advertisementService;
@Override
public User getModel() {
if(user==null) user = new User();
return user;
}
//首页
public String index(){
return "success";
}
//登陆页面
public String login() {
//1查询合作站点以及友情链接
List<Extension> es = extensionService.findAll();
ActionContext.getContext().put("es", es);
//2专题
List<Special> ss = specialService.findAll();
ActionContext.getContext().put("ss", ss);
return "success";
}
//注册页面
public void register() throws IOException {
HttpServletResponse resp = ServletActionContext.getResponse();
resp.setContentType("application/json;charset=UTF-8");
PrintWriter out = null;
JSONObject js = new JSONObject();
user.setCreateTime(new Date());
User u = userService.isregister(user);
if(u != null){
js.put("message", "用户名已存在!");
}else{
userService.add(user);
js.put("message", "注册成功!");
}
out = resp.getWriter();
out.write(js.toString());
}
//退出
public String tuichu() {
ActionContext ac = ActionContext.getContext();
Map session = ac.getSession();
session.remove("userName");
session.remove("userId");
//1查询合作站点以及友情链接
List<Extension> es = extensionService.findAll();
ActionContext.getContext().put("es", es);
//2专题
List<Special> ss = specialService.findAll();
ActionContext.getContext().put("ss", ss);
return "login";
}
}
管理控制器
@Controller("manageAction")
@Scope("prototype")
public class ManageAction extends ActionSupport implements ModelDriven<Manage>{
private Manage manage;
@Autowired
private UserService userService;
@Autowired
private ManageService manageService;
@Autowired
private MessageService messageService;
private int userId;
private String userName;
private int sayId;
public int getSayId() {
return sayId;
}
public void setSayId(int sayId) {
this.sayId = sayId;
}
private File file;
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;
}
//提交过来的file的名字
private String fileFileName;
//提交过来的file的MIME类型
private String fileContentType;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
@Override
public Manage getModel() {
if(manage==null) manage = new Manage();
return manage;
}
/**
* 登陆以后进入首页
* @return
*/
public String index(){
Manage ma = manageService.login(manage);
if(ma == null){
return "login";
}
HttpSession session = ServletActionContext.getRequest().getSession();
session.setAttribute("userName", ma.getName());
session.setAttribute("userId", ma.getId());
return SUCCESS;
}
/**
* 获取用户列表
* @return
*/
public String userList(){
Pager<User> pagers = userService.listAll(userName);
//这里需要对等级进行遍历
/*List<Grade> list = gradeService.list();
if(pagers != null && pagers.getDatas() != null && pagers.getDatas().size()>0){
for(User u : pagers.getDatas()){
//对这里的人 进行遍历
for(Grade g: list){
if(u.getJifen()>=g.getStartMin() && u.getJifen() <=g.getEndMax()){
u.setDengji(g.getName());
}
}
}
}*/
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("userName1", userName);
return SUCCESS;
}
/**
* 根据用户id查询所有图片
* @return
*/
/*public String userPhotos(){
Pager<SayMood> pagers = sayMoodService.findAllphotosById(userId);
ActionContext.getContext().put("pagers", pagers);
return SUCCESS;
}
*/
/**
* 删除照片
* @return
*/
/*public String delsay(){
sayMoodService.del(sayId);
ActionContext.getContext().put("url", "/manage_userPhotos.do");
return "redirect";
}*/
//删除用户
public String delUse(){
userService.delUse(userId);
ActionContext.getContext().put("url", "/manage_userList.do");
return "redirect";
}
//经警告用户
public String jinggao(){
messageService.updatejinggao(userId);
ActionContext.getContext().put("url", "/manage_userList.do");
return "redirect";
}