/**
* @Title: EmployeeInfoController.java
* @Package com.hhcq.laborUnion.controller
* @Description: TODO(用一句话描述该文件做什么)
* @author 贺鸿才
* @date 2020年1月17日
* @version V1.0
*/
package com.hhcq.laborUnion.controller;
import java.util.Map;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.log4j.Logger;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.hhcq.laborUnion.domain.EmployeeInfo;
import com.hhcq.laborUnion.service.EmployeeInfoService;
/**
* @ClassName: EmployeeInfoController
* @Description: TODO(这里用一句话描述这个类的作用)
* @author 贺鸿才
* @date 2020年1月17日
*
*/
@Controller
public class EmployeeInfoController {
@Autowired
private EmployeeInfoService employeeInfoService;
private static Logger logger = Logger.getLogger(EmployeeInfoController.class);
@RequestMapping(value = "/employeeInfo", method = RequestMethod.GET)
public ModelAndView employeeInfo(@RequestParam(value="id",required=true) String openId) {
logger.info("sdfds");
EmployeeInfo employeeInfo = employeeInfoService.getEmployeeInfoByOpenId(openId);
ModelAndView mav = new ModelAndView();
if (employeeInfo == null) {
//跳转至失败页
mav.setViewName("fail");
return mav;
} else {
//跳转至成功页
mav.addObject("id", employeeInfo.getId());
mav.addObject("name", employeeInfo.getUserName());
mav.addObject("gender", employeeInfo.getGender());
mav.addObject("birthday", employeeInfo.getBirthday());
mav.setViewName("success");
return mav;
}
}
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String login(@RequestParam(value="id",required=false) String openId,Map<String, Object> model) {
logger.info("sdfds");
model.put("msg", "工会系统,请输入账号密码");
return "login";
}
@RequestMapping(value = "/loginIn", method = RequestMethod.POST)
public String loginIn(@RequestParam(value="userName",required=true) String userName,@RequestParam(value="password",required=true) String password, Map<String, Object> model) {
logger.info("sdfds");
logger.info(userName+password);
Subject subject = SecurityUtils.getSubject();
EmployeeInfo employeeInfo = employeeInfoService.getEmployeeInfoByUsernameAndPassword(userName,password);
logger.info(ReflectionToStringBuilder.toString(employeeInfo));
UsernamePasswordToken token = new UsernamePasswordToken(employeeInfo.getUserName(),
employeeInfo.getPassword());
try {
subject.login(token);
model.put("id", employeeInfo.getId());
model.put("name", employeeInfo.getUserName());
model.put("gender", employeeInfo.getGender());
model.put("birthday", employeeInfo.getBirthday());
} catch (AuthenticationException e) {
return e.getMessage();
}
if(subject.hasRole("admin")){
return "success";
}
return "success";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于SSM框架搭建的工会系统.zip
共105个文件
jar:28个
xml:19个
class:15个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 2 浏览量
2023-11-12
10:53:50
上传
评论
收藏 32MB ZIP 举报
温馨提示
1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 -------- 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。
资源推荐
资源详情
资源评论
收起资源包目录
基于SSM框架搭建的工会系统.zip (105个子文件)
generatorConfig.xml.bak 2KB
EmployeeInfoController.class 4KB
CustomRealm.class 4KB
EmployeeInfo.class 4KB
EmployeeInfo.class 3KB
EmployeeInfoController.class 2KB
SercurityRoleServiceImpl.class 2KB
EmployeeInfoServiceImpl.class 1KB
SercurityRole.class 1KB
EmployeeInfoServiceImpl.class 931B
EmployeeInfoMapper.class 886B
SercurityRoleMapper.class 619B
EmployeeInfoMapper.class 444B
EmployeeInfoService.class 410B
SercurityRoleService.class 299B
EmployeeInfoService.class 245B
.classpath 2KB
org.eclipse.wst.common.component 988B
org.eclipse.wst.jsdt.ui.superType.container 49B
login.html 356B
druid-1.0.20.jar 2.03MB
aspectjweaver-1.8.0.jar 1.76MB
mybatis-3.3.0.jar 1.35MB
spring-context-4.3.8.RELEASE.jar 1.09MB
spring-core-4.3.8.RELEASE.jar 1.07MB
mysql-connector-java-5.1.31.jar 942KB
mysql-connector-java-5.1.31.jar 942KB
mysql-connector-java-5.1.31.jar 942KB
mysql-connector-java-5.1.31.jar 942KB
mysql-connector-java-5.1.31.jar 942KB
spring-webmvc-4.3.8.RELEASE.jar 894KB
spring-web-4.3.8.RELEASE.jar 799KB
spring-beans-4.3.8.RELEASE.jar 745KB
mybatis-generator-core-1.3.7.jar 659KB
mybatis-generator-core-1.3.7.jar 659KB
mybatis-generator-core-1.3.7.jar 659KB
mybatis-generator-core-1.3.7.jar 659KB
mybatis-generator-core-1.3.7.jar 659KB
log4j-1.2.17.jar 478KB
spring-jdbc-4.3.8.RELEASE.jar 418KB
jstl-1.2.jar 405KB
spring-aop-4.3.8.RELEASE.jar 372KB
spring-tx-4.3.8.RELEASE.jar 261KB
spring-expression-4.3.8.RELEASE.jar 257KB
aspectjrt-1.8.0.jar 114KB
commons-logging-1.2.jar 60KB
mybatis-spring-1.2.3.jar 50KB
slf4j-api-1.7.21.jar 40KB
EmployeeInfoController.java 4KB
EmployeeInfo.java 3KB
CustomRealm.java 3KB
EmployeeInfoServiceImpl.java 1KB
SercurityRole.java 904B
EmployeeInfoService.java 857B
SercurityRoleServiceImpl.java 841B
EmployeeInfoMapper.java 701B
SercurityRoleMapper.java 521B
SercurityRoleService.java 165B
.jsdtscope 639B
success.jsp 553B
success.jsp 553B
login.jsp 433B
fail.jsp 378B
fail.jsp 378B
index.jsp 57B
index.jsp 57B
inputFiles.lst 487B
createdFiles.lst 272B
inputFiles.lst 0B
MANIFEST.MF 129B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.jdt.core.prefs 675B
org.eclipse.core.resources.prefs 174B
org.eclipse.m2e.core.prefs 90B
org.eclipse.jdt.apt.core.prefs 69B
org.eclipse.wst.validation.prefs 50B
.project 1KB
log4j.properties 1KB
log4j.properties 1KB
log4j.properties 939B
pom.properties 229B
jdbc.properties 127B
jdbc.properties 127B
jdbc.properties 127B
pom.properties 120B
laborUnionSSM.war 13.8MB
EmployeeInfoMapper.xml 8KB
EmployeeInfoMapper.xml 8KB
pom.xml 4KB
pom.xml 4KB
spring-mybatis.xml 4KB
spring-mybatis.xml 4KB
SercurityRoleMapper.xml 3KB
SercurityRoleMapper.xml 3KB
web.xml 3KB
spring-mybatis.xml 3KB
generatorConfig.xml 2KB
generatorConfig.xml 2KB
web.xml 2KB
generatorConfig.xml 2KB
共 105 条
- 1
- 2
资源评论
程皮
- 粉丝: 262
- 资源: 2568
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功