|
@@ -1,5 +1,6 @@
|
|
package com.qmth.xjtu.api;
|
|
package com.qmth.xjtu.api;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
import com.qmth.boot.api.annotation.BOOL;
|
|
import com.qmth.boot.api.annotation.BOOL;
|
|
@@ -73,18 +74,39 @@ public class OpenApiController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ OpenParams openParams = null;
|
|
//获取用户信息
|
|
//获取用户信息
|
|
if (Objects.nonNull(accessToken)) {
|
|
if (Objects.nonNull(accessToken)) {
|
|
String userInfoResult = HttpUtil.post(USER_INFO_URL, null, accessToken);
|
|
String userInfoResult = HttpUtil.post(USER_INFO_URL, null, accessToken);
|
|
if (Objects.nonNull(userInfoResult)) {
|
|
if (Objects.nonNull(userInfoResult)) {
|
|
log.info("userInfoResult:{}", JacksonUtil.parseJson(userInfoResult));
|
|
log.info("userInfoResult:{}", JacksonUtil.parseJson(userInfoResult));
|
|
|
|
+ openParams = new OpenParams();
|
|
|
|
+ openParams.setResult(JacksonUtil.parseJson(userInfoResult));
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(accessTokenResult);
|
|
|
|
+ JSONObject object = jsonObject.getJSONObject("data");
|
|
|
|
+ String message = jsonObject.getString("message");
|
|
|
|
+ JSONArray userTypeJsonArray = object.getJSONArray("userTypes");
|
|
|
|
+ JSONArray deptInfoJsonArray = object.getJSONArray("deptInfos");
|
|
|
|
+ if (Objects.nonNull(object) && Objects.equals(message, "成功")) {
|
|
|
|
+ openParams.setOrgName(object.getString("orgName"));
|
|
|
|
+ if (Objects.nonNull(userTypeJsonArray) && userTypeJsonArray.size() > 0) {
|
|
|
|
+ JSONObject userTypeJsonObject = userTypeJsonArray.getJSONObject(0);
|
|
|
|
+ openParams.setName(userTypeJsonObject.getString("memberName"));
|
|
|
|
+ Integer userTypeRole = userTypeJsonObject.getInteger("userType");
|
|
|
|
+ if (Objects.nonNull(userTypeRole) && userTypeRole.intValue() == 1) {
|
|
|
|
+ openParams.setRoleName("学生");
|
|
|
|
+ } else if (Objects.nonNull(userTypeRole) && userTypeRole.intValue() == 2) {
|
|
|
|
+ openParams.setRoleName("教职工");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (Objects.nonNull(deptInfoJsonArray) && deptInfoJsonArray.size() > 0) {
|
|
|
|
+ JSONObject deptInfoJsonArrayJsonObject = deptInfoJsonArray.getJSONObject(0);
|
|
|
|
+ openParams.setDeptName(deptInfoJsonArrayJsonObject.getString("deptName"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //todo 学校业务逻辑待完善
|
|
|
|
- OpenParams openParams = new OpenParams();
|
|
|
|
- openParams.setName("test1");
|
|
|
|
-
|
|
|
|
//登出
|
|
//登出
|
|
if (Objects.nonNull(gsessionId)) {
|
|
if (Objects.nonNull(gsessionId)) {
|
|
Map<String, Object> logoutParams = new LinkedHashMap<>();
|
|
Map<String, Object> logoutParams = new LinkedHashMap<>();
|