Compare commits
No commits in common. "ef33503ed57cc873a64ab1a0ff8e509b5bc92c10" and "d1b72dc1ea561a6681ae1f22d3a7bd80aa846f3e" have entirely different histories.
ef33503ed5
...
d1b72dc1ea
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
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
|
7
Dockerfile-jnhb
Normal file
7
Dockerfile-jnhb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
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
|
57
pom.xml
57
pom.xml
@ -52,6 +52,22 @@
|
|||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
@ -89,7 +105,6 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<<<<<<< HEAD
|
|
||||||
<groupId>com.cm</groupId>
|
<groupId>com.cm</groupId>
|
||||||
<artifactId>cloud-manager-sms</artifactId>
|
<artifactId>cloud-manager-sms</artifactId>
|
||||||
<version>1.0.2-SNAPSHOT</version>
|
<version>1.0.2-SNAPSHOT</version>
|
||||||
@ -111,26 +126,33 @@
|
|||||||
<groupId>com.cm</groupId>
|
<groupId>com.cm</groupId>
|
||||||
<artifactId>cloud-common-dingding</artifactId>
|
<artifactId>cloud-common-dingding</artifactId>
|
||||||
<version>1.0.2-SNAPSHOT</version>
|
<version>1.0.2-SNAPSHOT</version>
|
||||||
<<<<<<< HEAD
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cm</groupId>
|
|
||||||
<artifactId>cloud-common-msbh5</artifactId>
|
|
||||||
<version>1.0.2-SNAPSHOT</version>
|
|
||||||
=======
|
|
||||||
>>>>>>> 3b7be9426296e4bc64e2e6664f96b4ba2a081573
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
=======
|
|
||||||
>>>>>>> b47f55f9b63f1ab8fd03e3ad5196ebd096ad20fd
|
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.16</version>
|
<version>1.18.16</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>org.apache.xmlbeans</groupId>
|
<groupId>org.apache.xmlbeans</groupId>
|
||||||
<artifactId>xmlbeans</artifactId>
|
<artifactId>xmlbeans</artifactId>
|
||||||
@ -138,25 +160,14 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
<!-- 作为客户端使用 -->
|
<!-- 作为客户端使用 -->
|
||||||
<<<<<<< HEAD
|
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>com.cm</groupId>-->
|
<!-- <groupId>com.cm</groupId>-->
|
||||||
<!-- <artifactId>cloud-central-control-client</artifactId>-->
|
<!-- <artifactId>cloud-central-control-client</artifactId>-->
|
||||||
<!-- <version>1.0.2-SNAPSHOT</version>-->
|
<!-- <version>1.0.2-SNAPSHOT</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
=======
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.cm</groupId>
|
|
||||||
<artifactId>cloud-central-control-client</artifactId>
|
|
||||||
<version>1.0.2-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
>>>>>>> 3b7be9426296e4bc64e2e6664f96b4ba2a081573
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> b47f55f9b63f1ab8fd03e3ad5196ebd096ad20fd
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -3,7 +3,6 @@ package com.cm.serviceusercenter;
|
|||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
@ -14,7 +13,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@ComponentScan("com.cm")
|
@ComponentScan("com.cm")
|
||||||
@MapperScan({"com.cm.**.dao"})
|
@MapperScan({"com.cm.**.dao"})
|
||||||
@ServletComponentScan(basePackages = "com.cm")
|
|
||||||
public class ServiceUserCenterApplication {
|
public class ServiceUserCenterApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,109 @@
|
|||||||
|
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("钉钉扫码失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
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,5 +1,7 @@
|
|||||||
package com.cm.serviceusercenter.config;
|
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.UserAuthenticationFilter;
|
||||||
import com.cm.serviceusercenter.authentication.user.UserAuthenticationProvider;
|
import com.cm.serviceusercenter.authentication.user.UserAuthenticationProvider;
|
||||||
import com.cm.serviceusercenter.handler.LoginFailureHandler;
|
import com.cm.serviceusercenter.handler.LoginFailureHandler;
|
||||||
@ -10,6 +12,7 @@ import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
|
|||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.security.web.DefaultSecurityFilterChain;
|
import org.springframework.security.web.DefaultSecurityFilterChain;
|
||||||
|
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When you feel like quitting. Think about why you started
|
* When you feel like quitting. Think about why you started
|
||||||
@ -41,7 +44,8 @@ public class UserSecurityConfig extends SecurityConfigurerAdapter<DefaultSecurit
|
|||||||
userAuthenticationProvider.setPasswordEncoder(passwordEncoder);
|
userAuthenticationProvider.setPasswordEncoder(passwordEncoder);
|
||||||
userAuthenticationProvider.setUserDetailsService(userDetailService);
|
userAuthenticationProvider.setUserDetailsService(userDetailService);
|
||||||
userAuthenticationProvider.setUserLoginService(userLoginService);
|
userAuthenticationProvider.setUserLoginService(userLoginService);
|
||||||
http.authenticationProvider(userAuthenticationProvider);
|
// 加入SpringSecurity的authentication管理的provider集合当中,并且添加到UKeyAuthenticationFilter之前
|
||||||
|
http.authenticationProvider(userAuthenticationProvider).addFilterBefore(userAuthenticationFilter, DingDingAuthenticationFilter.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserDetailService(UserDetailServiceImpl userDetailService) {
|
public void setUserDetailService(UserDetailServiceImpl userDetailService) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.cm.serviceusercenter.config;
|
package com.cm.serviceusercenter.config;
|
||||||
|
|
||||||
|
import com.cm.common.dingding.service.IDingDingAppUserService;
|
||||||
import com.cm.common.handler.AccessDenyHandler;
|
import com.cm.common.handler.AccessDenyHandler;
|
||||||
import com.cm.serviceusercenter.config.properties.DingDingScanCodeLoginProperties;
|
import com.cm.serviceusercenter.config.properties.DingDingScanCodeLoginProperties;
|
||||||
import com.cm.serviceusercenter.handler.LoginFailureHandler;
|
import com.cm.serviceusercenter.handler.LoginFailureHandler;
|
||||||
@ -33,6 +34,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
private UserDetailServiceImpl userDetailService;
|
private UserDetailServiceImpl userDetailService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserLoginService userLoginService;
|
private UserLoginService userLoginService;
|
||||||
|
@Autowired
|
||||||
|
private IDingDingAppUserService dingDingAppUserService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
@ -66,8 +69,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
"/route/file/**",
|
"/route/file/**",
|
||||||
"/api/sms/getverificationcode/*",
|
"/api/sms/getverificationcode/*",
|
||||||
"/api/user/getsignintype/**",
|
"/api/user/getsignintype/**",
|
||||||
"/ws",
|
"/ws")
|
||||||
"/inspur/**")
|
|
||||||
.permitAll()
|
.permitAll()
|
||||||
.and()
|
.and()
|
||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
@ -80,6 +82,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.csrf()
|
.csrf()
|
||||||
.disable();
|
.disable();
|
||||||
addUKeyFilter(http, loginFailureHandler);
|
addUKeyFilter(http, loginFailureHandler);
|
||||||
|
addDingDingAuthenticationFilter(http, loginFailureHandler);
|
||||||
addUserAuthenticationFilter(http, loginFailureHandler);
|
addUserAuthenticationFilter(http, loginFailureHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,6 +102,23 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
http.apply(webUKeySecurityConfig);
|
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
|
* 创建用户认证过滤器链,替换原有UsernamePasswordAuthenticationFilter
|
||||||
|
@ -5,7 +5,10 @@ import com.cm.common.constants.ISystemConstant;
|
|||||||
import com.cm.common.exception.ParamsException;
|
import com.cm.common.exception.ParamsException;
|
||||||
import com.cm.common.result.ErrorResult;
|
import com.cm.common.result.ErrorResult;
|
||||||
import com.cm.common.result.SuccessResult;
|
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.RegisterSimpleVO;
|
||||||
|
import com.cm.serviceusercenter.pojo.vos.user.RegisterVO;
|
||||||
import com.cm.serviceusercenter.service.system.user.IUserService;
|
import com.cm.serviceusercenter.service.system.user.IUserService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@ -36,6 +39,21 @@ public class AppRegisterController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IUserService userService;
|
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 = "注册用户(通过手机和密码)接口")
|
@ApiOperation(value = "注册用户(通过手机和密码)", notes = "注册用户(通过手机和密码)接口")
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@PostMapping("saveregisterusersimple")
|
@PostMapping("saveregisterusersimple")
|
||||||
|
@ -3,19 +3,21 @@ package com.cm.serviceusercenter.controller.app.apis.system;
|
|||||||
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||||
import com.cm.common.base.AbstractController;
|
import com.cm.common.base.AbstractController;
|
||||||
import com.cm.common.constants.ISystemConstant;
|
import com.cm.common.constants.ISystemConstant;
|
||||||
|
import com.cm.common.exception.ParamsException;
|
||||||
import com.cm.common.result.ErrorResult;
|
import com.cm.common.result.ErrorResult;
|
||||||
import com.cm.common.result.SuccessResultData;
|
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.LoginDefaultVO;
|
||||||
|
import com.cm.serviceusercenter.pojo.vos.sign.LoginPhoneVO;
|
||||||
import com.cm.serviceusercenter.service.system.sign.ISignService;
|
import com.cm.serviceusercenter.service.system.sign.ISignService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiResponse;
|
import io.swagger.annotations.ApiResponse;
|
||||||
import io.swagger.annotations.ApiResponses;
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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
|
* When you feel like quitting. Think about why you started
|
||||||
@ -43,4 +45,22 @@ public class AppSignController extends AbstractController {
|
|||||||
return signService.loginDefault(loginDefaultVO);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
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,6 +2,7 @@ package com.cm.serviceusercenter.controller.app.apis.system.user;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||||
import com.cm.common.base.AbstractController;
|
import com.cm.common.base.AbstractController;
|
||||||
import com.cm.common.constants.ISystemConstant;
|
import com.cm.common.constants.ISystemConstant;
|
||||||
import com.cm.common.exception.ParamsException;
|
import com.cm.common.exception.ParamsException;
|
||||||
@ -10,16 +11,17 @@ import com.cm.common.exception.UpdateException;
|
|||||||
import com.cm.common.pojo.ListPage;
|
import com.cm.common.pojo.ListPage;
|
||||||
import com.cm.common.result.ErrorResult;
|
import com.cm.common.result.ErrorResult;
|
||||||
import com.cm.common.result.SuccessResult;
|
import com.cm.common.result.SuccessResult;
|
||||||
|
import com.cm.common.result.SuccessResultData;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
import com.cm.common.token.app.AppTokenManager;
|
import com.cm.common.token.app.AppTokenManager;
|
||||||
import com.cm.common.utils.RegexUtil;
|
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.DepartmentUserDTO;
|
||||||
import com.cm.serviceusercenter.pojo.dtos.UserDTO;
|
import com.cm.serviceusercenter.pojo.dtos.UserDTO;
|
||||||
import com.cm.serviceusercenter.pojo.dtos.user.UserAppDTO;
|
import com.cm.serviceusercenter.pojo.dtos.user.UserAppDTO;
|
||||||
import com.cm.serviceusercenter.pojo.dtos.user.UserInfoDynamicFieldDTO;
|
import com.cm.serviceusercenter.pojo.dtos.user.UserInfoDynamicFieldDTO;
|
||||||
import com.cm.serviceusercenter.pojo.vos.user.AppChangePasswordVO;
|
import com.cm.serviceusercenter.pojo.vos.user.*;
|
||||||
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 com.cm.serviceusercenter.service.system.user.IUserService;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -265,6 +267,21 @@ public class UserAppController extends AbstractController {
|
|||||||
return userService.getUserInfo(token);
|
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用户接口")
|
@ApiOperation(value = "获取APP用户", notes = "获取APP用户接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
@ -275,6 +292,18 @@ public class UserAppController extends AbstractController {
|
|||||||
return userService.getAppUser(token);
|
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 = "下载用户头像接口")
|
@ApiOperation(value = "下载用户头像", notes = "下载用户头像接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "userId", value = "用户Id", paramType = "path")
|
@ApiImplicitParam(name = "userId", value = "用户Id", paramType = "path")
|
||||||
@ -284,4 +313,29 @@ public class UserAppController extends AbstractController {
|
|||||||
public void downLoadAvatar(@PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response) {
|
public void downLoadAvatar(@PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response) {
|
||||||
userService.downLoadAvatar(userId, request, 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
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;
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
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;
|
||||||
|
}
|
@ -0,0 +1,212 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
server:
|
server:
|
||||||
port: 7021
|
port: 7021
|
||||||
url: http://127.0.0.1:7021/usercenter
|
url: http://192.168.0.103:7021/usercenter
|
||||||
ws: ws://127.0.0.1:7021/usercenter/ws
|
ws: ws://192.168.0.103:7021/usercenter/ws
|
||||||
title: 统一用户管理平台
|
title: 统一用户管理平台
|
||||||
login-page-name: 统一用户管理平台
|
login-page-name: 统一用户管理平台
|
||||||
default-home-page: index-gxq
|
default-home-page: index-gxq
|
||||||
@ -29,7 +29,7 @@ spring:
|
|||||||
max-request-size: 1GB
|
max-request-size: 1GB
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
url: jdbc:mysql://192.168.0.151:3306/db_btgxq_city?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
url: jdbc:mysql://127.0.0.1:3306/db_btgxq_usercenter?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||||
db-type: mysql
|
db-type: mysql
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
username: root
|
username: root
|
||||||
@ -88,7 +88,7 @@ swagger:
|
|||||||
swagger-base-package: com.cm
|
swagger-base-package: com.cm
|
||||||
|
|
||||||
file:
|
file:
|
||||||
uploadPath: C:\Users\TS-QD1\Desktop\UploadFiles\
|
uploadPath: /Users/wanggeng/Desktop/UploadFiles/
|
||||||
imageTypes: png,jpg,jpeg,gif,blob
|
imageTypes: png,jpg,jpeg,gif,blob
|
||||||
videoTypes: mp4,rmvb
|
videoTypes: mp4,rmvb
|
||||||
audioTypes: mp3,wmv
|
audioTypes: mp3,wmv
|
||||||
@ -123,7 +123,7 @@ access-control:
|
|||||||
- /count*/**
|
- /count*/**
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
file: C:\Users\TS-QD1\Desktop\UploadFiles\logs\usercenter\logs.log
|
file: /Users/wanggeng/Desktop/UploadFiles/usercenter/serviceuser-logs.log
|
||||||
level:
|
level:
|
||||||
root: error
|
root: error
|
||||||
com.cm: debug
|
com.cm: debug
|
||||||
|
@ -28,14 +28,16 @@ spring:
|
|||||||
max-request-size: 1GB
|
max-request-size: 1GB
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
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
|
# 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
|
||||||
db-type: mysql
|
db-type: mysql
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
username: root
|
username: root
|
||||||
password: TSkj@0471.123
|
# password: TSkj@0471.123
|
||||||
|
password: root
|
||||||
initial-size: 2
|
initial-size: 2
|
||||||
min-idle: 2
|
min-idle: 2
|
||||||
max-active: 100
|
max-active: 10
|
||||||
# 配置获取连接等待超时的时间
|
# 配置获取连接等待超时的时间
|
||||||
max-wait: 60000
|
max-wait: 60000
|
||||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||||
@ -87,7 +89,7 @@ swagger:
|
|||||||
swagger-base-package: com.cm
|
swagger-base-package: com.cm
|
||||||
|
|
||||||
file:
|
file:
|
||||||
uploadPath: /root/projects/uploadFiles/
|
uploadPath: /root/projects_test/uploadFiles/
|
||||||
imageTypes: png,jpg,jpeg,gif,blob
|
imageTypes: png,jpg,jpeg,gif,blob
|
||||||
videoTypes: mp4,rmvb
|
videoTypes: mp4,rmvb
|
||||||
audioTypes: mp3,wmv
|
audioTypes: mp3,wmv
|
||||||
@ -122,7 +124,45 @@ access-control:
|
|||||||
- /count*/**
|
- /count*/**
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
file: /root/projects/logs/usercenter/serviceuser-v2-logs.log
|
file: /root/projects_test/logs/usercenter/serviceuser-logs.log
|
||||||
level:
|
level:
|
||||||
root: error
|
root: error
|
||||||
com.cm: debug
|
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,7 +1,6 @@
|
|||||||
server:
|
server:
|
||||||
port: 7001
|
port: 7001
|
||||||
url: http://49.233.36.36:58090/usercenter
|
url: http://192.168.0.152:7001/usercenter
|
||||||
# ws: ws://192.168.0.103:7001/usercenter/ws
|
|
||||||
title: 统一用户管理平台
|
title: 统一用户管理平台
|
||||||
login-page-name: 统一用户管理平台
|
login-page-name: 统一用户管理平台
|
||||||
servlet:
|
servlet:
|
||||||
@ -28,7 +27,7 @@ spring:
|
|||||||
max-request-size: 1GB
|
max-request-size: 1GB
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
url: jdbc:mysql://127.0.0.1:3306/db_cloud_evaluation_usercenter?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
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
|
db-type: mysql
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
username: root
|
username: root
|
||||||
@ -96,7 +95,7 @@ swagger:
|
|||||||
swagger-base-package: com.cm
|
swagger-base-package: com.cm
|
||||||
|
|
||||||
file:
|
file:
|
||||||
uploadPath: C:\Users\wenc0\Desktop\UploadFiles\
|
uploadPath: /projects/uploadFiles/
|
||||||
imageTypes: png,jpg,jpeg,gif,blob
|
imageTypes: png,jpg,jpeg,gif,blob
|
||||||
videoTypes: mp4,rmvb
|
videoTypes: mp4,rmvb
|
||||||
audioTypes: mp3,wmv
|
audioTypes: mp3,wmv
|
||||||
@ -132,6 +131,7 @@ access-control:
|
|||||||
- /count*/**
|
- /count*/**
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
|
file: /projects/logs/usercenter/serviceuser-logs.log
|
||||||
level:
|
level:
|
||||||
root: error
|
root: error
|
||||||
com.cm: debug
|
com.cm: debug
|
||||||
@ -213,9 +213,9 @@ email:
|
|||||||
|
|
||||||
socket:
|
socket:
|
||||||
central-control:
|
central-control:
|
||||||
active: false
|
active: true
|
||||||
server:
|
server:
|
||||||
port: 8888
|
port: 7888
|
||||||
# 最大连接数
|
# 最大连接数
|
||||||
so-backlog: 1024
|
so-backlog: 1024
|
||||||
# 服务端超时断连(秒)
|
# 服务端超时断连(秒)
|
||||||
@ -234,6 +234,6 @@ socket:
|
|||||||
max-reconnect-count: 20
|
max-reconnect-count: 20
|
||||||
reconnect-time-step: 1
|
reconnect-time-step: 1
|
||||||
delay-ping-seconds: 3
|
delay-ping-seconds: 3
|
||||||
send-client-info-active: true
|
send-client-info-active: false
|
||||||
# 上报服务器数据时间
|
# 上报服务器数据时间
|
||||||
send-client-info-second: 30
|
send-client-info-second: 30
|
240
src/main/resources/application-jnhb.yml
Normal file
240
src/main/resources/application-jnhb.yml
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
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,10 +1,16 @@
|
|||||||
server:
|
server:
|
||||||
port: 7001
|
# port: 8081
|
||||||
url: http://8.130.18.79:7001/usercenter
|
port: 8868
|
||||||
|
# url: http://58.18.22.25:8081/usercenter
|
||||||
|
url: http://49.233.36.36:8868/usercenter
|
||||||
title: 统一用户管理平台
|
title: 统一用户管理平台
|
||||||
login-page-name: 统一用户管理平台
|
login-page-name: 统一用户管理平台
|
||||||
servlet:
|
servlet:
|
||||||
context-path: /usercenter
|
context-path: /usercenter
|
||||||
|
# tomcat:
|
||||||
|
# remote-ip-header: X-Forwarded-For
|
||||||
|
# protocol-header: X-Forwarded-Proto
|
||||||
|
# protocol-header-https-value: https
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
login-url: /oauth/login
|
login-url: /oauth/login
|
||||||
@ -27,11 +33,11 @@ spring:
|
|||||||
max-request-size: 1GB
|
max-request-size: 1GB
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
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
|
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
|
||||||
db-type: mysql
|
db-type: mysql
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
username: usercenter
|
username: root
|
||||||
password: usercenter
|
password: WenG>)#!^)).12#$
|
||||||
initial-size: 2
|
initial-size: 2
|
||||||
min-idle: 2
|
min-idle: 2
|
||||||
max-active: 10
|
max-active: 10
|
||||||
@ -86,7 +92,8 @@ swagger:
|
|||||||
swagger-base-package: com.cm
|
swagger-base-package: com.cm
|
||||||
|
|
||||||
file:
|
file:
|
||||||
uploadPath: D:\projects\uploadFiles\
|
# uploadPath: D:\projects\uploadFiles\
|
||||||
|
uploadPath: /root/develop/projects/uploadFiles/
|
||||||
imageTypes: png,jpg,jpeg,gif,blob
|
imageTypes: png,jpg,jpeg,gif,blob
|
||||||
videoTypes: mp4,rmvb
|
videoTypes: mp4,rmvb
|
||||||
audioTypes: mp3,wmv
|
audioTypes: mp3,wmv
|
||||||
@ -121,7 +128,46 @@ access-control:
|
|||||||
- /count*/**
|
- /count*/**
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
file: D:\projects\logs\usercenter-logs.log
|
# file: D:\projects\logs\usercenter\serviceuser-logs.log
|
||||||
|
file: /root/develop/projects/logs/usercenter/serviceuser-logs.log
|
||||||
level:
|
level:
|
||||||
root: error
|
root: error
|
||||||
com.cm: debug
|
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
|
@ -1,10 +1,6 @@
|
|||||||
server:
|
server:
|
||||||
port: 7001
|
port: 7001
|
||||||
<<<<<<< HEAD
|
|
||||||
url: http://192.168.0.103:7001/usercenter
|
url: http://192.168.0.103:7001/usercenter
|
||||||
=======
|
|
||||||
url: http://49.233.36.36:58090/usercenter
|
|
||||||
>>>>>>> 3b7be9426296e4bc64e2e6664f96b4ba2a081573
|
|
||||||
# ws: ws://192.168.0.103:7001/usercenter/ws
|
# ws: ws://192.168.0.103:7001/usercenter/ws
|
||||||
title: 统一用户管理平台
|
title: 统一用户管理平台
|
||||||
login-page-name: 统一用户管理平台
|
login-page-name: 统一用户管理平台
|
||||||
@ -35,10 +31,13 @@ spring:
|
|||||||
port: 6379
|
port: 6379
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
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
|
# 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
|
||||||
db-type: mysql
|
db-type: mysql
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
# username: wanggeng
|
||||||
username: root
|
username: root
|
||||||
|
# password: WenG>2132997
|
||||||
password: root
|
password: root
|
||||||
initial-size: 2
|
initial-size: 2
|
||||||
min-idle: 2
|
min-idle: 2
|
||||||
@ -142,12 +141,6 @@ logging:
|
|||||||
level:
|
level:
|
||||||
root: error
|
root: error
|
||||||
com.cm: debug
|
com.cm: debug
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
# 蒙速办对接H5应用配置
|
|
||||||
inspur-auth:
|
|
||||||
appId: 102cf5ab-8359-4ee2-ba8a-f3752fa3b16f
|
|
||||||
redirectUri: http://dlho.cn:9003/signup/inspur/index
|
|
||||||
|
|
||||||
# 短信服务
|
# 短信服务
|
||||||
sms:
|
sms:
|
||||||
@ -250,5 +243,3 @@ socket:
|
|||||||
send-client-info-active: true
|
send-client-info-active: true
|
||||||
# 上报服务器数据时间
|
# 上报服务器数据时间
|
||||||
send-client-info-second: 30
|
send-client-info-second: 30
|
||||||
=======
|
|
||||||
>>>>>>> b47f55f9b63f1ab8fd03e3ad5196ebd096ad20fd
|
|
||||||
|
@ -137,6 +137,9 @@
|
|||||||
if(/(^\_)|(\__)|(\_+$)/.test(value)){
|
if(/(^\_)|(\__)|(\_+$)/.test(value)){
|
||||||
return '用户名首尾不能出现下划线\'_\'';
|
return '用户名首尾不能出现下划线\'_\'';
|
||||||
}
|
}
|
||||||
|
if(/^\d+\d+\d$/.test(value)){
|
||||||
|
return '用户名不能全为数字';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:th="http://www.thymeleaf.org">
|
|
||||||
<head>
|
|
||||||
<base href="/usercenter/">
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="icon" type="image/ico" href="assets/favicon.ico"/>
|
|
||||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
|
||||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
|
||||||
<link rel="stylesheet" href="assets/css/supersized.css">
|
|
||||||
<link rel="stylesheet" href="assets/layuiadmin/style/login.css?t=2" media="all">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">蒙速办-首页</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
该页面用于对接测试
|
|
||||||
<br>
|
|
||||||
正式环境需替换为实际应用首页
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
|
||||||
<script>
|
|
||||||
layui.config({
|
|
||||||
base: 'assets/layuiadmin/'
|
|
||||||
}).extend({
|
|
||||||
index: 'lib/index'
|
|
||||||
}).use(['index'], function () {
|
|
||||||
var $ = layui.$;
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue
Block a user