Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82c8e3f474 | ||
|
|
b49e736f0d | ||
|
|
603b5abdfe |
20
pom.xml
20
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>springboot-parent</name>
|
<name>springboot-parent</name>
|
||||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||||
@@ -57,55 +57,55 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-db-migration</artifactId>
|
<artifactId>springboot-db-migration</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-ademo</artifactId>
|
<artifactId>springboot-ademo</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-db-migration</artifactId>
|
<artifactId>springboot-db-migration</artifactId>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import java.util.List;
|
|||||||
@ConfigurationProperties(prefix = "tiesheng.db-migration")
|
@ConfigurationProperties(prefix = "tiesheng.db-migration")
|
||||||
public class DbMigrationConfig {
|
public class DbMigrationConfig {
|
||||||
|
|
||||||
private String table = "core_db_migration";
|
private String table = "core_config_db";
|
||||||
private List<String> locations = CollUtil.newArrayList("classpath*:db/migration/*.sql");
|
private List<String> locations = CollUtil.newArrayList("classpath*:db/migration/*.sql");
|
||||||
private String ignoreSqls = "drop,delete";
|
private String ignoreSqls = "drop,delete";
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ public class DbMigrationConfig {
|
|||||||
" `file` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件名称',\n" +
|
" `file` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件名称',\n" +
|
||||||
" `checksum` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件checksum',\n" +
|
" `checksum` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件checksum',\n" +
|
||||||
" PRIMARY KEY (`id`) USING BTREE\n" +
|
" PRIMARY KEY (`id`) USING BTREE\n" +
|
||||||
") ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'db-合并' ROW_FORMAT = Dynamic;");
|
") ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '配置-数据库' ROW_FORMAT = Dynamic;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import cn.hutool.core.util.URLUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
import com.tiesheng.login.pojos.dto.UniqueIndexDTO;
|
import com.tiesheng.login.pojos.CodeExtraDTO;
|
||||||
|
import com.tiesheng.login.pojos.DoLoginInfo;
|
||||||
|
import com.tiesheng.login.pojos.UniqueIndexDTO;
|
||||||
import com.tiesheng.login.service.TieshengLoginConfigurer;
|
import com.tiesheng.login.service.TieshengLoginConfigurer;
|
||||||
import com.tiesheng.platform.config.ding.PlatformDingConfig;
|
import com.tiesheng.platform.config.ding.PlatformDingConfig;
|
||||||
import com.tiesheng.platform.config.ding.bean.DingJsapiSignature;
|
import com.tiesheng.platform.config.ding.bean.DingJsapiSignature;
|
||||||
@@ -51,9 +53,9 @@ public class LoginController {
|
|||||||
@GetMapping("/unique/redirect")
|
@GetMapping("/unique/redirect")
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
public void uniqueIndex(UniqueIndexDTO dto, HttpServletResponse response) {
|
public void uniqueIndex(UniqueIndexDTO dto, HttpServletResponse response) {
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin("unique_index_" + dto.getPlatform(),
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("unique_index_web",
|
||||||
dto.getNo(), dto.getPlatform(), dto.getInfo());
|
dto.getNo(), "web", dto.getTo(), dto.getInfo()));
|
||||||
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getExtra(), response);
|
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,8 +68,8 @@ public class LoginController {
|
|||||||
@PostMapping("/unique/index")
|
@PostMapping("/unique/index")
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
|
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin("unique_index_" + dto.getPlatform(),
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("unique_index_web",
|
||||||
dto.getNo(), dto.getPlatform(), dto.getInfo());
|
dto.getNo(), "web", dto.getTo(), dto.getInfo()));
|
||||||
if (tokenBean == null) {
|
if (tokenBean == null) {
|
||||||
throw new ApiException("登录失败");
|
throw new ApiException("登录失败");
|
||||||
}
|
}
|
||||||
@@ -112,12 +114,13 @@ public class LoginController {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping("/ding/oauth2/{service}")
|
@RequestMapping("/ding/oauth2/{service}")
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
public void dingOauth2(@PathVariable String service, String code, String extra, HttpServletResponse response) {
|
public void dingOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
||||||
String ddUserId = platformDingConfig.getUserIdByCode(service, code);
|
String ddUserId = platformDingConfig.getUserIdByCode(service, dto.getCode());
|
||||||
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, ddUserId);
|
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, ddUserId);
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(dingUserInfo.getAppId(), dingUserInfo.getUserid(), "ding",
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(dingUserInfo.getAppId(),
|
||||||
JSON.toJSONString(dingUserInfo));
|
dingUserInfo.getUserid(), "ding", dto.getTo(),
|
||||||
tieshengLoginConfigurer.onLoginRedirect(tokenBean, extra, response);
|
JSON.toJSONString(dingUserInfo)));
|
||||||
|
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -159,15 +162,14 @@ public class LoginController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信授权回调
|
* 微信授权回调
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/wxmp/oauth2/{service}")
|
@RequestMapping("/wxmp/oauth2/{service}")
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
public void wxmpOauth2(@PathVariable String service, String code, String extra, HttpServletResponse response) {
|
public void wxmpOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
||||||
WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, code);
|
WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(wxUserInfo.getAppId(), wxUserInfo.getOpenid(), "wxmp", JSON.toJSONString(wxUserInfo));
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(wxUserInfo.getAppId(),
|
||||||
tieshengLoginConfigurer.onLoginRedirect(tokenBean, extra, response);
|
wxUserInfo.getOpenid(), "wxmp", dto.getTo(), JSON.toJSONString(wxUserInfo)));
|
||||||
|
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.tiesheng.login.pojos;
|
||||||
|
|
||||||
|
public class CodeExtraDTO {
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String extra;
|
||||||
|
private String to;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExtra() {
|
||||||
|
return extra;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtra(String extra) {
|
||||||
|
this.extra = extra;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTo() {
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTo(String to) {
|
||||||
|
this.to = to;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.tiesheng.login.pojos;
|
||||||
|
|
||||||
|
public class DoLoginInfo {
|
||||||
|
|
||||||
|
private String appId;
|
||||||
|
private String unique;
|
||||||
|
private String platform;
|
||||||
|
private String to;
|
||||||
|
private String info;
|
||||||
|
private String extra;
|
||||||
|
|
||||||
|
public DoLoginInfo(String appId, String unique, String platform, String to, String info) {
|
||||||
|
this.appId = appId;
|
||||||
|
this.unique = unique;
|
||||||
|
this.platform = platform;
|
||||||
|
this.to = to;
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAppId() {
|
||||||
|
return appId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppId(String appId) {
|
||||||
|
this.appId = appId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUnique() {
|
||||||
|
return unique;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnique(String unique) {
|
||||||
|
this.unique = unique;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatform(String platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTo() {
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTo(String to) {
|
||||||
|
this.to = to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInfo() {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInfo(String info) {
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExtra() {
|
||||||
|
return extra;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtra(String extra) {
|
||||||
|
this.extra = extra;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.tiesheng.login.pojos.dto;
|
package com.tiesheng.login.pojos;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
public class UniqueIndexDTO {
|
public class UniqueIndexDTO {
|
||||||
|
|
||||||
private String no;
|
private String no;
|
||||||
private String platform;
|
private String to;
|
||||||
private String extra;
|
private String extra;
|
||||||
private String info;
|
private String info;
|
||||||
|
|
||||||
@@ -21,12 +21,12 @@ public class UniqueIndexDTO {
|
|||||||
this.no = no;
|
this.no = no;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPlatform() {
|
public String getTo() {
|
||||||
return platform;
|
return to;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlatform(String platform) {
|
public void setTo(String to) {
|
||||||
this.platform = platform;
|
this.to = to;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExtra() {
|
public String getExtra() {
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.tiesheng.login.service;
|
package com.tiesheng.login.service;
|
||||||
|
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
|
import com.tiesheng.login.pojos.DoLoginInfo;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -16,7 +17,7 @@ public interface TieshengLoginConfigurer {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
TokenBean doLogin(String appId, String uniqueId, String platfrom, String info);
|
TokenBean doLogin(DoLoginInfo loginInfo);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,7 +25,7 @@ public interface TieshengLoginConfigurer {
|
|||||||
*
|
*
|
||||||
* @param tokenBean
|
* @param tokenBean
|
||||||
*/
|
*/
|
||||||
void onLoginRedirect(TokenBean bean, String extra, HttpServletResponse response);
|
void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.tiesheng.login.service.impl;
|
package com.tiesheng.login.service.impl;
|
||||||
|
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
|
import com.tiesheng.login.pojos.DoLoginInfo;
|
||||||
import com.tiesheng.login.service.TieshengLoginConfigurer;
|
import com.tiesheng.login.service.TieshengLoginConfigurer;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -15,12 +16,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
public class DefaultLoginConfigurer implements TieshengLoginConfigurer {
|
public class DefaultLoginConfigurer implements TieshengLoginConfigurer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TokenBean doLogin(String appId, String uniqueId, String platfrom, String info) {
|
public TokenBean doLogin(DoLoginInfo loginInfo) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoginRedirect(TokenBean bean, String extra, HttpServletResponse response) {
|
public void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.2</version>
|
<version>0.1.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.tiesheng.core.mapper.CorePlatformUniqueMapper;
|
import com.tiesheng.core.mapper.CorePlatformUniqueMapper;
|
||||||
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
||||||
import com.tiesheng.login.service.TieshengLoginConfigurer;
|
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
|
import com.tiesheng.login.pojos.DoLoginInfo;
|
||||||
|
import com.tiesheng.login.service.TieshengLoginConfigurer;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -24,11 +25,18 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
CoreLogService coreLogService;
|
CoreLogService coreLogService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TokenBean doLogin(String appId, String uniqueId, String platfrom, String info) {
|
public TokenBean doLogin(DoLoginInfo loginInfo) {
|
||||||
|
|
||||||
CorePlatformUnique platformUnique = getByAppAndUnique(appId, uniqueId, platfrom);
|
CorePlatformUnique platformUnique = getOneByColumn("unique_id", loginInfo.getUnique());
|
||||||
platformUnique.setInfo(info);
|
if (platformUnique == null) {
|
||||||
TokenBean tokenBean = tieshengWebConfigurer.loginConfigurer().doLogin(platformUnique);
|
platformUnique = new CorePlatformUnique();
|
||||||
|
platformUnique.setAppId(loginInfo.getAppId());
|
||||||
|
platformUnique.setPlatform(loginInfo.getPlatform());
|
||||||
|
platformUnique.setUniqueId(loginInfo.getUnique());
|
||||||
|
}
|
||||||
|
platformUnique.setInfo(loginInfo.getInfo());
|
||||||
|
|
||||||
|
TokenBean tokenBean = tieshengWebConfigurer.loginConfigurer().doLogin(platformUnique, loginInfo.getTo());
|
||||||
if (tokenBean != null) {
|
if (tokenBean != null) {
|
||||||
platformUnique.setUserId(tokenBean.getId());
|
platformUnique.setUserId(tokenBean.getId());
|
||||||
platformUnique.setIsDeleted(0);
|
platformUnique.setIsDeleted(0);
|
||||||
@@ -41,32 +49,8 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoginRedirect(TokenBean bean, String extra, HttpServletResponse response) {
|
public void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
||||||
tieshengWebConfigurer.loginConfigurer().redirect(bean, extra, response);
|
tieshengWebConfigurer.loginConfigurer().redirect(bean, to, extra, response);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过appId获取登录对象
|
|
||||||
*
|
|
||||||
* @param appId
|
|
||||||
* @param uniqueId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private CorePlatformUnique getByAppAndUnique(String appId, String uniqueId, String platform) {
|
|
||||||
QueryWrapper<CorePlatformUnique> queryWrapper = new QueryWrapper<>();
|
|
||||||
queryWrapper.eq("app_id", appId);
|
|
||||||
queryWrapper.eq("unique_id", uniqueId);
|
|
||||||
queryWrapper.eq("platform", platform);
|
|
||||||
queryWrapper.last("limit 1");
|
|
||||||
CorePlatformUnique platformUnique = getOne(queryWrapper);
|
|
||||||
if (platformUnique == null) {
|
|
||||||
platformUnique = new CorePlatformUnique();
|
|
||||||
platformUnique.setAppId(appId);
|
|
||||||
platformUnique.setUniqueId(uniqueId);
|
|
||||||
platformUnique.setPlatform(platform);
|
|
||||||
}
|
|
||||||
return platformUnique;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public interface TieshengWebConfigurer {
|
|||||||
* @param platformUnique
|
* @param platformUnique
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
TokenBean doLogin(CorePlatformUnique platformUnique);
|
TokenBean doLogin(CorePlatformUnique platformUnique, String to);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,7 +81,7 @@ public interface TieshengWebConfigurer {
|
|||||||
* @param extra
|
* @param extra
|
||||||
* @param response
|
* @param response
|
||||||
*/
|
*/
|
||||||
void redirect(TokenBean bean, String extra, HttpServletResponse response);
|
void redirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user