|
@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
@@ -31,10 +32,16 @@ import cn.com.qmth.stmms.common.utils.RequestUtils;
|
|
|
public class LoginController {
|
|
|
|
|
|
protected static final String INDEX_VIEW = "modules/sys/index";
|
|
|
+
|
|
|
+ protected static final String AP_INDEX_VIEW = "modules/sys/indexAp";
|
|
|
|
|
|
protected static final String SYS_LOGIN_VIEW = "modules/sys/sysLogin";
|
|
|
+
|
|
|
+ protected static final String AP_SYS_LOGIN_VIEW = "modules/sys/sysLoginAp";
|
|
|
|
|
|
protected static final String MARK_LOGIN_VIEW = "modules/sys/markLogin";
|
|
|
+
|
|
|
+ protected static final String AP_MARK_LOGIN_VIEW = "modules/sys/markLoginAp";
|
|
|
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
@@ -44,9 +51,15 @@ public class LoginController {
|
|
|
|
|
|
@Autowired
|
|
|
private ExamSubjectService examSubjectService;
|
|
|
+
|
|
|
+ @Value("${app.index}")
|
|
|
+ private String appIndex;
|
|
|
|
|
|
@RequestMapping(value = { "/", "", "/index" })
|
|
|
public ModelAndView index(HttpServletRequest request) {
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ return new ModelAndView(AP_INDEX_VIEW);
|
|
|
+ }
|
|
|
return new ModelAndView(INDEX_VIEW);
|
|
|
}
|
|
|
|
|
@@ -56,6 +69,9 @@ public class LoginController {
|
|
|
// if (StringUtils.isNotBlank(session.getParameter("userId"))) {
|
|
|
// return new ModelAndView("modules/sys/examIndex");
|
|
|
// } else {
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ return new ModelAndView(AP_SYS_LOGIN_VIEW);
|
|
|
+ }
|
|
|
return new ModelAndView(SYS_LOGIN_VIEW);
|
|
|
// }
|
|
|
}
|
|
@@ -91,16 +107,31 @@ public class LoginController {
|
|
|
ModelAndView modelAndView = new ModelAndView("redirect:admin/home");
|
|
|
return modelAndView;
|
|
|
} else {
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ ModelAndView aPview = new ModelAndView(AP_SYS_LOGIN_VIEW);
|
|
|
+ aPview.addObject("message", "无此类型的用户");
|
|
|
+ return aPview;
|
|
|
+ }
|
|
|
ModelAndView view = new ModelAndView(SYS_LOGIN_VIEW);
|
|
|
view.addObject("message", "无此类型的用户");
|
|
|
return view;
|
|
|
}
|
|
|
} else {
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ ModelAndView aPview = new ModelAndView(AP_SYS_LOGIN_VIEW);
|
|
|
+ aPview.addObject("message", "密码错误");
|
|
|
+ return aPview;
|
|
|
+ }
|
|
|
ModelAndView modelAndView = new ModelAndView(SYS_LOGIN_VIEW);
|
|
|
modelAndView.addObject("message", "密码错误");
|
|
|
return modelAndView;
|
|
|
}
|
|
|
} else {
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ ModelAndView aPview = new ModelAndView(AP_SYS_LOGIN_VIEW);
|
|
|
+ aPview.addObject("message", "无此用户");
|
|
|
+ return aPview;
|
|
|
+ }
|
|
|
ModelAndView modelAndView = new ModelAndView(SYS_LOGIN_VIEW);
|
|
|
modelAndView.addObject("message", "无此用户");
|
|
|
return modelAndView;
|
|
@@ -129,6 +160,12 @@ public class LoginController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/mark-login", method = RequestMethod.GET)
|
|
|
public ModelAndView loginInit(HttpServletRequest request, @RequestParam(required = false) String message) {
|
|
|
+
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ ModelAndView aPview = new ModelAndView(AP_MARK_LOGIN_VIEW);
|
|
|
+ aPview.addObject("message", StringUtils.trimToNull(message));
|
|
|
+ return aPview;
|
|
|
+ }
|
|
|
ModelAndView modelAndView = new ModelAndView(MARK_LOGIN_VIEW);
|
|
|
modelAndView.addObject("message", StringUtils.trimToNull(message));
|
|
|
return modelAndView;
|
|
@@ -157,7 +194,11 @@ public class LoginController {
|
|
|
// if (header != null) {
|
|
|
// return subjectHeaderLogin(request, header, password);
|
|
|
// }
|
|
|
-
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ ModelAndView aPview = new ModelAndView(AP_MARK_LOGIN_VIEW);
|
|
|
+ aPview.addObject("message","帐号不存在");
|
|
|
+ return aPview;
|
|
|
+ }
|
|
|
ModelAndView view = new ModelAndView(MARK_LOGIN_VIEW);
|
|
|
view.addObject("message", "帐号不存在");
|
|
|
return view;
|
|
@@ -176,8 +217,12 @@ public class LoginController {
|
|
|
ExamSubject subject = examSubjectService.find(sh.getExamId(), sh.getSubjectCode());
|
|
|
ModelAndView modelAndView = new ModelAndView();
|
|
|
if (subject == null) {
|
|
|
- modelAndView.setViewName(MARK_LOGIN_VIEW);
|
|
|
- modelAndView.addObject("message", "科目不存在");
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ modelAndView.setViewName(AP_MARK_LOGIN_VIEW);
|
|
|
+ }else{
|
|
|
+ modelAndView.setViewName(MARK_LOGIN_VIEW);
|
|
|
+ }
|
|
|
+ modelAndView.addObject("message", "科目不存在");
|
|
|
} else {
|
|
|
StmmsSession session = RequestUtils.getSession(request);
|
|
|
|
|
@@ -196,6 +241,11 @@ public class LoginController {
|
|
|
session.setParameter("subjectCode", sh.getSubjectCode());
|
|
|
return modelAndView;
|
|
|
} else {
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ ModelAndView modelAndView = new ModelAndView(AP_MARK_LOGIN_VIEW);
|
|
|
+ modelAndView.addObject("message", "密码错误");
|
|
|
+ return modelAndView;
|
|
|
+ }
|
|
|
ModelAndView modelAndView = new ModelAndView(MARK_LOGIN_VIEW);
|
|
|
modelAndView.addObject("message", "密码错误");
|
|
|
return modelAndView;
|
|
@@ -225,25 +275,46 @@ public class LoginController {
|
|
|
*/
|
|
|
public ModelAndView markerLogin(HttpServletRequest request, Marker marker, String password) {
|
|
|
ModelAndView modelAndView = new ModelAndView(MARK_LOGIN_VIEW);
|
|
|
+ ModelAndView modelAndViewForAP = new ModelAndView(AP_MARK_LOGIN_VIEW);
|
|
|
if (!marker.getPassword().equals(password)) {
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ modelAndViewForAP.addObject("message", "密码错误");
|
|
|
+ return modelAndViewForAP;
|
|
|
+ }
|
|
|
modelAndView.addObject("message", "密码错误");
|
|
|
return modelAndView;
|
|
|
}
|
|
|
if (marker.isEnable() == false) {
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ modelAndViewForAP.addObject("message", "帐号已禁用");
|
|
|
+ return modelAndViewForAP;
|
|
|
+ }
|
|
|
modelAndView.addObject("message", "帐号已禁用");
|
|
|
return modelAndView;
|
|
|
}
|
|
|
if (!marker.isCommon()) {
|
|
|
ExamSubject subject = examSubjectService.find(marker.getExamId(), marker.getSubjectCode());
|
|
|
if (subject == null) {
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ modelAndViewForAP.addObject("message", "科目不存在");
|
|
|
+ return modelAndViewForAP;
|
|
|
+ }
|
|
|
modelAndView.addObject("message", "科目不存在");
|
|
|
return modelAndView;
|
|
|
}
|
|
|
if (subject.getStatus() == ExamSubjectStatus.PAUSE) {
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ modelAndViewForAP.addObject("message", "当前科目暂停评卷");
|
|
|
+ return modelAndViewForAP;
|
|
|
+ }
|
|
|
modelAndView.addObject("message", "当前科目暂停评卷");
|
|
|
return modelAndView;
|
|
|
}
|
|
|
if (subject.getStatus() == ExamSubjectStatus.FINISH) {
|
|
|
+ if("aopeng".equals(appIndex)){
|
|
|
+ modelAndViewForAP.addObject("message", "当前科目评卷已结束");
|
|
|
+ return modelAndViewForAP;
|
|
|
+ }
|
|
|
modelAndView.addObject("message", "当前科目评卷已结束");
|
|
|
return modelAndView;
|
|
|
}
|