|
@@ -1,20 +1,23 @@
|
|
package cn.com.qmth.stmms.api.controller;
|
|
package cn.com.qmth.stmms.api.controller;
|
|
|
|
|
|
-import cn.com.qmth.stmms.biz.exam.service.SubjectUserService;
|
|
|
|
-import cn.com.qmth.stmms.common.annotation.RoleRequire;
|
|
|
|
-import cn.com.qmth.stmms.common.domain.ApiUser;
|
|
|
|
-import cn.com.qmth.stmms.common.enums.Role;
|
|
|
|
-import cn.com.qmth.stmms.common.utils.RequestUtils;
|
|
|
|
|
|
+import java.util.Set;
|
|
|
|
+
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+
|
|
|
|
+import net.sf.json.JSONArray;
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.JSONObject;
|
|
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.SubjectUserService;
|
|
|
|
+import cn.com.qmth.stmms.common.annotation.RoleRequire;
|
|
|
|
+import cn.com.qmth.stmms.common.domain.ApiUser;
|
|
|
|
+import cn.com.qmth.stmms.common.enums.Role;
|
|
|
|
+import cn.com.qmth.stmms.common.utils.RequestUtils;
|
|
|
|
|
|
@Controller("loginApiController")
|
|
@Controller("loginApiController")
|
|
@RequestMapping("/api")
|
|
@RequestMapping("/api")
|
|
@@ -36,9 +39,15 @@ public class LoginController extends BaseApiController {
|
|
obj.accumulate("userRole", user.getRole().toString());
|
|
obj.accumulate("userRole", user.getRole().toString());
|
|
obj.accumulate("campusId", 0);
|
|
obj.accumulate("campusId", 0);
|
|
obj.accumulate("schoolId", user.getSchoolId());
|
|
obj.accumulate("schoolId", user.getSchoolId());
|
|
|
|
+ JSONArray array = new JSONArray();
|
|
if (user.getUserData() != null && Role.SUBJECT_HEADER.equals(user.getRole())) {
|
|
if (user.getUserData() != null && Role.SUBJECT_HEADER.equals(user.getRole())) {
|
|
- obj.accumulate("subjectCode", StringUtils.join(
|
|
|
|
- subjectUserService.findSubjectCode(user.getUserData().getId()), SUBJECT_CODE_SPLIT));
|
|
|
|
|
|
+ Set<String> set = subjectUserService.findSubjectCode(user.getUserData().getId());
|
|
|
|
+ for (String subjectCode : set) {
|
|
|
|
+ array.add(subjectCode);
|
|
|
|
+ }
|
|
|
|
+ obj.accumulate("subjectCode", array);
|
|
|
|
+ } else {
|
|
|
|
+ obj.accumulate("subjectCode", array);
|
|
}
|
|
}
|
|
return obj;
|
|
return obj;
|
|
}
|
|
}
|