1
This commit is contained in:
commit
ef33503ed5
@ -1,7 +0,0 @@
|
||||
FROM openjdk:8u292-jre-buster
|
||||
ARG JAR_FILE=/target/*.jar
|
||||
COPY ${JAR_FILE} service-user-center.jar
|
||||
ENTRYPOINT ["java","-jar","-Dspring.profiles.active=dev","/service-user-center.jar"]
|
||||
|
||||
# 时区问题
|
||||
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
|
@ -1,7 +0,0 @@
|
||||
FROM openjdk:8u292-jre-buster
|
||||
ARG JAR_FILE=/target/*.jar
|
||||
COPY ${JAR_FILE} service-user-center.jar
|
||||
ENTRYPOINT ["java","-jar","-Dspring.profiles.active=jnhb","/service-user-center.jar"]
|
||||
|
||||
# 时区问题
|
||||
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
|
40
pom.xml
40
pom.xml
@ -52,22 +52,6 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!-- session共享 -->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-data-redis</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- session共享 -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
@ -105,6 +89,7 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<<<<<<< HEAD
|
||||
<groupId>com.cm</groupId>
|
||||
<artifactId>cloud-manager-sms</artifactId>
|
||||
<version>1.0.2-SNAPSHOT</version>
|
||||
@ -138,30 +123,14 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
=======
|
||||
>>>>>>> b47f55f9b63f1ab8fd03e3ad5196ebd096ad20fd
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.16</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.cm</groupId>-->
|
||||
<!-- <artifactId>cloud-common-freemarker</artifactId>-->
|
||||
<!-- <version>1.0.1-SNAPSHOT</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.cm</groupId>-->
|
||||
<!-- <artifactId>cloud-common-bigdata</artifactId>-->
|
||||
<!-- <version>1.0.1-SNAPSHOT</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- 作为服务端使用 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.cm</groupId>-->
|
||||
<!-- <artifactId>cloud-central-control</artifactId>-->
|
||||
<!-- <version>1.0.1-SNAPSHOT</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlbeans</groupId>
|
||||
<artifactId>xmlbeans</artifactId>
|
||||
@ -169,6 +138,7 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
<!-- 作为客户端使用 -->
|
||||
<<<<<<< HEAD
|
||||
@ -185,6 +155,8 @@
|
||||
</dependency>
|
||||
>>>>>>> 3b7be9426296e4bc64e2e6664f96b4ba2a081573
|
||||
|
||||
=======
|
||||
>>>>>>> b47f55f9b63f1ab8fd03e3ad5196ebd096ad20fd
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -1,48 +0,0 @@
|
||||
package com.cm.serviceusercenter.authentication.dingding;
|
||||
|
||||
import com.cm.serviceusercenter.authentication.BaseAuthenticationProcessingFilter;
|
||||
import com.cm.serviceusercenter.authentication.user.UserAuthenticationToken;
|
||||
import com.cm.serviceusercenter.exception.UserAuthenticationException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: DingDingAuthenticationFilter
|
||||
* @Description: 钉钉扫码登录过滤器
|
||||
* @Author: WangGeng
|
||||
* @Date: 2020/8/31 2:50 下午
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public class DingDingAuthenticationFilter extends BaseAuthenticationProcessingFilter {
|
||||
|
||||
public DingDingAuthenticationFilter(String loginProcessUrl) {
|
||||
super(new AntPathRequestMatcher(loginProcessUrl + "/dingding", "GET"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException {
|
||||
String loginTmpCode = request.getParameter(DING_DING_LOGIN_TMP_CODE);
|
||||
if (StringUtils.isBlank(loginTmpCode)) {
|
||||
throw new UserAuthenticationException("验证失败,请重新扫码");
|
||||
}
|
||||
loginTmpCode = loginTmpCode.trim();
|
||||
DingDingAuthenticationToken authRequest = new DingDingAuthenticationToken(loginTmpCode, null);
|
||||
setDetails(request, authRequest);
|
||||
return this.getAuthenticationManager().authenticate(authRequest);
|
||||
}
|
||||
|
||||
protected void setDetails(HttpServletRequest request, DingDingAuthenticationToken authRequest) {
|
||||
authRequest.setDetails(authenticationDetailsSource.buildDetails(request));
|
||||
}
|
||||
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
package com.cm.serviceusercenter.authentication.dingding;
|
||||
|
||||
import com.cm.common.dingding.service.IDingDingAppUserService;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.pojo.bos.UserBO;
|
||||
import com.cm.serviceusercenter.authentication.user.UserAuthenticationToken;
|
||||
import com.cm.serviceusercenter.config.properties.DingDingScanCodeLoginProperties;
|
||||
import com.cm.serviceusercenter.enums.LoginType;
|
||||
import com.cm.serviceusercenter.exception.UserAuthenticationException;
|
||||
import com.cm.serviceusercenter.service.UserLoginService;
|
||||
import com.dingtalk.api.DefaultDingTalkClient;
|
||||
import com.dingtalk.api.request.OapiSnsGetuserinfoBycodeRequest;
|
||||
import com.dingtalk.api.response.OapiSnsGetuserinfoBycodeResponse;
|
||||
import com.dingtalk.api.response.OapiUserGetResponse;
|
||||
import com.taobao.api.ApiException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.authentication.AuthenticationProvider;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: DingDingAuthenticationProvider
|
||||
* @Description: 钉钉登陆认证
|
||||
* @Author: WangGeng
|
||||
* @Date: 2020/8/31 15:10
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public class DingDingAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DingDingAuthenticationProvider.class);
|
||||
private DingDingScanCodeLoginProperties dingDingScanCodeLoginProperties;
|
||||
private IDingDingAppUserService dingDingAppUserService;
|
||||
private UserDetailsService userDetailsService;
|
||||
private UserLoginService userLoginService;
|
||||
|
||||
@Override
|
||||
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
||||
DingDingAuthenticationToken dingDingAuthenticationToken = (DingDingAuthenticationToken) authentication;
|
||||
String userMobile = null;
|
||||
try {
|
||||
String unionId = getUnionIdByTmpAuthCode(dingDingAuthenticationToken.getPrincipal().toString());
|
||||
String userId = dingDingAppUserService.getUserIdByUnionId(unionId);
|
||||
OapiUserGetResponse oapiUserGetResponse = dingDingAppUserService.getUserByUserId(userId);
|
||||
userMobile = oapiUserGetResponse.getMobile();
|
||||
} catch (SearchException e) {
|
||||
throw new UserAuthenticationException(e.getMessage());
|
||||
}
|
||||
if (StringUtils.isBlank(userMobile)) {
|
||||
throw new UserAuthenticationException("钉钉账号未绑定手机号,请绑定后再试");
|
||||
}
|
||||
UserBO userBO = (UserBO) userDetailsService.loadUserByUsername(userMobile);
|
||||
if (userBO == null) {
|
||||
throw new UserAuthenticationException("该钉钉手机号账号不在系统中,请联系管理员");
|
||||
}
|
||||
userLoginService.updateUserLoginInfo(userBO.getUserId(), userBO.getUserName(), LoginType.DING_DING_SCAN_CODE.getValue());
|
||||
DingDingAuthenticationToken dingDingAuthenticationTokenResult = new DingDingAuthenticationToken(userBO, null, userBO.getAuthorities());
|
||||
dingDingAuthenticationTokenResult.setDetails(dingDingAuthenticationToken.getDetails());
|
||||
return dingDingAuthenticationTokenResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> authentication) {
|
||||
return DingDingAuthenticationToken.class.isAssignableFrom(authentication);
|
||||
}
|
||||
|
||||
public void setDingDingScanCodeLoginProperties(DingDingScanCodeLoginProperties dingDingScanCodeLoginProperties) {
|
||||
this.dingDingScanCodeLoginProperties = dingDingScanCodeLoginProperties;
|
||||
}
|
||||
|
||||
public void setDingDingAppUserService(IDingDingAppUserService dingDingAppUserService) {
|
||||
this.dingDingAppUserService = dingDingAppUserService;
|
||||
}
|
||||
|
||||
public void setUserDetailsService(UserDetailsService userDetailsService) {
|
||||
this.userDetailsService = userDetailsService;
|
||||
}
|
||||
|
||||
public void setUserLoginService(UserLoginService userLoginService) {
|
||||
this.userLoginService = userLoginService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户unionId
|
||||
*
|
||||
* @param tmpAuthCode
|
||||
* @return
|
||||
*/
|
||||
private String getUnionIdByTmpAuthCode(String tmpAuthCode) {
|
||||
DefaultDingTalkClient defaultDingTalkClient = new DefaultDingTalkClient(dingDingScanCodeLoginProperties.getUserinfoUrl());
|
||||
OapiSnsGetuserinfoBycodeRequest oapiSnsGetuserinfoBycodeRequest = new OapiSnsGetuserinfoBycodeRequest();
|
||||
oapiSnsGetuserinfoBycodeRequest.setTmpAuthCode(tmpAuthCode);
|
||||
try {
|
||||
OapiSnsGetuserinfoBycodeResponse oapiSnsGetuserinfoBycodeResponse = defaultDingTalkClient.execute(oapiSnsGetuserinfoBycodeRequest, dingDingScanCodeLoginProperties.getAppId(), dingDingScanCodeLoginProperties.getAppSecret());
|
||||
if (oapiSnsGetuserinfoBycodeResponse.getErrcode() != 0) {
|
||||
throw new SearchException(oapiSnsGetuserinfoBycodeResponse.getErrmsg());
|
||||
}
|
||||
return oapiSnsGetuserinfoBycodeResponse.getUserInfo().getUnionid();
|
||||
} catch (ApiException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
throw new SearchException("钉钉扫码失败");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package com.cm.serviceusercenter.authentication.dingding;
|
||||
|
||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: DingDingAuthenticationToken
|
||||
* @Description: 钉钉认证Token
|
||||
* @Author: WangGeng
|
||||
* @Date: 2020/8/31 15:11
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public class DingDingAuthenticationToken extends AbstractAuthenticationToken {
|
||||
|
||||
private final Object principal;
|
||||
private Object credentials;
|
||||
|
||||
public DingDingAuthenticationToken(Object principal, Object credentials) {
|
||||
super(null);
|
||||
this.principal = principal;
|
||||
this.credentials = credentials;
|
||||
setAuthenticated(false);
|
||||
}
|
||||
|
||||
public DingDingAuthenticationToken(Object principal, Object credentials,
|
||||
Collection<? extends GrantedAuthority> authorities) {
|
||||
super(authorities);
|
||||
this.principal = principal;
|
||||
this.credentials = credentials;
|
||||
super.setAuthenticated(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return this.credentials;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPrincipal() {
|
||||
return this.principal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
|
||||
if (isAuthenticated) {
|
||||
throw new IllegalArgumentException(
|
||||
"Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead");
|
||||
}
|
||||
super.setAuthenticated(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eraseCredentials() {
|
||||
super.eraseCredentials();
|
||||
credentials = null;
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
package com.cm.serviceusercenter.config;
|
||||
|
||||
import com.cm.common.dingding.service.IDingDingAppUserService;
|
||||
import com.cm.serviceusercenter.authentication.dingding.DingDingAuthenticationFilter;
|
||||
import com.cm.serviceusercenter.authentication.dingding.DingDingAuthenticationProvider;
|
||||
import com.cm.serviceusercenter.authentication.ukey.UKeyAuthenticationFilter;
|
||||
import com.cm.serviceusercenter.authentication.user.UserAuthenticationFilter;
|
||||
import com.cm.serviceusercenter.config.properties.DingDingScanCodeLoginProperties;
|
||||
import com.cm.serviceusercenter.handler.LoginFailureHandler;
|
||||
import com.cm.serviceusercenter.service.UserDetailServiceImpl;
|
||||
import com.cm.serviceusercenter.service.UserLoginService;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.web.DefaultSecurityFilterChain;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: DingDingSecurityConfig
|
||||
* @Description: 钉钉安全配置
|
||||
* @Author: WangGeng
|
||||
* @Date: 2020/8/31 15:12
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public class DingDingSecurityConfig extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {
|
||||
|
||||
private DingDingScanCodeLoginProperties dingDingScanCodeLoginProperties;
|
||||
private UserDetailServiceImpl userDetailService;
|
||||
private LoginFailureHandler loginFailureHandler;
|
||||
private String loginProcessUrl;
|
||||
private UserLoginService userLoginService;
|
||||
private IDingDingAppUserService dingDingAppUserService;
|
||||
|
||||
@Override
|
||||
public void configure(HttpSecurity http) throws Exception {
|
||||
super.configure(http);
|
||||
// 创建过滤器
|
||||
DingDingAuthenticationFilter dingDingAuthenticationFilter = new DingDingAuthenticationFilter(loginProcessUrl);
|
||||
dingDingAuthenticationFilter.setAuthenticationManager(http.getSharedObject(AuthenticationManager.class));
|
||||
dingDingAuthenticationFilter.setAuthenticationFailureHandler(loginFailureHandler);
|
||||
// 创建provider,加入UserDetailService
|
||||
DingDingAuthenticationProvider dingDingAuthenticationProvider = new DingDingAuthenticationProvider();
|
||||
dingDingAuthenticationProvider.setDingDingScanCodeLoginProperties(dingDingScanCodeLoginProperties);
|
||||
dingDingAuthenticationProvider.setUserDetailsService(userDetailService);
|
||||
dingDingAuthenticationProvider.setUserLoginService(userLoginService);
|
||||
dingDingAuthenticationProvider.setDingDingAppUserService(dingDingAppUserService);
|
||||
// 加入SpringSecurity的authentication管理的provider集合当中,并且添加到UKeyAuthenticationFilter之前
|
||||
http.authenticationProvider(dingDingAuthenticationProvider).addFilterBefore(dingDingAuthenticationFilter, UKeyAuthenticationFilter.class);
|
||||
}
|
||||
|
||||
public void setDingDingScanCodeLoginProperties(DingDingScanCodeLoginProperties dingDingScanCodeLoginProperties) {
|
||||
this.dingDingScanCodeLoginProperties = dingDingScanCodeLoginProperties;
|
||||
}
|
||||
|
||||
public void setUserDetailService(UserDetailServiceImpl userDetailService) {
|
||||
this.userDetailService = userDetailService;
|
||||
}
|
||||
|
||||
public void setLoginFailureHandler(LoginFailureHandler loginFailureHandler) {
|
||||
this.loginFailureHandler = loginFailureHandler;
|
||||
}
|
||||
|
||||
public void setLoginProcessUrl(String loginProcessUrl) {
|
||||
this.loginProcessUrl = loginProcessUrl;
|
||||
}
|
||||
|
||||
public void setUserLoginService(UserLoginService userLoginService) {
|
||||
this.userLoginService = userLoginService;
|
||||
}
|
||||
|
||||
public void setDingDingAppUserService(IDingDingAppUserService dingDingAppUserService) {
|
||||
this.dingDingAppUserService = dingDingAppUserService;
|
||||
}
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
package com.cm.serviceusercenter.config;
|
||||
|
||||
import com.cm.serviceusercenter.authentication.dingding.DingDingAuthenticationFilter;
|
||||
import com.cm.serviceusercenter.authentication.ukey.UKeyAuthenticationFilter;
|
||||
import com.cm.serviceusercenter.authentication.user.UserAuthenticationFilter;
|
||||
import com.cm.serviceusercenter.authentication.user.UserAuthenticationProvider;
|
||||
import com.cm.serviceusercenter.handler.LoginFailureHandler;
|
||||
@ -12,7 +10,6 @@ import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.web.DefaultSecurityFilterChain;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
@ -44,8 +41,7 @@ public class UserSecurityConfig extends SecurityConfigurerAdapter<DefaultSecurit
|
||||
userAuthenticationProvider.setPasswordEncoder(passwordEncoder);
|
||||
userAuthenticationProvider.setUserDetailsService(userDetailService);
|
||||
userAuthenticationProvider.setUserLoginService(userLoginService);
|
||||
// 加入SpringSecurity的authentication管理的provider集合当中,并且添加到UKeyAuthenticationFilter之前
|
||||
http.authenticationProvider(userAuthenticationProvider).addFilterBefore(userAuthenticationFilter, DingDingAuthenticationFilter.class);
|
||||
http.authenticationProvider(userAuthenticationProvider);
|
||||
}
|
||||
|
||||
public void setUserDetailService(UserDetailServiceImpl userDetailService) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.cm.serviceusercenter.config;
|
||||
|
||||
import com.cm.common.dingding.service.IDingDingAppUserService;
|
||||
import com.cm.common.handler.AccessDenyHandler;
|
||||
import com.cm.serviceusercenter.config.properties.DingDingScanCodeLoginProperties;
|
||||
import com.cm.serviceusercenter.handler.LoginFailureHandler;
|
||||
@ -34,8 +33,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
private UserDetailServiceImpl userDetailService;
|
||||
@Autowired
|
||||
private UserLoginService userLoginService;
|
||||
@Autowired
|
||||
private IDingDingAppUserService dingDingAppUserService;
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
@ -83,7 +80,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.csrf()
|
||||
.disable();
|
||||
addUKeyFilter(http, loginFailureHandler);
|
||||
addDingDingAuthenticationFilter(http, loginFailureHandler);
|
||||
addUserAuthenticationFilter(http, loginFailureHandler);
|
||||
}
|
||||
|
||||
@ -103,23 +99,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
http.apply(webUKeySecurityConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建钉钉认证过滤器
|
||||
*
|
||||
* @param http
|
||||
* @param loginFailureHandler
|
||||
* @throws Exception
|
||||
*/
|
||||
private void addDingDingAuthenticationFilter(HttpSecurity http, LoginFailureHandler loginFailureHandler) throws Exception {
|
||||
DingDingSecurityConfig dingDingSecurityConfig = new DingDingSecurityConfig();
|
||||
dingDingSecurityConfig.setUserDetailService(userDetailService);
|
||||
dingDingSecurityConfig.setLoginProcessUrl(baseConfig.getLoginProcess());
|
||||
dingDingSecurityConfig.setLoginFailureHandler(loginFailureHandler);
|
||||
dingDingSecurityConfig.setUserLoginService(userLoginService);
|
||||
dingDingSecurityConfig.setDingDingAppUserService(dingDingAppUserService);
|
||||
dingDingSecurityConfig.setDingDingScanCodeLoginProperties(dingDingScanCodeLoginProperties);
|
||||
http.apply(dingDingSecurityConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建用户认证过滤器链,替换原有UsernamePasswordAuthenticationFilter
|
||||
|
@ -5,10 +5,7 @@ import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.ParamsException;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.common.utils.RegexUtil;
|
||||
import com.cm.manager.sms.manager.VerificationCodeManager;
|
||||
import com.cm.serviceusercenter.pojo.vos.user.RegisterSimpleVO;
|
||||
import com.cm.serviceusercenter.pojo.vos.user.RegisterVO;
|
||||
import com.cm.serviceusercenter.service.system.user.IUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -39,21 +36,6 @@ public class AppRegisterController {
|
||||
@Autowired
|
||||
private IUserService userService;
|
||||
|
||||
@ApiOperation(value = "注册用户(通过手机和验证码)", notes = "注册用户(通过手机和验证码)接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("saveregisteruser")
|
||||
@CheckRequestBodyAnnotation
|
||||
public synchronized SuccessResult saveRegisterUser(@RequestBody RegisterVO registerVO) {
|
||||
String verificationCode = VerificationCodeManager.getInstance().getVerificationCode(registerVO.getPhone());
|
||||
if (StringUtils.isBlank(verificationCode)) {
|
||||
throw new ParamsException("验证码无效");
|
||||
}
|
||||
if (!StringUtils.equals(verificationCode, registerVO.getVerificationCode())) {
|
||||
throw new ParamsException("验证码错误");
|
||||
}
|
||||
return userService.saveRegisterUser(registerVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "注册用户(通过手机和密码)", notes = "注册用户(通过手机和密码)接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("saveregisterusersimple")
|
||||
|
@ -3,21 +3,19 @@ package com.cm.serviceusercenter.controller.app.apis.system;
|
||||
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.ParamsException;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
import com.cm.common.utils.RegexUtil;
|
||||
import com.cm.manager.sms.manager.VerificationCodeManager;
|
||||
import com.cm.serviceusercenter.pojo.vos.sign.LoginDefaultVO;
|
||||
import com.cm.serviceusercenter.pojo.vos.sign.LoginPhoneVO;
|
||||
import com.cm.serviceusercenter.service.system.sign.ISignService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
@ -45,22 +43,4 @@ public class AppSignController extends AbstractController {
|
||||
return signService.loginDefault(loginDefaultVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "APP手机验证码登录", notes = "APP手机验证码登录接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("loginphone")
|
||||
@CheckRequestBodyAnnotation
|
||||
public synchronized SuccessResultData<String> loginPhone(@RequestBody LoginPhoneVO loginPhoneVO) throws Exception {
|
||||
if (!RegexUtil.isPhone(loginPhoneVO.getUsername())) {
|
||||
throw new ParamsException("用户名非手机格式");
|
||||
}
|
||||
String verificationCode = VerificationCodeManager.getInstance().getVerificationCode(loginPhoneVO.getUsername());
|
||||
if (StringUtils.isBlank(verificationCode)) {
|
||||
throw new ParamsException("验证码为空");
|
||||
}
|
||||
if (!StringUtils.equalsIgnoreCase(verificationCode, loginPhoneVO.getVerificationCode())) {
|
||||
throw new ParamsException("验证码错误");
|
||||
}
|
||||
return signService.loginPhone(loginPhoneVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,44 +0,0 @@
|
||||
package com.cm.serviceusercenter.controller.app.apis.system.user;
|
||||
|
||||
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
import com.cm.serviceusercenter.controller.BaseController;
|
||||
import com.cm.serviceusercenter.pojo.vos.user.WechatUserDataVO;
|
||||
import com.cm.serviceusercenter.service.system.user.IMiniUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: UserMiniAppController
|
||||
* @Description: 微信小程序接口
|
||||
* @Author: WangGeng
|
||||
* @Date: 2020/10/29 17:59
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "小程序用户管理")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.APP_PREFIX + "/miniuser")
|
||||
public class MiniUserAppController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IMiniUserService miniUserService;
|
||||
|
||||
@ApiOperation(value = "更新小程序默认用户名", notes = "更新小程序默认用户名(通过小程序用户加密数据)")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
})
|
||||
@PutMapping("updatedefaultusernamebydata")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResultData<String> updateDefaultUsernameByData(@RequestHeader("token") String token, @RequestBody WechatUserDataVO wechatUserDataVO) throws Exception {
|
||||
return miniUserService.updateDefaultUsernameByData(token, wechatUserDataVO);
|
||||
}
|
||||
|
||||
}
|
@ -2,7 +2,6 @@ package com.cm.serviceusercenter.controller.app.apis.system.user;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.ParamsException;
|
||||
@ -11,17 +10,16 @@ import com.cm.common.exception.UpdateException;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.common.token.app.AppTokenManager;
|
||||
import com.cm.common.utils.RegexUtil;
|
||||
import com.cm.manager.sms.manager.VerificationCodeManager;
|
||||
import com.cm.manager.sms.pojo.VerificationCode;
|
||||
import com.cm.serviceusercenter.pojo.dtos.DepartmentUserDTO;
|
||||
import com.cm.serviceusercenter.pojo.dtos.UserDTO;
|
||||
import com.cm.serviceusercenter.pojo.dtos.user.UserAppDTO;
|
||||
import com.cm.serviceusercenter.pojo.dtos.user.UserInfoDynamicFieldDTO;
|
||||
import com.cm.serviceusercenter.pojo.vos.user.*;
|
||||
import com.cm.serviceusercenter.pojo.vos.user.AppChangePasswordVO;
|
||||
import com.cm.serviceusercenter.pojo.vos.user.AppChangeUserVO;
|
||||
import com.cm.serviceusercenter.pojo.vos.user.UserAndDepartmentIdVO;
|
||||
import com.cm.serviceusercenter.service.system.user.IUserService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -267,21 +265,6 @@ public class UserAppController extends AbstractController {
|
||||
return userService.getUserInfo(token);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改手机用户名", notes = "修改手机用户名接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("updatephoneusername/{phone}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResultData<String> updatePhoneUsername(@PathVariable("phone") String phone, @RequestBody UpdatePhoneUsernameVO updatePhoneUsernameVO) throws Exception {
|
||||
if (!RegexUtil.isPhone(phone)) {
|
||||
throw new ParamsException("手机格式不正确");
|
||||
}
|
||||
VerificationCodeManager.getInstance().checkVerificationCode(phone, updatePhoneUsernameVO.getVerificationCode());
|
||||
return userService.updatePhoneUsername(phone, updatePhoneUsernameVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取APP用户", notes = "获取APP用户接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
@ -292,18 +275,6 @@ public class UserAppController extends AbstractController {
|
||||
return userService.getAppUser(token);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "忘记密码", notes = "忘记密码接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("forgetpassword")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult forgetPassword(@RequestBody AppForgetPasswordVO appForgetPasswordVO) {
|
||||
if (!RegexUtil.isPhone(appForgetPasswordVO.getPhone())) {
|
||||
throw new ParamsException("手机格式不正确");
|
||||
}
|
||||
VerificationCodeManager.getInstance().checkVerificationCode(appForgetPasswordVO.getPhone(), appForgetPasswordVO.getVerificationCode());
|
||||
return userService.updateForgetPassword(appForgetPasswordVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "下载用户头像", notes = "下载用户头像接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户Id", paramType = "path")
|
||||
@ -313,29 +284,4 @@ public class UserAppController extends AbstractController {
|
||||
public void downLoadAvatar(@PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response) {
|
||||
userService.downLoadAvatar(userId, request, response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新微信默认用户名", notes = "更新微信默认用户名接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
})
|
||||
@PutMapping("updatewechatdefaultusername")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResultData<String> updateWechatDefaultUsername(@RequestHeader("token") String token, @RequestBody WechatUpdateDefaultUsernameVO wechatUpdateDefaultUsernameVO) throws Exception {
|
||||
if (StringUtils.isBlank(wechatUpdateDefaultUsernameVO.getVerificationCode())) {
|
||||
throw new ParamsException("验证码不能为空");
|
||||
}
|
||||
VerificationCodeManager.getInstance().checkVerificationCode(wechatUpdateDefaultUsernameVO.getPhone(), wechatUpdateDefaultUsernameVO.getVerificationCode());
|
||||
return userService.updateWxDefaultUsername(token, wechatUpdateDefaultUsernameVO.getPhone(), 1);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新微信小程序默认用户名", notes = "更新微信小程序默认用户名接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
})
|
||||
@PutMapping("updateminiappdefaultusername")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResultData<String> updateMiniAppDefaultUsername(@RequestHeader("token") String token, @RequestBody WechatUpdateDefaultUsernameVO wechatUpdateDefaultUsernameVO) throws Exception {
|
||||
VerificationCodeManager.getInstance().checkVerificationCode(wechatUpdateDefaultUsernameVO.getPhone(), wechatUpdateDefaultUsernameVO.getVerificationCode());
|
||||
return userService.updateWxDefaultUsername(token, wechatUpdateDefaultUsernameVO.getPhone(), 2);
|
||||
}
|
||||
}
|
||||
|
@ -1,46 +0,0 @@
|
||||
package com.cm.serviceusercenter.controller.dingding.apis.user;
|
||||
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.dingding.config.properties.DingDingAppProperties;
|
||||
import com.cm.common.exception.base.SystemException;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.serviceusercenter.service.system.user.IDingDingUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @ClassName: DingDingUserController
|
||||
* @Description: 钉钉用户管理
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/8/12 2:37 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_TAGS_DINGDING_PREFIX + "登录")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.DINGDING_PREFIX + "/user")
|
||||
public class DingDingUserController {
|
||||
|
||||
@Autowired
|
||||
private IDingDingUserService dingDingUserService;
|
||||
@Autowired
|
||||
private DingDingAppProperties dingDingAppProperties;
|
||||
|
||||
@ApiOperation(value = "同步钉钉通讯录", notes = "同步钉钉通讯录接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("update-sync-dingding")
|
||||
public SuccessResult updateSyncDingDing() throws Exception {
|
||||
if (dingDingAppProperties == null || !dingDingAppProperties.getActive()) {
|
||||
throw new SystemException("钉钉未激活");
|
||||
}
|
||||
dingDingUserService.updateSyncDingDing();
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package com.cm.serviceusercenter.service.system.user;
|
||||
|
||||
import com.taobao.api.ApiException;
|
||||
|
||||
/**
|
||||
* @ClassName: IDingDingUserService
|
||||
* @Description: 钉钉用户
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/8/12 2:49 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IDingDingUserService {
|
||||
/**
|
||||
* 同步钉钉通讯录,不做删除,只做新增
|
||||
*/
|
||||
void updateSyncDingDing() throws Exception;
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package com.cm.serviceusercenter.service.system.user;
|
||||
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
import com.cm.serviceusercenter.pojo.vos.user.WechatUserDataVO;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IMiniUserService
|
||||
* @Description: 小程序用户
|
||||
* @Author: WangGeng
|
||||
* @Date: 2020/10/29 18:03
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public interface IMiniUserService {
|
||||
|
||||
/**
|
||||
* 更新小程序默认用户名
|
||||
*
|
||||
* @param token token
|
||||
* @param wechatUserDataVO 小程序用户加密数据
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
SuccessResultData<String> updateDefaultUsernameByData(String token, WechatUserDataVO wechatUserDataVO) throws Exception;
|
||||
}
|
@ -1,212 +0,0 @@
|
||||
package com.cm.serviceusercenter.service.system.user.impl;
|
||||
|
||||
import com.cm.common.base.AbstractService;
|
||||
import com.cm.common.dingding.pojo.pos.DingDingDepartmentPO;
|
||||
import com.cm.common.dingding.pojo.pos.DingDingUserPO;
|
||||
import com.cm.common.dingding.pojo.vos.DingDingDepartmentVO;
|
||||
import com.cm.common.dingding.pojo.vos.DingDingUserVO;
|
||||
import com.cm.common.dingding.service.IDingDingAppDepartmentService;
|
||||
import com.cm.common.dingding.service.IDingDingAppUserService;
|
||||
import com.cm.serviceusercenter.pojo.dtos.DepartmentUserDTO;
|
||||
import com.cm.serviceusercenter.pojo.dtos.UserDTO;
|
||||
import com.cm.serviceusercenter.pojo.dtos.department.DepartmentSimpleDTO;
|
||||
import com.cm.serviceusercenter.pojo.vos.DepartmentVO;
|
||||
import com.cm.serviceusercenter.pojo.vos.UserVO;
|
||||
import com.cm.serviceusercenter.service.system.department.IDepartmentService;
|
||||
import com.cm.serviceusercenter.service.system.user.IDingDingUserService;
|
||||
import com.cm.serviceusercenter.service.system.user.IUserService;
|
||||
import com.dingtalk.api.response.OapiV2DepartmentListsubResponse;
|
||||
import com.dingtalk.api.response.OapiV2UserListResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: DingDingUserServiceImpl
|
||||
* @Description: 钉钉用户管理
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/8/12 2:49 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Service
|
||||
public class DingDingUserServiceImpl extends AbstractService implements IDingDingUserService {
|
||||
|
||||
@Autowired
|
||||
private IDingDingAppUserService dingDingAppUserService;
|
||||
@Autowired
|
||||
private IDingDingAppDepartmentService dingDingAppDepartmentService;
|
||||
@Autowired
|
||||
private IDepartmentService departmentService;
|
||||
@Autowired
|
||||
private IUserService userService;
|
||||
|
||||
@Override
|
||||
public void updateSyncDingDing() throws Exception {
|
||||
// 构建绑定的部门
|
||||
LOG.debug("同步钉钉部门关系");
|
||||
List<DingDingDepartmentVO> bindDingDingDepartmentVOs = new ArrayList<>();
|
||||
// 添加根节点
|
||||
DingDingDepartmentVO rootDingDingDepartmentVO = new DingDingDepartmentVO();
|
||||
rootDingDingDepartmentVO.setDingdingDepartmentId(1L);
|
||||
rootDingDingDepartmentVO.setDingdingDepartmentParentId(0L);
|
||||
bindDingDingDepartmentVOs.add(rootDingDingDepartmentVO);
|
||||
departmentSync(1L, "0", bindDingDingDepartmentVOs);
|
||||
if (bindDingDingDepartmentVOs.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 保存部门绑定关系
|
||||
for (DingDingDepartmentVO dingDingDepartmentVO : bindDingDingDepartmentVOs) {
|
||||
if (dingDingDepartmentVO.getDingdingDepartmentId() == 1L) {
|
||||
continue;
|
||||
}
|
||||
LOG.debug("保存部门:{}", dingDingDepartmentVO.getDepartmentName());
|
||||
dingDingAppDepartmentService.save(dingDingDepartmentVO);
|
||||
}
|
||||
LOG.debug("同步钉钉用户");
|
||||
Map<String, Object> params = getHashMap(0);
|
||||
List<UserDTO> userDTOs = userService.listUsers(params);
|
||||
List<DingDingUserVO> dingDingUserVOs = new ArrayList<>();
|
||||
syncUser(bindDingDingDepartmentVOs, userDTOs, dingDingUserVOs);
|
||||
if (dingDingUserVOs.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 绑定钉钉用户与系统用户关系
|
||||
for (DingDingUserVO dingDingUserVO : dingDingUserVOs) {
|
||||
LOG.debug("保存用户:{} - {}", dingDingUserVO.getMobile(), dingDingUserVO.getName());
|
||||
dingDingAppUserService.save(dingDingUserVO);
|
||||
LOG.debug("保存用户与部门关系");
|
||||
String[] deptIdArray = dingDingUserVO.getDeptIdList().split(",");
|
||||
for (String deptId : deptIdArray) {
|
||||
for (DingDingDepartmentVO dingDingDepartmentVO : bindDingDingDepartmentVOs) {
|
||||
if (StringUtils.isEmpty(dingDingDepartmentVO.getDepartmentId())) {
|
||||
continue;
|
||||
}
|
||||
if (Long.valueOf(deptId).equals(dingDingDepartmentVO.getDingdingDepartmentId())) {
|
||||
DepartmentUserDTO departmentUserDTO = userService.getDepartmentUser(dingDingDepartmentVO.getDepartmentId(), dingDingUserVO.getUserId());
|
||||
if (departmentUserDTO != null) {
|
||||
continue;
|
||||
}
|
||||
userService.saveDepartmentUser(dingDingDepartmentVO.getDepartmentId(), dingDingUserVO.getUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步部门
|
||||
*
|
||||
* @param dingDingParentId
|
||||
* @param departmentParentId
|
||||
* @param bindDingDingDepartmentVOs
|
||||
* @throws Exception
|
||||
*/
|
||||
public void departmentSync(Long dingDingParentId,
|
||||
String departmentParentId,
|
||||
List<DingDingDepartmentVO> bindDingDingDepartmentVOs) throws Exception {
|
||||
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> deptBaseResponses = dingDingAppDepartmentService.list(dingDingParentId);
|
||||
if (deptBaseResponses == null || deptBaseResponses.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<DepartmentSimpleDTO> departmentSimpleDTOs = departmentService.listDepartmentSimpleByParentId(departmentParentId);
|
||||
for (OapiV2DepartmentListsubResponse.DeptBaseResponse deptBaseResponse : deptBaseResponses) {
|
||||
// 未绑定过
|
||||
DingDingDepartmentPO dingDingDepartmentPO = dingDingAppDepartmentService.getPO(deptBaseResponse.getDeptId());
|
||||
if (dingDingDepartmentPO != null) {
|
||||
continue;
|
||||
}
|
||||
boolean isDepartmentExist = false;
|
||||
DingDingDepartmentVO dingDingDepartmentVO = new DingDingDepartmentVO();
|
||||
dingDingDepartmentVO.setDingdingDepartmentId(deptBaseResponse.getDeptId());
|
||||
dingDingDepartmentVO.setDingdingDepartmentParentId(deptBaseResponse.getParentId());
|
||||
dingDingDepartmentVO.setDepartmentName(deptBaseResponse.getName());
|
||||
// 同步内容
|
||||
for (DepartmentSimpleDTO departmentSimpleDTO : departmentSimpleDTOs) {
|
||||
if (StringUtils.equals(deptBaseResponse.getName(), departmentSimpleDTO.getDepartmentName())) {
|
||||
isDepartmentExist = true;
|
||||
dingDingDepartmentVO.setDepartmentId(departmentSimpleDTO.getDepartmentId());
|
||||
dingDingDepartmentVO.setDepartmentParentId(departmentSimpleDTO.getDepartmentParentId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isDepartmentExist) {
|
||||
DepartmentVO departmentVO = new DepartmentVO();
|
||||
departmentVO.setDepartmentState(1);
|
||||
departmentVO.setDepartmentType(1);
|
||||
departmentVO.setDepartmentName(deptBaseResponse.getName());
|
||||
departmentVO.setDepartmentSummary("钉钉同步");
|
||||
departmentVO.setDepartmentParentId(departmentParentId);
|
||||
String departmentId = departmentService.saveDepartmentReturnId(departmentVO);
|
||||
// 填充信息
|
||||
dingDingDepartmentVO.setDepartmentId(departmentId);
|
||||
dingDingDepartmentVO.setDepartmentParentId(departmentParentId);
|
||||
}
|
||||
// 递归同步
|
||||
departmentSync(deptBaseResponse.getDeptId(), dingDingDepartmentVO.getDepartmentId(), bindDingDingDepartmentVOs);
|
||||
bindDingDingDepartmentVOs.add(dingDingDepartmentVO);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步用户
|
||||
*
|
||||
* @param bindDingDingDepartmentVOs
|
||||
* @param userDTOs
|
||||
* @param bindDingDingUserVOs
|
||||
* @throws Exception
|
||||
*/
|
||||
private void syncUser(List<DingDingDepartmentVO> bindDingDingDepartmentVOs, List<UserDTO> userDTOs, List<DingDingUserVO> bindDingDingUserVOs) throws Exception {
|
||||
// 部门用户
|
||||
for (DingDingDepartmentVO dingDingDepartmentVO : bindDingDingDepartmentVOs) {
|
||||
// 钉钉用户列表
|
||||
List<OapiV2UserListResponse.ListUserResponse> userResponses = dingDingAppUserService.listByDeptId(dingDingDepartmentVO.getDingdingDepartmentId());
|
||||
if (userResponses.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
for (OapiV2UserListResponse.ListUserResponse userResponse : userResponses) {
|
||||
DingDingUserPO dingDingUserPO = dingDingAppUserService.getPO(userResponse.getUserid());
|
||||
if (dingDingUserPO != null) {
|
||||
continue;
|
||||
}
|
||||
boolean isUserExist = false;
|
||||
DingDingUserVO dingDingUserVO = new DingDingUserVO();
|
||||
dingDingUserVO.setDingdingUserId(userResponse.getUserid());
|
||||
dingDingUserVO.setUnionid(userResponse.getUnionid());
|
||||
dingDingUserVO.setName(userResponse.getName());
|
||||
dingDingUserVO.setMobile(userResponse.getMobile());
|
||||
String deptIdListString = "";
|
||||
for (Long deptId : userResponse.getDeptIdList()) {
|
||||
if (!deptIdListString.isEmpty()) {
|
||||
deptIdListString += ",";
|
||||
}
|
||||
deptIdListString += deptId;
|
||||
}
|
||||
dingDingUserVO.setDeptIdList(deptIdListString);
|
||||
for (UserDTO userDTO : userDTOs) {
|
||||
if (StringUtils.equals(userResponse.getMobile(), userDTO.getUserUsername())) {
|
||||
isUserExist = true;
|
||||
dingDingUserVO.setUserId(userDTO.getUserId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isUserExist) {
|
||||
UserVO userVO = new UserVO();
|
||||
userVO.setUserName(userResponse.getName());
|
||||
userVO.setUserUsername(userResponse.getMobile());
|
||||
userVO.setUserState(0);
|
||||
userVO.setUserType(2);
|
||||
userVO.setUserPhone(userResponse.getMobile());
|
||||
userVO.setUserEmail(userResponse.getEmail());
|
||||
String userId = userService.saveUserReturnId(userVO);
|
||||
dingDingUserVO.setUserId(userId);
|
||||
}
|
||||
bindDingDingUserVOs.add(dingDingUserVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package com.cm.serviceusercenter.service.system.user.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
import com.cm.common.utils.AesUtil;
|
||||
import com.cm.common.wechat.manager.miniapp.WechatMiniAppManager;
|
||||
import com.cm.common.wechat.pojo.WechatMiniAppUserInfo;
|
||||
import com.cm.common.wechat.pojo.WechatMiniAppUserInfoDetail;
|
||||
import com.cm.serviceusercenter.pojo.vos.user.WechatUserDataVO;
|
||||
import com.cm.serviceusercenter.service.BaseService;
|
||||
import com.cm.serviceusercenter.service.system.user.IMiniUserService;
|
||||
import com.cm.serviceusercenter.service.system.user.IUserService;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: MiniUserServiceImpl
|
||||
* @Description: 小程序用户管理
|
||||
* @Author: WangGeng
|
||||
* @Date: 2020/10/29 18:03
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Service
|
||||
public class MiniUserServiceImpl extends BaseService implements IMiniUserService {
|
||||
|
||||
@Autowired
|
||||
private IUserService userService;
|
||||
|
||||
@Override
|
||||
public SuccessResultData<String> updateDefaultUsernameByData(String token, WechatUserDataVO wechatUserDataVO) throws Exception {
|
||||
WechatMiniAppUserInfo wechatMiniAppUserInfo = WechatMiniAppManager.getInstance().getWechatMiniAppUserInfoByToken(token);
|
||||
if (wechatMiniAppUserInfo == null) {
|
||||
throw new SearchException("用户未登录,请重新打开小程序");
|
||||
}
|
||||
byte[] encryptedBytes = Base64.decodeBase64(wechatUserDataVO.getEncryptedData());
|
||||
byte[] keyBytes = Base64.decodeBase64(wechatMiniAppUserInfo.getSession_key());
|
||||
byte[] ivBytes = Base64.decodeBase64(wechatUserDataVO.getIv());
|
||||
byte[] userInfoBytes = AesUtil.aesCommonDecoderDetail(keyBytes, encryptedBytes, ivBytes, AesUtil.PKCS_7);
|
||||
WechatMiniAppUserInfoDetail wechatMiniAppUserInfoDetail = JSONObject.parseObject(userInfoBytes, WechatMiniAppUserInfoDetail.class);
|
||||
return userService.updateWxDefaultUsername(token, wechatMiniAppUserInfoDetail.getPurePhoneNumber(), 2);
|
||||
}
|
||||
|
||||
}
|
@ -28,16 +28,14 @@ spring:
|
||||
max-request-size: 1GB
|
||||
datasource:
|
||||
druid:
|
||||
# url: jdbc:mysql://127.0.0.1:3306/db_cloud_v2_test?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||
url: jdbc:mysql://127.0.0.1:3306/db_btyjj_usercenter1?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||
url: jdbc:mysql://127.0.0.1:3306/db_cloud_usercenter_v2?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||
db-type: mysql
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: root
|
||||
# password: TSkj@0471.123
|
||||
password: root
|
||||
password: TSkj@0471.123
|
||||
initial-size: 2
|
||||
min-idle: 2
|
||||
max-active: 10
|
||||
max-active: 100
|
||||
# 配置获取连接等待超时的时间
|
||||
max-wait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
@ -89,7 +87,7 @@ swagger:
|
||||
swagger-base-package: com.cm
|
||||
|
||||
file:
|
||||
uploadPath: /root/projects_test/uploadFiles/
|
||||
uploadPath: /root/projects/uploadFiles/
|
||||
imageTypes: png,jpg,jpeg,gif,blob
|
||||
videoTypes: mp4,rmvb
|
||||
audioTypes: mp3,wmv
|
||||
@ -124,45 +122,7 @@ access-control:
|
||||
- /count*/**
|
||||
|
||||
logging:
|
||||
file: /root/projects_test/logs/usercenter/serviceuser-logs.log
|
||||
file: /root/projects/logs/usercenter/serviceuser-v2-logs.log
|
||||
level:
|
||||
root: error
|
||||
com.cm: debug
|
||||
|
||||
# 短信服务
|
||||
sms:
|
||||
active: true
|
||||
type: default
|
||||
default-sms:
|
||||
account: xd001382
|
||||
password: xd001382136
|
||||
sign: 【腾狮科技】
|
||||
template:
|
||||
verification-code: '{sign} 您的验证码为 {content}, 有效时间为120秒,若非本人操作,请忽略。'
|
||||
|
||||
# 邮件服务
|
||||
email:
|
||||
active: true
|
||||
smtp: smtp.qq.com
|
||||
port: 587
|
||||
sender-email: 450292408@qq.com
|
||||
sender-password: pezxpunlxzqgbhhd
|
||||
cc-persons:
|
||||
- 450292408@qq.com
|
||||
- 76158045@qq.com
|
||||
|
||||
socket:
|
||||
central-control:
|
||||
active: false
|
||||
server:
|
||||
port: 8888
|
||||
# 最大连接数
|
||||
so-backlog: 1024
|
||||
# 服务端超时断连(秒)
|
||||
read-idle-time-second: 10
|
||||
# 离线通知时间(分钟),默认10分钟
|
||||
offline-notice-minute: 10
|
||||
# 离线通知次数
|
||||
offline-notice-count: 3
|
||||
# 异常通知最大值
|
||||
exception-notice-count: 10
|
@ -1,239 +0,0 @@
|
||||
server:
|
||||
port: 7001
|
||||
url: http://192.168.0.152:7001/usercenter
|
||||
title: 统一用户管理平台
|
||||
login-page-name: 统一用户管理平台
|
||||
servlet:
|
||||
context-path: /usercenter
|
||||
|
||||
spring:
|
||||
login-url: /oauth/login
|
||||
login-failure: /oauth/login?error
|
||||
login-process: /userlogin
|
||||
assets-matchers: /assets/**
|
||||
thymeleaf:
|
||||
prefix: classpath:/templates/
|
||||
suffix: .html
|
||||
mode: HTML5
|
||||
encoding: UTF-8
|
||||
cache: false
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
application:
|
||||
name: sso-server
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 1GB
|
||||
max-request-size: 1GB
|
||||
datasource:
|
||||
druid:
|
||||
url: jdbc:mysql://192.168.0.151:3306/db_cloud?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||
db-type: mysql
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: root
|
||||
password: root
|
||||
initial-size: 2
|
||||
min-idle: 2
|
||||
max-active: 10
|
||||
# 配置获取连接等待超时的时间
|
||||
max-wait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
min-evictable-idle-time-millis: 300000
|
||||
validation-query: SELECT 1 FROM DUAL
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||||
pool-prepared-statements: true
|
||||
max-pool-prepared-statement-per-connection-size: 10
|
||||
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
|
||||
filter:
|
||||
commons-log:
|
||||
connection-logger-name: stat,wall,log4j
|
||||
stat:
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 2000
|
||||
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
||||
# 合并多个DruidDataSource的监控数据
|
||||
use-global-data-source-stat: true
|
||||
|
||||
mybatis:
|
||||
config-location: classpath:mybatis/mybatis-config.xml
|
||||
mapper-locations: classpath*:mybatis/mapper/**/*.xml
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
enabled: true
|
||||
exposure:
|
||||
include: '*'
|
||||
base-path: /manage
|
||||
enabled-by-default: true
|
||||
endpoint:
|
||||
env:
|
||||
enabled: true
|
||||
health:
|
||||
show-details: always
|
||||
|
||||
# 用户,非必填
|
||||
user:
|
||||
# 默认密码
|
||||
default-password: 88888888
|
||||
|
||||
oauthClient:
|
||||
clientId: 4995b2989c274e76917a8c6144d4ab3b
|
||||
clientSecret: ektSeDMwekFDZzl0WnpFQ0ZKZGo1T3NHZkpwODNsdHpmbGU0KzVheHVTQW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
|
||||
|
||||
swagger:
|
||||
title: 接口文档
|
||||
description: 用户相关接口文档
|
||||
service-url: https://baidu.com/
|
||||
version: 1.0
|
||||
swagger-base-package: com.cm
|
||||
|
||||
file:
|
||||
uploadPath: /projects/uploadFiles/
|
||||
imageTypes: png,jpg,jpeg,gif,blob
|
||||
videoTypes: mp4,rmvb
|
||||
audioTypes: mp3,wmv
|
||||
fileTypes: doc,docx,xls,xlsx,ppt,pptx,txt,zip,rar,apk,pdf
|
||||
maxFileCount: 6
|
||||
|
||||
# 访问控制
|
||||
access-control:
|
||||
pass-paths:
|
||||
- /index.html
|
||||
- /logout.html
|
||||
- /default.html
|
||||
- /assets/**
|
||||
- /web/**
|
||||
- /api/oauthclient/listoauthclient
|
||||
- /api/oauthclient/countoauthclient
|
||||
- /api/user/countuser
|
||||
- /api/file/uploadfile
|
||||
save-paths:
|
||||
- /save*/**
|
||||
- /add*/**
|
||||
delete-paths:
|
||||
- /delete*/**
|
||||
- /remove*/**
|
||||
update-paths:
|
||||
- /update*/**
|
||||
- /edit*/**
|
||||
query-paths:
|
||||
- /get*/**
|
||||
- /query*/**
|
||||
- /find*/**
|
||||
- /list*/**
|
||||
- /count*/**
|
||||
|
||||
logging:
|
||||
file: /projects/logs/usercenter/serviceuser-logs.log
|
||||
level:
|
||||
root: error
|
||||
com.cm: debug
|
||||
|
||||
# 短信服务
|
||||
sms:
|
||||
active: false
|
||||
type: default
|
||||
default-sms:
|
||||
account: xd001382
|
||||
password: xd001382136
|
||||
sign: 【日喀则文化馆】
|
||||
template:
|
||||
verification-code: '{sign} 您的验证码为 {content}, 有效时间为120秒,若非本人操作,请忽略。'
|
||||
|
||||
open-platform:
|
||||
# 钉钉
|
||||
dingding:
|
||||
# 扫码登陆,通过扫码拿到用户unionid,通过access_token获取个人信息,需要设置钉钉通讯录权限,设置访问白名单
|
||||
scan-code-login:
|
||||
app-id: dingoaorwac5cel8rt57rz
|
||||
app-secret: j5n_xRR5eiWGWdNSr3z1UNtGnSRxb1sLp2aKHofwiUuxT8cnJRc46bXTCDBe2t_x
|
||||
userinfo-url: https://oapi.dingtalk.com/sns/getuserinfo_bycode
|
||||
# 必须有一个APP来辅助钉钉扫码登陆
|
||||
app:
|
||||
active: false
|
||||
agent-id: 295981340
|
||||
app-key: dingxz2jzohb7dft9iw7
|
||||
app-secret: MWjSN1PUML-tCjgiSCOUR62Fs_-bdJSaHcorWhLZsd6pKTw6YL-USdsW87QWLxd6
|
||||
token-url: https://oapi.dingtalk.com/gettoken
|
||||
userid-by-unionid-url: https://oapi.dingtalk.com/user/getUseridByUnionid
|
||||
userinfo-by-id-url: https://oapi.dingtalk.com/user/get
|
||||
# 微信
|
||||
wechat:
|
||||
mini-app:
|
||||
# 激活状态
|
||||
active: false
|
||||
authorizeUrl: https://api.weixin.qq.com/sns/jscode2session
|
||||
# 绑定用户连接,指向统一用户,可以内网
|
||||
bindUserUrl: http://127.0.0.1:7001/usercenter/wxminiapp/sign/logincheckusername
|
||||
grantType: authorization_code
|
||||
# appKey: wxe17874894f7ff27b
|
||||
# appSecret: 9ab6a87ccedf6555809f1a42e3820f12
|
||||
# appKey: wx953da91650b16128
|
||||
# appSecret: 69ba0f0223da28e1472a9fe33b4c34d7
|
||||
appKey: wxc529578602bca580
|
||||
appSecret: fb752f8eed90ed449e7194c82756bb7f
|
||||
# 公众号
|
||||
official-account:
|
||||
# 开启跨域
|
||||
apiCrossOrigin: false
|
||||
activate: false
|
||||
authorize:
|
||||
authorize-url: https://open.weixin.qq.com/connect/oauth2/authorize
|
||||
access-token-url: https://api.weixin.qq.com/sns/oauth2/access_token
|
||||
access-token-refresh-url: https://api.weixin.qq.com/sns/oauth2/refresh_token
|
||||
userinfo-url: https://api.weixin.qq.com/sns/userinfo
|
||||
response-type: code
|
||||
scope: snsapi_userinfo
|
||||
state: wechatRedirectUrl
|
||||
grant-type: authorization_code
|
||||
access-token-url: https://api.weixin.qq.com/cgi-bin/token
|
||||
bind-user-url: http://192.168.0.113:7001/usercenter/wechat/sign/login
|
||||
app-id: wx583634d14c596fd7
|
||||
app-secret: 1158dcddd267c6f42b99bda62f842893
|
||||
grant-type: client_credential
|
||||
config-token: WenG
|
||||
|
||||
# 邮件服务
|
||||
email:
|
||||
active: false
|
||||
smtp: smtp.163.com
|
||||
port: 25
|
||||
sender-email: dpdbd001@163.com
|
||||
sender-password: WAASUQNNVITVXDJS
|
||||
cc-persons:
|
||||
- 450292408@qq.com
|
||||
- 76158045@qq.com
|
||||
|
||||
socket:
|
||||
central-control:
|
||||
active: true
|
||||
server:
|
||||
port: 7888
|
||||
# 最大连接数
|
||||
so-backlog: 1024
|
||||
# 服务端超时断连(秒)
|
||||
read-idle-time-second: 10
|
||||
# 离线通知时间(分钟),默认10分钟
|
||||
offline-notice-minute: 1
|
||||
# 离线通知次数
|
||||
offline-notice-count: 3
|
||||
# 异常通知最大值
|
||||
exception-notice-count: 10
|
||||
client:
|
||||
client-id: 317dce24-79cb-41c4-9d59-8b7eaa146eb1
|
||||
client-secret: DpLh+yC8k6JwVEqsf+DCelvvIKlYd6HO60EH8hUdiWuANOlRunYMCMoUsGr0Gqh3
|
||||
host: 49.233.36.36
|
||||
port: 8888
|
||||
max-reconnect-count: 20
|
||||
reconnect-time-step: 1
|
||||
delay-ping-seconds: 3
|
||||
send-client-info-active: false
|
||||
# 上报服务器数据时间
|
||||
send-client-info-second: 30
|
@ -1,240 +0,0 @@
|
||||
server:
|
||||
port: 7001
|
||||
url: http://106.12.218.237:8001/usercenter
|
||||
ws: ws://106.12.218.237:8001/usercenter/ws
|
||||
title: 统一用户管理平台
|
||||
login-page-name: 统一用户管理平台
|
||||
servlet:
|
||||
context-path: /usercenter
|
||||
|
||||
spring:
|
||||
login-url: /oauth/login
|
||||
login-failure: /oauth/login?error
|
||||
login-process: /userlogin
|
||||
assets-matchers: /assets/**
|
||||
thymeleaf:
|
||||
prefix: classpath:/templates/
|
||||
suffix: .html
|
||||
mode: HTML5
|
||||
encoding: UTF-8
|
||||
cache: false
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
application:
|
||||
name: sso-server
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 1GB
|
||||
max-request-size: 1GB
|
||||
datasource:
|
||||
druid:
|
||||
url: jdbc:mysql://localhost:8668/db_cloud_v2?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||
db-type: mysql
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: root
|
||||
password: TSkj@0471.123
|
||||
initial-size: 2
|
||||
min-idle: 2
|
||||
max-active: 10
|
||||
# 配置获取连接等待超时的时间
|
||||
max-wait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
min-evictable-idle-time-millis: 300000
|
||||
validation-query: SELECT 1 FROM DUAL
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||||
pool-prepared-statements: true
|
||||
max-pool-prepared-statement-per-connection-size: 10
|
||||
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
|
||||
filter:
|
||||
commons-log:
|
||||
connection-logger-name: stat,wall,log4j
|
||||
stat:
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 2000
|
||||
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
||||
# 合并多个DruidDataSource的监控数据
|
||||
use-global-data-source-stat: true
|
||||
|
||||
mybatis:
|
||||
config-location: classpath:mybatis/mybatis-config.xml
|
||||
mapper-locations: classpath*:mybatis/mapper/**/*.xml
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
enabled: true
|
||||
exposure:
|
||||
include: '*'
|
||||
base-path: /manage
|
||||
enabled-by-default: true
|
||||
endpoint:
|
||||
env:
|
||||
enabled: true
|
||||
health:
|
||||
show-details: always
|
||||
|
||||
# 用户,非必填
|
||||
user:
|
||||
# 默认密码
|
||||
default-password: 88888888
|
||||
|
||||
oauthClient:
|
||||
clientId: 4995b2989c274e76917a8c6144d4ab3b
|
||||
clientSecret: ektSeDMwekFDZzl0WnpFQ0ZKZGo1T3NHZkpwODNsdHpmbGU0KzVheHVTQW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
|
||||
|
||||
swagger:
|
||||
title: 接口文档
|
||||
description: 用户相关接口文档
|
||||
service-url: https://106.12.218.237:8001/
|
||||
version: 1.0
|
||||
swagger-base-package: com.cm
|
||||
|
||||
file:
|
||||
uploadPath: /projects/uploadFiles/
|
||||
imageTypes: png,jpg,jpeg,gif,blob
|
||||
videoTypes: mp4,rmvb
|
||||
audioTypes: mp3,wmv
|
||||
fileTypes: doc,docx,xls,xlsx,ppt,pptx,txt,zip,rar,apk,pdf
|
||||
maxFileCount: 6
|
||||
|
||||
# 访问控制
|
||||
access-control:
|
||||
pass-paths:
|
||||
- /index.html
|
||||
- /logout.html
|
||||
- /default.html
|
||||
- /assets/**
|
||||
- /web/**
|
||||
- /api/oauthclient/listoauthclient
|
||||
- /api/oauthclient/countoauthclient
|
||||
- /api/user/countuser
|
||||
- /api/file/uploadfile
|
||||
save-paths:
|
||||
- /save*/**
|
||||
- /add*/**
|
||||
delete-paths:
|
||||
- /delete*/**
|
||||
- /remove*/**
|
||||
update-paths:
|
||||
- /update*/**
|
||||
- /edit*/**
|
||||
query-paths:
|
||||
- /get*/**
|
||||
- /query*/**
|
||||
- /find*/**
|
||||
- /list*/**
|
||||
- /count*/**
|
||||
|
||||
logging:
|
||||
file: /projects/logs/usercenter/logs.log
|
||||
level:
|
||||
root: error
|
||||
com.cm: debug
|
||||
|
||||
# 短信服务
|
||||
sms:
|
||||
active: false
|
||||
type: default
|
||||
default-sms:
|
||||
account: xd001382
|
||||
password: xd001382136
|
||||
sign: 【日喀则文化馆】
|
||||
template:
|
||||
verification-code: '{sign} 您的验证码为 {content}, 有效时间为120秒,若非本人操作,请忽略。'
|
||||
|
||||
open-platform:
|
||||
# 钉钉
|
||||
dingding:
|
||||
# 扫码登陆,通过扫码拿到用户unionid,通过access_token获取个人信息,需要设置钉钉通讯录权限,设置访问白名单
|
||||
scan-code-login:
|
||||
app-id: dingoaorwac5cel8rt57rz
|
||||
app-secret: j5n_xRR5eiWGWdNSr3z1UNtGnSRxb1sLp2aKHofwiUuxT8cnJRc46bXTCDBe2t_x
|
||||
userinfo-url: https://oapi.dingtalk.com/sns/getuserinfo_bycode
|
||||
# 必须有一个APP来辅助钉钉扫码登陆
|
||||
app:
|
||||
active: false
|
||||
agent-id: 295981340
|
||||
app-key: dingxz2jzohb7dft9iw7
|
||||
app-secret: MWjSN1PUML-tCjgiSCOUR62Fs_-bdJSaHcorWhLZsd6pKTw6YL-USdsW87QWLxd6
|
||||
token-url: https://oapi.dingtalk.com/gettoken
|
||||
userid-by-unionid-url: https://oapi.dingtalk.com/user/getUseridByUnionid
|
||||
userinfo-by-id-url: https://oapi.dingtalk.com/user/get
|
||||
# 微信
|
||||
wechat:
|
||||
mini-app:
|
||||
# 激活状态
|
||||
active: false
|
||||
authorizeUrl: https://api.weixin.qq.com/sns/jscode2session
|
||||
# 绑定用户连接,指向统一用户,可以内网
|
||||
bindUserUrl: http://127.0.0.1:7001/usercenter/wxminiapp/sign/logincheckusername
|
||||
grantType: authorization_code
|
||||
# appKey: wxe17874894f7ff27b
|
||||
# appSecret: 9ab6a87ccedf6555809f1a42e3820f12
|
||||
# appKey: wx953da91650b16128
|
||||
# appSecret: 69ba0f0223da28e1472a9fe33b4c34d7
|
||||
appKey: wxc529578602bca580
|
||||
appSecret: fb752f8eed90ed449e7194c82756bb7f
|
||||
# 公众号
|
||||
official-account:
|
||||
# 开启跨域
|
||||
apiCrossOrigin: false
|
||||
activate: false
|
||||
authorize:
|
||||
authorize-url: https://open.weixin.qq.com/connect/oauth2/authorize
|
||||
access-token-url: https://api.weixin.qq.com/sns/oauth2/access_token
|
||||
access-token-refresh-url: https://api.weixin.qq.com/sns/oauth2/refresh_token
|
||||
userinfo-url: https://api.weixin.qq.com/sns/userinfo
|
||||
response-type: code
|
||||
scope: snsapi_userinfo
|
||||
state: wechatRedirectUrl
|
||||
grant-type: authorization_code
|
||||
access-token-url: https://api.weixin.qq.com/cgi-bin/token
|
||||
bind-user-url: http://192.168.0.113:7001/usercenter/wechat/sign/login
|
||||
app-id: wx583634d14c596fd7
|
||||
app-secret: 1158dcddd267c6f42b99bda62f842893
|
||||
grant-type: client_credential
|
||||
config-token: WenG
|
||||
|
||||
# 邮件服务
|
||||
email:
|
||||
active: false
|
||||
smtp: smtp.163.com
|
||||
port: 25
|
||||
sender-email: dpdbd001@163.com
|
||||
sender-password: WAASUQNNVITVXDJS
|
||||
cc-persons:
|
||||
- 450292408@qq.com
|
||||
- 76158045@qq.com
|
||||
|
||||
socket:
|
||||
central-control:
|
||||
active: false
|
||||
server:
|
||||
port: 7888
|
||||
# 最大连接数
|
||||
so-backlog: 1024
|
||||
# 服务端超时断连(秒)
|
||||
read-idle-time-second: 10
|
||||
# 离线通知时间(分钟),默认10分钟
|
||||
offline-notice-minute: 1
|
||||
# 离线通知次数
|
||||
offline-notice-count: 3
|
||||
# 异常通知最大值
|
||||
exception-notice-count: 10
|
||||
client:
|
||||
client-id: 317dce24-79cb-41c4-9d59-8b7eaa146eb1
|
||||
client-secret: DpLh+yC8k6JwVEqsf+DCelvvIKlYd6HO60EH8hUdiWuANOlRunYMCMoUsGr0Gqh3
|
||||
host: 49.233.36.36
|
||||
port: 8888
|
||||
max-reconnect-count: 20
|
||||
reconnect-time-step: 1
|
||||
delay-ping-seconds: 3
|
||||
send-client-info-active: false
|
||||
# 上报服务器数据时间
|
||||
send-client-info-second: 30
|
@ -1,16 +1,10 @@
|
||||
server:
|
||||
# port: 8081
|
||||
port: 8868
|
||||
# url: http://58.18.22.25:8081/usercenter
|
||||
url: http://49.233.36.36:8868/usercenter
|
||||
port: 7001
|
||||
url: http://8.130.18.79:7001/usercenter
|
||||
title: 统一用户管理平台
|
||||
login-page-name: 统一用户管理平台
|
||||
servlet:
|
||||
context-path: /usercenter
|
||||
# tomcat:
|
||||
# remote-ip-header: X-Forwarded-For
|
||||
# protocol-header: X-Forwarded-Proto
|
||||
# protocol-header-https-value: https
|
||||
|
||||
spring:
|
||||
login-url: /oauth/login
|
||||
@ -33,11 +27,11 @@ spring:
|
||||
max-request-size: 1GB
|
||||
datasource:
|
||||
druid:
|
||||
url: jdbc:mysql://127.0.0.1:6688/db_cloud_v2?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||
url: jdbc:mysql://127.0.0.1:3306/db_cloud_usercenter?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||
db-type: mysql
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: root
|
||||
password: WenG>)#!^)).12#$
|
||||
username: usercenter
|
||||
password: usercenter
|
||||
initial-size: 2
|
||||
min-idle: 2
|
||||
max-active: 10
|
||||
@ -92,8 +86,7 @@ swagger:
|
||||
swagger-base-package: com.cm
|
||||
|
||||
file:
|
||||
# uploadPath: D:\projects\uploadFiles\
|
||||
uploadPath: /root/develop/projects/uploadFiles/
|
||||
uploadPath: D:\projects\uploadFiles\
|
||||
imageTypes: png,jpg,jpeg,gif,blob
|
||||
videoTypes: mp4,rmvb
|
||||
audioTypes: mp3,wmv
|
||||
@ -128,46 +121,7 @@ access-control:
|
||||
- /count*/**
|
||||
|
||||
logging:
|
||||
# file: D:\projects\logs\usercenter\serviceuser-logs.log
|
||||
file: /root/develop/projects/logs/usercenter/serviceuser-logs.log
|
||||
file: D:\projects\logs\usercenter-logs.log
|
||||
level:
|
||||
root: error
|
||||
com.cm: debug
|
||||
|
||||
# 短信服务
|
||||
sms:
|
||||
active: true
|
||||
type: default
|
||||
default-sms:
|
||||
account: xd001382
|
||||
password: xd001382136
|
||||
sign: 【腾狮科技】
|
||||
template:
|
||||
verification-code: '{sign} 您的验证码为 {content}, 有效时间为120秒,若非本人操作,请忽略。'
|
||||
|
||||
# 邮件服务
|
||||
email:
|
||||
active: true
|
||||
smtp: smtp.qq.com
|
||||
port: 587
|
||||
sender-email: 450292408@qq.com
|
||||
sender-password: pezxpunlxzqgbhhd
|
||||
cc-persons:
|
||||
- 450292408@qq.com
|
||||
- 76158045@qq.com
|
||||
|
||||
socket:
|
||||
central-control:
|
||||
active: true
|
||||
server:
|
||||
port: 8888
|
||||
# 最大连接数
|
||||
so-backlog: 1024
|
||||
# 服务端超时断连(秒)
|
||||
read-idle-time-second: 10
|
||||
# 离线通知时间(分钟),默认10分钟
|
||||
offline-notice-minute: 10
|
||||
# 离线通知次数
|
||||
offline-notice-count: 3
|
||||
# 异常通知最大值
|
||||
exception-notice-count: 10
|
@ -35,13 +35,10 @@ spring:
|
||||
port: 6379
|
||||
datasource:
|
||||
druid:
|
||||
# url: jdbc:mysql://49.233.36.36:6688/db_cloud?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||
url: jdbc:mysql://127.0.0.1:3306/db_jnhb_usercenter?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||
url: jdbc:mysql://127.0.0.1:3306/db_btyjj_usercenter?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||
db-type: mysql
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# username: wanggeng
|
||||
username: root
|
||||
# password: WenG>2132997
|
||||
password: root
|
||||
initial-size: 2
|
||||
min-idle: 2
|
||||
@ -145,6 +142,7 @@ logging:
|
||||
level:
|
||||
root: error
|
||||
com.cm: debug
|
||||
<<<<<<< HEAD
|
||||
|
||||
# 蒙速办对接H5应用配置
|
||||
inspur-auth:
|
||||
@ -252,3 +250,5 @@ socket:
|
||||
send-client-info-active: true
|
||||
# 上报服务器数据时间
|
||||
send-client-info-second: 30
|
||||
=======
|
||||
>>>>>>> b47f55f9b63f1ab8fd03e3ad5196ebd096ad20fd
|
||||
|
Loading…
Reference in New Issue
Block a user