diff --git a/web/src/main/java/com/ibeetl/jlw/web/IndexController.java b/web/src/main/java/com/ibeetl/jlw/web/IndexController.java index e2b837f1..9025b94f 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/IndexController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/IndexController.java @@ -35,16 +35,14 @@ import com.ibeetl.jlw.dao.UniversitiesCollegesDao; import com.ibeetl.jlw.entity.*; import com.ibeetl.jlw.service.*; import com.ibeetl.jlw.web.query.CompetitionQuery; +import lombok.SneakyThrows; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.Cookie; @@ -904,72 +902,31 @@ public class IndexController { } //跳转到电脑端首页 + @SneakyThrows @RequestMapping("/index.do") public void index(HttpServletRequest request, HttpServletResponse response, - @TTeacher Teacher teacher, @TStudent Student student) { + @TTeacher Teacher teacher, @TStudent Student student, @RequestParam(name = "_role_tag", required = false) String roleTag ) { log.error("教师用户信息:"+ JSONUtil.toJsonStr(teacher)); log.error("学生用户信息:"+ JSONUtil.toJsonStr(student)); - //判断是老师还是学生 - if(null != student || null != teacher){//学生 - try { - String token = createSessionByUserId(); -// UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem)platformService.getOther(token); - try { + String roleTagCopy = StringUtils.isNotBlank(roleTag) ? ( "?_role_tag=" + roleTag ) : ""; - if(ApplicationRunnerController.isOnline){ - //TODO 根据 uSystem 跳不同的页面 - - String tsUrl = SpringUtil.getBean(Environment.class).getProperty("student.teacher.url"); -// response.sendRedirect(tsUrl +"home/"+token); - response.sendRedirect(tsUrl +"Home"); -// return "redirect:" + redirectUrl + "Home"; -// if(uSystem.getTypeId().toString().equals("1")){ //大数据基础 子应用 -// response.sendRedirect(redirectUrl+"/studentEnd_dsj/index.html"); -// }else if(uSystem.getTypeId().toString().equals("2")){ //金融大数据 子应用 -// response.sendRedirect(redirectUrl+"/studentEnd_jr/index.html"); -// }else if(uSystem.getTypeId().toString().equals("3")){ //财会大数据 子应用 -// response.sendRedirect(redirectUrl+"/studentEnd_ch/index.html"); -// }else if(uSystem.getTypeId().toString().equals("4")){ //商业大数据 子应用 -// response.sendRedirect(redirectUrl+"/studentEnd_sy/index.html"); -// }else if(uSystem.getTypeId().toString().equals("5")){ //营销大数据 子应用 -// response.sendRedirect(redirectUrl+"/studentEnd_yx/index.html"); -// } - }else { -// response.sendRedirect("http://localhost:8080/Home"+token); - response.sendRedirect("http://localhost:8080/home"); -// return "redirect:" + "http://localhost:8080/Home"; -// if(uSystem.getTypeId().toString().equals("1")){ //大数据基础 子应用 -// response.sendRedirect("http://localhost:8080/studentEnd_dsj/index.html"); -// }else if(uSystem.getTypeId().toString().equals("2")){ //金融大数据 子应用 -// response.sendRedirect("http://localhost:8080/studentEnd_jr/index.html"); -// }else if(uSystem.getTypeId().toString().equals("3")){ //财会大数据 子应用 -// response.sendRedirect("http://localhost:8080/studentEnd_ch/index.html"); -// }else if(uSystem.getTypeId().toString().equals("4")){ //商业大数据 子应用 -// response.sendRedirect("http://localhost:8080/studentEnd_sy/index.html"); -// }else if(uSystem.getTypeId().toString().equals("5")){ //营销大数据 子应用 -// response.sendRedirect("http://localhost:8080/studentEnd_yx/index.html"); -// } - } - }catch (Exception e){ - e.printStackTrace(); - } - - }catch (Exception e){ - e.printStackTrace(); - } - }else{//老师 或 管理员 - try { -// response.sendRedirect(redirectUrl+"/server/pc/index.do"); - request.getRequestDispatcher("/pc/index.do").forward(request, response); -// return "forward:/pc/index.do"; - }catch (Exception e){ - e.printStackTrace(); + //判断是老师还是学生 + if(null != student || null != teacher){ + String token = createSessionByUserId(); + if(ApplicationRunnerController.isOnline){ + String tsUrl = SpringUtil.getBean(Environment.class).getProperty("student.teacher.url"); + response.sendRedirect(tsUrl + "Home" + roleTagCopy); + }else { + response.sendRedirect("http://localhost:8080/home" + roleTagCopy); } } -// return "forward:/pc/index.do"; + //老师 或 管理员 + else{ + request.getRequestDispatcher("/pc/index.do" + roleTagCopy).forward(request, response); + } } //跳转到电脑端首页