fix: 攀枝花东区-缴费处理mag-app
This commit is contained in:
+9
-1
@@ -178,9 +178,17 @@ public class SocialLoginController {
|
||||
return new FebsResponse().data(socialLoginService.appLogin(areaId, schoolId, mobile, userId, type));
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping("app/getMagUserInfo")
|
||||
//@OperationLog(module = ModuleName.AUTH, methods = "获取第三方app(mag)用户信息,主要是获取手机号")
|
||||
public FebsResponse getMagUserInfo(
|
||||
@ApiParam("第三方app(mag)用户token") String appUserToken) {
|
||||
return new FebsResponse().data(socialLoginService.getMagUserInfo(appUserToken));
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping("wxpublic/login")
|
||||
//@OperationLog(module = ModuleName.AUTH, methods = "app登录")
|
||||
//@OperationLog(module = ModuleName.AUTH, methods = "微信登录")
|
||||
public FebsResponse wxpublicLogin(String code, String appId,
|
||||
@ApiParam("0-教师,1-家长") Integer type,
|
||||
Long schoolId, String mobile) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.yida.data.auth.service;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.yida.data.auth.entity.BindUser;
|
||||
import com.yida.data.common.core.entity.FebsResponse;
|
||||
import com.yida.data.common.core.entity.system.UserConnection;
|
||||
@@ -105,4 +106,6 @@ public interface SocialLoginService {
|
||||
Map<String, Object> wxpublicLogin(String code, String appId, Integer type, Long schoolId, String mobile);
|
||||
|
||||
Map<String, Object> h5Login(Long schoolId, String mobile, Integer type);
|
||||
|
||||
JSONObject getMagUserInfo(String appUserToken);
|
||||
}
|
||||
|
||||
+26
-15
@@ -17,10 +17,7 @@ import com.yida.data.common.core.entity.system.*;
|
||||
import com.yida.data.common.core.entity.user.EduStaff;
|
||||
import com.yida.data.common.core.enums.RoleName;
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
import com.yida.data.common.core.utils.Asserts;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.common.core.utils.WxPublicUtil;
|
||||
import com.yida.data.common.core.utils.WxUtil;
|
||||
import com.yida.data.common.core.utils.*;
|
||||
import com.yida.data.common.service.CommonService;
|
||||
import com.yida.data.school.feign.transaction.RemoteStudentApplyService;
|
||||
import com.yida.data.system.feign.RemoteDeptService;
|
||||
@@ -38,6 +35,7 @@ import me.zhyd.oauth.model.AuthResponse;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.oauth2.common.OAuth2AccessToken;
|
||||
import org.springframework.security.oauth2.provider.ClientDetails;
|
||||
@@ -46,10 +44,7 @@ import org.springframework.security.oauth2.provider.password.ResourceOwnerPasswo
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author MrBird
|
||||
@@ -85,6 +80,17 @@ public class SocialLoginServiceImpl implements SocialLoginService {
|
||||
private final RemoteStudentApplyService remoteStudentApplyService;
|
||||
private final RedisService redisService;
|
||||
|
||||
/**
|
||||
* 第三方app(mag)域名
|
||||
*/
|
||||
@Value("${febs.magAppUrl}")
|
||||
private String magAppUrl;
|
||||
/**
|
||||
* 第三方app(mag)secret密钥
|
||||
*/
|
||||
@Value("${febs.magAppSecret}")
|
||||
private String magAppSecret;
|
||||
|
||||
@Override
|
||||
public AuthRequest renderAuth(String oauthType) throws FebsException {
|
||||
return factory.get(getAuthSource(oauthType));
|
||||
@@ -312,7 +318,7 @@ public class SocialLoginServiceImpl implements SocialLoginService {
|
||||
systemUser.setDeptId(type == 0 ? teacher.getSchoolId() : schoolId);
|
||||
systemUser.setRoleName(type == 0 ? RoleName.STAFF.getName() : RoleName.PARENT.getName());
|
||||
systemUser.setUserType(type == 0 ? 1 : 0);
|
||||
systemUser.setYidaAppUserId(userId);
|
||||
// systemUser.setYidaAppUserId(userId);
|
||||
userManager.registUser(systemUser);
|
||||
} else if (!systemUser.getRoleName().contains(type == 0 ? RoleName.STAFF.getName() : RoleName.PARENT.getName())) {
|
||||
Role role = roleMapper.selectOne(Wrappers.<Role>lambdaQuery()
|
||||
@@ -321,12 +327,12 @@ public class SocialLoginServiceImpl implements SocialLoginService {
|
||||
systemUser.setRoleId(systemUser.getRoleId() + "," + role.getRoleId());
|
||||
systemUser.setRoleName(systemUser.getRoleName() + "," + role.getRoleName());
|
||||
}
|
||||
// 用户未绑定appid
|
||||
if (type == 0 && teacher.getYidaAppUserId() == null) {
|
||||
remoteTeacherService.saveYidaAppUserId(teacher.getId(), userId);
|
||||
} else if (type == 1 && parent.getParentYidaAppId() == null) {
|
||||
remoteStudentService.saveYidaAppUserId(parent.getParentId(), userId);
|
||||
}
|
||||
// // 用户未绑定appid
|
||||
// if (type == 0 && teacher.getYidaAppUserId() == null) {
|
||||
// remoteTeacherService.saveYidaAppUserId(teacher.getId(), userId);
|
||||
// } else if (type == 1 && parent.getParentYidaAppId() == null) {
|
||||
// remoteStudentService.saveYidaAppUserId(parent.getParentId(), userId);
|
||||
// }
|
||||
// 登录返回token和用户信息
|
||||
Map<String, Object> res = new HashMap<>();
|
||||
res.put("token", getOauth2AccessToken(systemUser));
|
||||
@@ -579,4 +585,9 @@ public class SocialLoginServiceImpl implements SocialLoginService {
|
||||
res.put("identity", type == 0 ? teacher : parent);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getMagUserInfo(String appUserToken) {
|
||||
return MagAppUtil.getUserInfo(magAppUrl, magAppSecret, appUserToken);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user