|
|
|
@ -19,6 +19,7 @@ import org.springframework.ui.Model;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
@ -40,6 +41,15 @@ public class LoginController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private Power_Login_SetMapper powerLoginSetMapper;
|
|
|
|
|
|
|
|
|
|
@Value("${EMRMEDICALRECORD_URLHEAD}")
|
|
|
|
|
private String EMRMEDICALRECORD_URLHEAD;
|
|
|
|
|
|
|
|
|
|
@Value("${EMRMEDICALRECORD_IP}")
|
|
|
|
|
private String ip;
|
|
|
|
|
|
|
|
|
|
@Value("${EMRMEDICALRECORD_PORT}")
|
|
|
|
|
private String port;
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "login",method = RequestMethod.GET)
|
|
|
|
|
public String toLogin(Model model){
|
|
|
|
|
Power_Login_Set loginSet = powerLoginSetMapper.selectByPrimaryKey(1);
|
|
|
|
@ -49,7 +59,7 @@ public class LoginController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "login",method = RequestMethod.POST)
|
|
|
|
|
public String login(Power_User powerUser,HttpServletResponse response, HttpServletRequest request,Model model){
|
|
|
|
|
public void login(Power_User powerUser,HttpServletResponse response, HttpServletRequest request,Model model){
|
|
|
|
|
try {
|
|
|
|
|
Power_UserVo user = powerUserService.findPowerUserByUserNameAndUserPwd(powerUser);
|
|
|
|
|
//添加进操作日志
|
|
|
|
@ -113,7 +123,12 @@ public class LoginController {
|
|
|
|
|
CacheManager.putCache(token,new Cache(user,System.currentTimeMillis(),TOKEN_EXPIRE_TIME*1000));
|
|
|
|
|
ActionScopeUtils.setSessionAttribute("token",token,Integer.valueOf(String.valueOf(TOKEN_EXPIRE_TIME)));
|
|
|
|
|
ActionScopeUtils.setSessionAttribute("CURRENT_USER",user,Integer.valueOf(String.valueOf(TOKEN_EXPIRE_TIME)));
|
|
|
|
|
return "redirect:gatewayPage";
|
|
|
|
|
//单点登录跳转
|
|
|
|
|
String url=EMRMEDICALRECORD_URLHEAD+"/login?token="+token+"&userName="+user.getUserName()+"&flag=1";
|
|
|
|
|
//request.getRequestDispatcher(result).forward(request, response);
|
|
|
|
|
|
|
|
|
|
response.sendRedirect(url);
|
|
|
|
|
// return "redirect:gatewayPage";
|
|
|
|
|
}else{
|
|
|
|
|
//登录失败
|
|
|
|
|
Integer wrongNum = 1;
|
|
|
|
@ -137,9 +152,6 @@ public class LoginController {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
CacheManager.addExcCount("exc");
|
|
|
|
|
}
|
|
|
|
|
Power_Login_Set loginSet = powerLoginSetMapper.selectByPrimaryKey(1);
|
|
|
|
|
model.addAttribute("loginSet",loginSet);
|
|
|
|
|
return "loginDir/login";
|
|
|
|
|
}
|
|
|
|
|
@RequestMapping("refuse")
|
|
|
|
|
public String refuse(){
|
|
|
|
|