Compare commits
16 Commits
1.0.15
...
icbc-sandb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ccb88e02e | ||
|
|
3aca586bd4 | ||
|
|
c2fe494ed9 | ||
|
|
07de3f6ba7 | ||
|
|
1c521e5378 | ||
|
|
e98e98d659 | ||
|
|
75d052bd0c | ||
|
|
3758826987 | ||
|
|
8a4cf8e439 | ||
|
|
09203ac78d | ||
|
|
ef5861327c | ||
|
|
23faaa8f67 | ||
|
|
341c82e0bc | ||
|
|
d2d53523a8 | ||
|
|
fc00bad49a | ||
|
|
6dd4e19e39 |
25
.gitea/workflows/mvn-deploy-icbc-sandbox.yml
Normal file
25
.gitea/workflows/mvn-deploy-icbc-sandbox.yml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
## 工作流触发时机
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
## 任务名称
|
||||||
|
local-deploy:
|
||||||
|
|
||||||
|
## 任务执行的服务器
|
||||||
|
runs-on: tiesheng-local
|
||||||
|
|
||||||
|
## 任务步骤
|
||||||
|
steps:
|
||||||
|
|
||||||
|
## 检出代码(固定配置)
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: https://git.tieshengkeji.com/actions/checkout@v4
|
||||||
|
|
||||||
|
## maven打包
|
||||||
|
- name: Maven deploy
|
||||||
|
run: |
|
||||||
|
mvn deploy
|
||||||
27
pom.xml
27
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</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.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -130,6 +130,13 @@
|
|||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>gitea</id>
|
||||||
|
<url>https://git.tieshengkeji.com/api/packages/tieshengkeji/maven</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-ademo</artifactId>
|
<artifactId>springboot-ademo</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ 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;
|
||||||
import com.tiesheng.platform.config.ding.bean.DingUserInfo;
|
import com.tiesheng.platform.config.ding.bean.DingUserInfo;
|
||||||
|
import com.tiesheng.platform.config.ding.bean.DingUserSimple;
|
||||||
import com.tiesheng.platform.config.wxmini.PlatformWxminiConfig;
|
import com.tiesheng.platform.config.wxmini.PlatformWxminiConfig;
|
||||||
import com.tiesheng.platform.config.wxmp.PlatformWxmpConfig;
|
import com.tiesheng.platform.config.wxmp.PlatformWxmpConfig;
|
||||||
import com.tiesheng.platform.config.wxmp.bean.WxConfigBean;
|
import com.tiesheng.platform.config.wxmp.bean.WxConfigBean;
|
||||||
@@ -85,7 +86,7 @@ public class LoginController {
|
|||||||
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
|
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_index",
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_index",
|
||||||
dto.getNo(), dto.getPlatform(), dto.getInfo()));
|
dto.getNo(), dto.getPlatform(), dto.getInfo()));
|
||||||
if (tokenBean == null) {
|
if (tokenBean == null || StrUtil.isEmpty(tokenBean.getId())) {
|
||||||
throw new ApiException("登录失败");
|
throw new ApiException("登录失败");
|
||||||
}
|
}
|
||||||
return ApiResp.respOK(tokenBean.toToken());
|
return ApiResp.respOK(tokenBean.toToken());
|
||||||
@@ -113,6 +114,7 @@ public class LoginController {
|
|||||||
map.put("corpId", platformDingConfig.getConfigBean(service).getCorpId());
|
map.put("corpId", platformDingConfig.getConfigBean(service).getCorpId());
|
||||||
map.put("service", service);
|
map.put("service", service);
|
||||||
map.put("extra", extra);
|
map.put("extra", extra);
|
||||||
|
map.put("context", globalConfig.getContextPath());
|
||||||
String query = URLUtil.buildQuery(map, Charset.defaultCharset());
|
String query = URLUtil.buildQuery(map, Charset.defaultCharset());
|
||||||
String configUrl = globalConfig.buildPath("/ding/index.html?" + query);
|
String configUrl = globalConfig.buildPath("/ding/index.html?" + query);
|
||||||
try {
|
try {
|
||||||
@@ -130,8 +132,8 @@ public class LoginController {
|
|||||||
@RequestMapping("/ding/oauth2/{service}")
|
@RequestMapping("/ding/oauth2/{service}")
|
||||||
@OperationIgnore
|
@OperationIgnore
|
||||||
public void dingOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
public void dingOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
||||||
String ddUserId = platformDingConfig.getUserIdByCode(service, dto.getCode());
|
DingUserSimple userSimple = platformDingConfig.getUserIdByCode(service, dto.getCode());
|
||||||
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, ddUserId);
|
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, userSimple.getUserid());
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(dingUserInfo.getAppId(),
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(dingUserInfo.getAppId(),
|
||||||
dingUserInfo.getUserid(), "ding", JSON.toJSONString(dingUserInfo)));
|
dingUserInfo.getUserid(), "ding", JSON.toJSONString(dingUserInfo)));
|
||||||
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||||
|
|||||||
@@ -24,10 +24,10 @@
|
|||||||
corpId: getQueryString("corpId"),
|
corpId: getQueryString("corpId"),
|
||||||
onSuccess: function (result) {
|
onSuccess: function (result) {
|
||||||
let search = window.location.search + "&code=" + result.code;
|
let search = window.location.search + "&code=" + result.code;
|
||||||
window.location.href = "/login/ding/oauth2/" + getQueryString("service") + search;
|
window.location.replace(getQueryString("context") + "/login/ding/oauth2/" + getQueryString("service") + search);
|
||||||
},
|
},
|
||||||
onFail: function (err) {
|
onFail: function (err) {
|
||||||
window.location.href = "./error.html?message=" + JSON.stringify(err);
|
window.location.replace("./error.html?message=" + JSON.stringify(err));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.tiesheng.message.config.aliyun;
|
package com.tiesheng.message.config.aliyun;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Validator;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ReUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
import cn.hutool.extra.validation.ValidationUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
@@ -139,7 +142,15 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessageReqResp send(String user, JSONObject body) {
|
public MessageReqResp send(String user, JSONObject body) {
|
||||||
return sendSms(user, body.getStr("template_code"), body);
|
boolean mobile = Validator.isMobile(user);
|
||||||
|
if (!mobile) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String templateCode = body.getStr("template_code");
|
||||||
|
if (StrUtil.isEmpty(templateCode)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return sendSms(user, templateCode, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.lang.TypeReference;
|
import cn.hutool.core.lang.TypeReference;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
|
||||||
import cn.hutool.http.HttpResponse;
|
import cn.hutool.http.HttpResponse;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
@@ -49,6 +48,40 @@ public class PlatformDingConfig {
|
|||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送get请求
|
||||||
|
* 会自动增加accessToken在url上面
|
||||||
|
*
|
||||||
|
* @param service
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public <T> DingResponse<T> doRequest(String service, String url, JSONObject body, TypeReference<DingResponse<T>> typeReference) {
|
||||||
|
if (StrUtil.contains(url, "?")) {
|
||||||
|
url = url + "&access_token=" + getAccessToken(service);
|
||||||
|
} else {
|
||||||
|
url = url + "?access_token=" + getAccessToken(service);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse execute;
|
||||||
|
if (body == null) {
|
||||||
|
execute = HttpUtil.createGet(url).execute();
|
||||||
|
} else {
|
||||||
|
execute = HttpUtil.createPost(url).body(body.toString()).execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (execute.isOk()) {
|
||||||
|
DingResponse<T> bean = JSONUtil.toBean(execute.body(), typeReference, true);
|
||||||
|
if (!bean.isOk()) {
|
||||||
|
LogFactory.get().info(bean.getErrmsg());
|
||||||
|
}
|
||||||
|
return bean;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 逻辑方法
|
// 逻辑方法
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@@ -89,14 +122,15 @@ public class PlatformDingConfig {
|
|||||||
DingConfigBean dingConfigBean = getConfigBean(service);
|
DingConfigBean dingConfigBean = getConfigBean(service);
|
||||||
String jsapiTicket = TimedCacheHelper.getTimedCache().get(CACHE_JSAPI_TICKET + dingConfigBean.getAppKey(), false);
|
String jsapiTicket = TimedCacheHelper.getTimedCache().get(CACHE_JSAPI_TICKET + dingConfigBean.getAppKey(), false);
|
||||||
if (StrUtil.isEmpty(jsapiTicket)) {
|
if (StrUtil.isEmpty(jsapiTicket)) {
|
||||||
String response = HttpUtil.get("https://oapi.dingtalk.com/get_jsapi_ticket?access_token=" + getAccessToken(service));
|
DingResponse<String> respJson = doRequest(service, "https://oapi.dingtalk.com/get_jsapi_ticket", null,
|
||||||
LogFactory.get().info("getJsapiTicket: " + response);
|
new TypeReference<DingResponse<String>>() {
|
||||||
JSONObject respJson = JSONUtil.parseObj(response);
|
});
|
||||||
if (!Objects.equals(respJson.getStr("errcode"), "0")) {
|
if (!respJson.isOk()) {
|
||||||
throw new ApiException(respJson.getStr("errmsg"));
|
throw new ApiException(respJson.getErrmsg());
|
||||||
}
|
}
|
||||||
jsapiTicket = respJson.getStr("ticket");
|
jsapiTicket = respJson.getTicket();
|
||||||
TimedCacheHelper.getTimedCache().put(CACHE_JSAPI_TICKET + dingConfigBean.getAppKey(), jsapiTicket, respJson.getLong("expires_in"));
|
TimedCacheHelper.getTimedCache().put(CACHE_JSAPI_TICKET + dingConfigBean.getAppKey(),
|
||||||
|
jsapiTicket, respJson.getExpiresIn());
|
||||||
}
|
}
|
||||||
return jsapiTicket;
|
return jsapiTicket;
|
||||||
}
|
}
|
||||||
@@ -125,12 +159,11 @@ public class PlatformDingConfig {
|
|||||||
* @return
|
* @return
|
||||||
* @see <a href="https://open.dingtalk.com/document/isvapp-server/obtain-the-userid-of-a-user-by-using-the-log-free"></a>
|
* @see <a href="https://open.dingtalk.com/document/isvapp-server/obtain-the-userid-of-a-user-by-using-the-log-free"></a>
|
||||||
*/
|
*/
|
||||||
public String getUserIdByCode(String service, String code) {
|
public DingUserSimple getUserIdByCode(String service, String code) {
|
||||||
HttpRequest request = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/user/getuserinfo?access_token=" + getAccessToken(service))
|
DingResponse<DingUserSimple> resp = doRequest(service, "https://oapi.dingtalk.com/topapi/v2/user/getuserinfo",
|
||||||
.body(JSONUtil.createObj().putOpt("code", code).toString());
|
JSONUtil.createObj().putOpt("code", code), new TypeReference<DingResponse<DingUserSimple>>() {
|
||||||
try (HttpResponse response = request.execute()) {
|
});
|
||||||
return JSONUtil.parseObj(response.body()).getJSONObject("result").getStr("userid");
|
return resp.getResult();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -144,16 +177,14 @@ public class PlatformDingConfig {
|
|||||||
*/
|
*/
|
||||||
public DingUserInfo topapiV2UserGet(String service, String ddUserId) {
|
public DingUserInfo topapiV2UserGet(String service, String ddUserId) {
|
||||||
DingConfigBean dingConfigBean = getConfigBean(service);
|
DingConfigBean dingConfigBean = getConfigBean(service);
|
||||||
try (HttpResponse response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/user/get?access_token="
|
|
||||||
+ getAccessToken(service))
|
DingUserInfo userInfo = doRequest(service, "https://oapi.dingtalk.com/topapi/v2/user/get",
|
||||||
.body(JSONUtil.createObj().putOpt("userid", ddUserId).toString()).execute()) {
|
JSONUtil.createObj().putOpt("userid", ddUserId), new TypeReference<DingResponse<DingUserInfo>>() {
|
||||||
JSONObject resultJson = JSONUtil.parseObj(response.body()).getJSONObject("result");
|
}).getResult();
|
||||||
DingUserInfo userInfo = JSONUtil.toBean(resultJson, DingUserInfo.class);
|
// 设置一下job_number
|
||||||
// 设置一下job_number
|
userInfo.setJobNumber(userInfo.getJobNumber());
|
||||||
userInfo.setJobNumber(resultJson.getStr("job_number"));
|
userInfo.setAppId(dingConfigBean.getAppKey());
|
||||||
userInfo.setAppId(dingConfigBean.getAppKey());
|
return userInfo;
|
||||||
return userInfo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,16 +199,10 @@ public class PlatformDingConfig {
|
|||||||
if (StrUtil.isEmpty(token)) {
|
if (StrUtil.isEmpty(token)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
try (HttpResponse response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/department/listsub?access_token=" + token)
|
|
||||||
.body(JSONUtil.createObj().putOpt("dept_id", deptId).toString()).execute()) {
|
|
||||||
DingResponse<List<DingDeptVo>> result = JSONUtil.toBean(response.body(), new TypeReference<DingResponse<List<DingDeptVo>>>() {
|
|
||||||
}.getType(), true);
|
|
||||||
|
|
||||||
if (!result.isOk()) {
|
return doRequest(service, "https://oapi.dingtalk.com/topapi/v2/department/listsub",
|
||||||
result.setResult(new ArrayList<>());
|
JSONUtil.createObj().putOpt("dept_id", deptId), new TypeReference<DingResponse<List<DingDeptVo>>>() {
|
||||||
}
|
}).getResult();
|
||||||
return result.getResult();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -192,20 +217,17 @@ public class PlatformDingConfig {
|
|||||||
if (StrUtil.isEmpty(token)) {
|
if (StrUtil.isEmpty(token)) {
|
||||||
return DingUserListVo.fail();
|
return DingUserListVo.fail();
|
||||||
}
|
}
|
||||||
try (HttpResponse response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/user/list?access_token=" + token)
|
|
||||||
.body(JSONUtil.createObj().putOpt("dept_id", deptId).putOpt("cursor", cursor).putOpt("size", 100).toString())
|
return doRequest(service, "https://oapi.dingtalk.com/topapi/v2/user/list",
|
||||||
.execute()) {
|
JSONUtil.createObj().putOpt("dept_id", deptId).putOpt("cursor", cursor).putOpt("size", 100),
|
||||||
DingResponse<DingUserListVo> result = JSONUtil.toBean(response.body(), new TypeReference<DingResponse<DingUserListVo>>() {
|
new TypeReference<DingResponse<DingUserListVo>>() {
|
||||||
}.getType(), true);
|
}).getResult();
|
||||||
if (!result.isOk()) {
|
|
||||||
result.setResult(DingUserListVo.fail());
|
|
||||||
}
|
|
||||||
return result.getResult();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步钉钉的通讯录
|
* 同步钉钉的通讯录
|
||||||
|
* <br />
|
||||||
|
* PS:如果需要钉钉用户手机号,需要开通权限:企业员工手机号信息
|
||||||
*
|
*
|
||||||
* @param deptVo 为null时从第一级获取
|
* @param deptVo 为null时从第一级获取
|
||||||
* @param consumer 回调
|
* @param consumer 回调
|
||||||
@@ -244,18 +266,19 @@ public class PlatformDingConfig {
|
|||||||
* @param content
|
* @param content
|
||||||
* @param actionUrl
|
* @param actionUrl
|
||||||
* @param userIds
|
* @param userIds
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public void messageNotification(String service, String title, String content, String actionUrl, List<String> userIds) {
|
public DingResponse<String> messageNotification(String service, String title, String markdown, String actionUrl, List<String> userIds) {
|
||||||
|
|
||||||
if (CollUtil.isEmpty(userIds)) {
|
if (CollUtil.isEmpty(userIds)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
DingConfigBean configBean = getConfigBean(service);
|
DingConfigBean configBean = getConfigBean(service);
|
||||||
|
|
||||||
JSONObject actionCard = new JSONObject();
|
JSONObject actionCard = new JSONObject();
|
||||||
actionCard.set("title", title);
|
actionCard.set("title", title);
|
||||||
actionCard.set("markdown", "### " + title + "\n" + content);
|
actionCard.set("markdown", markdown);
|
||||||
actionCard.set("single_title", "点击查看");
|
actionCard.set("single_title", "点击查看");
|
||||||
actionCard.set("single_url", actionUrl);
|
actionCard.set("single_url", actionUrl);
|
||||||
|
|
||||||
@@ -263,17 +286,18 @@ public class PlatformDingConfig {
|
|||||||
msg.set("msgtype", "action_card");
|
msg.set("msgtype", "action_card");
|
||||||
msg.set("action_card", actionCard);
|
msg.set("action_card", actionCard);
|
||||||
|
|
||||||
HashMap<String, Object> body = new HashMap<>(10);
|
JSONObject body = new JSONObject();
|
||||||
body.put("agent_id", configBean.getAgentId());
|
body.putOpt("agent_id", configBean.getAgentId());
|
||||||
body.put("userid_list", CollUtil.join(userIds, ","));
|
body.putOpt("userid_list", CollUtil.join(userIds, ","));
|
||||||
body.put("msg", msg);
|
body.putOpt("msg", msg);
|
||||||
String resp = HttpUtil.post("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2?access_token=" + getAccessToken(service),
|
return doRequest(service, "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2", body,
|
||||||
JSONUtil.toJsonStr(body));
|
new TypeReference<DingResponse<String>>() {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// setter\getter
|
// setter\getter
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public Map<String, DingConfigBean> getConfigs() {
|
public Map<String, DingConfigBean> getConfigs() {
|
||||||
return configs;
|
return configs;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ public class DingResponse<T> {
|
|||||||
|
|
||||||
private String errcode;
|
private String errcode;
|
||||||
private String errmsg;
|
private String errmsg;
|
||||||
|
private String ticket;
|
||||||
|
private Long expiresIn;
|
||||||
private T result;
|
private T result;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@@ -43,4 +45,20 @@ public class DingResponse<T> {
|
|||||||
public void setResult(T result) {
|
public void setResult(T result) {
|
||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTicket() {
|
||||||
|
return ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicket(String ticket) {
|
||||||
|
this.ticket = ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getExpiresIn() {
|
||||||
|
return expiresIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpiresIn(Long expiresIn) {
|
||||||
|
this.expiresIn = expiresIn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,8 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* @author hao
|
* @author hao
|
||||||
*/
|
*/
|
||||||
public class DingUserInfo {
|
public class DingUserInfo extends DingUserSimple {
|
||||||
|
|
||||||
private String name;
|
|
||||||
private String userid;
|
|
||||||
private String avatar;
|
private String avatar;
|
||||||
private String mobile;
|
private String mobile;
|
||||||
private String email;
|
private String email;
|
||||||
@@ -17,7 +15,6 @@ public class DingUserInfo {
|
|||||||
private String nickname;
|
private String nickname;
|
||||||
private String title;
|
private String title;
|
||||||
private String remark;
|
private String remark;
|
||||||
private String unionid;
|
|
||||||
private String appId;
|
private String appId;
|
||||||
private List<String> deptIdList;
|
private List<String> deptIdList;
|
||||||
private boolean leader;
|
private boolean leader;
|
||||||
@@ -34,30 +31,6 @@ public class DingUserInfo {
|
|||||||
// setter\getter
|
// setter\getter
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnionid() {
|
|
||||||
return unionid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnionid(String unionid) {
|
|
||||||
this.unionid = unionid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserid() {
|
|
||||||
return userid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserid(String userid) {
|
|
||||||
this.userid = userid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAvatar() {
|
public String getAvatar() {
|
||||||
return avatar;
|
return avatar;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.tiesheng.platform.config.ding.bean;
|
||||||
|
|
||||||
|
public class DingUserSimple {
|
||||||
|
|
||||||
|
private String unionid;
|
||||||
|
private String name;
|
||||||
|
private String userid;
|
||||||
|
|
||||||
|
public String getUnionid() {
|
||||||
|
return unionid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnionid(String unionid) {
|
||||||
|
this.unionid = unionid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserid() {
|
||||||
|
return userid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserid(String userid) {
|
||||||
|
this.userid = userid;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
|
|||||||
BIN
springboot-util/.DS_Store
vendored
Normal file
BIN
springboot-util/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
|
|||||||
BIN
springboot-util/src/main/.DS_Store
vendored
Normal file
BIN
springboot-util/src/main/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -17,7 +17,6 @@ public class ApiResp<T> {
|
|||||||
|
|
||||||
private int code;
|
private int code;
|
||||||
private String message;
|
private String message;
|
||||||
private Throwable exception;
|
|
||||||
private T data;
|
private T data;
|
||||||
private long recordsTotal = 0;
|
private long recordsTotal = 0;
|
||||||
private boolean encrypt = false;
|
private boolean encrypt = false;
|
||||||
@@ -182,11 +181,4 @@ public class ApiResp<T> {
|
|||||||
this.encrypt = encrypt;
|
this.encrypt = encrypt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Throwable getException() {
|
|
||||||
return exception;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setException(Throwable exception) {
|
|
||||||
this.exception = exception;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>icbc-sandbox-1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
|
|||||||
@@ -19,7 +19,11 @@ public class MybatisTimeMetaHandler implements MetaObjectHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void insertFill(MetaObject metaObject) {
|
public void insertFill(MetaObject metaObject) {
|
||||||
// 其中方法参数中第一个是前面自动填充所对应的字段,第二个是要自动填充的值。第三个是指定实体类的对象
|
// 其中方法参数中第一个是前面自动填充所对应的字段,第二个是要自动填充的值。第三个是指定实体类的对象
|
||||||
this.setFieldValByName("createTime", DateUtil.date(), metaObject);
|
Object createTime = getFieldValByName("createTime", metaObject);
|
||||||
|
if (createTime == null) {
|
||||||
|
createTime = DateUtil.date();
|
||||||
|
}
|
||||||
|
this.setFieldValByName("createTime", createTime, metaObject);
|
||||||
this.setFieldValByName("updateTime", DateUtil.date(), metaObject);
|
this.setFieldValByName("updateTime", DateUtil.date(), metaObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,28 @@ public class CoreConfigService extends TsServiceBase<CoreConfigSystemMapper, Cor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取(或创建)一个文本类型的配置
|
||||||
|
*
|
||||||
|
* @param configKey
|
||||||
|
* @param defaultValue
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public CoreConfigSystem getTextOrCreate(String configKey, String defaultValue) {
|
||||||
|
CoreConfigSystem oneByColumn = getOneByColumn("config_key", configKey);
|
||||||
|
if (oneByColumn == null) {
|
||||||
|
oneByColumn = new CoreConfigSystem();
|
||||||
|
oneByColumn.setId(configKey);
|
||||||
|
oneByColumn.setConfigKey(configKey);
|
||||||
|
oneByColumn.setConfigVal(defaultValue);
|
||||||
|
oneByColumn.setRemark(defaultValue);
|
||||||
|
oneByColumn.setConfigType(0);
|
||||||
|
save(oneByColumn);
|
||||||
|
}
|
||||||
|
return oneByColumn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新功能点
|
* 刷新功能点
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -28,10 +28,38 @@ public class CoreMessageService {
|
|||||||
CoreLogMessageMapper coreLogMessageMapper;
|
CoreLogMessageMapper coreLogMessageMapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入数据
|
||||||
|
*
|
||||||
|
* @param reqResp
|
||||||
|
*/
|
||||||
|
private void insertMessageLog(MessageReqResp reqResp) {
|
||||||
|
if (reqResp == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
coreLogMessageMapper.insert(BeanUtil.copyProperties(reqResp, CoreLogMessage.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送所有消息
|
||||||
|
*
|
||||||
|
* @param userIds
|
||||||
|
* @param body
|
||||||
|
*/
|
||||||
|
public void all(List<String> userIds, JSONObject body) {
|
||||||
|
messageSenderList.stream().filter(TieshengMessageSender::support)
|
||||||
|
.forEach(sender -> {
|
||||||
|
for (String user : userIds) {
|
||||||
|
insertMessageLog(sender.send(user, body));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送消息
|
* 发送消息
|
||||||
*
|
*
|
||||||
* @param title
|
* @param channels
|
||||||
* @param body
|
* @param body
|
||||||
* @param channels 消息通道,如果为all时,表示发送全部通道
|
* @param channels 消息通道,如果为all时,表示发送全部通道
|
||||||
*/
|
*/
|
||||||
@@ -41,12 +69,8 @@ public class CoreMessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageSenderList.stream().filter(TieshengMessageSender::support)
|
messageSenderList.stream().filter(TieshengMessageSender::support)
|
||||||
.forEach(sender -> {
|
.forEach(sender -> channels.stream().filter(it -> Objects.equals(it.getChannel(), sender.getChannel()))
|
||||||
channels.stream().filter(it -> Objects.equals(it.getChannel(), sender.getChannel())).forEach(it -> {
|
.forEach(it -> insertMessageLog(sender.send(it.getUser(), body))));
|
||||||
MessageReqResp reqResp = sender.send(it.getUser(), body);
|
|
||||||
coreLogMessageMapper.insert(BeanUtil.copyProperties(reqResp, CoreLogMessage.class));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -54,7 +78,6 @@ public class CoreMessageService {
|
|||||||
* 发送消息
|
* 发送消息
|
||||||
*
|
*
|
||||||
* @param userChannel
|
* @param userChannel
|
||||||
* @param title
|
|
||||||
* @param body
|
* @param body
|
||||||
*/
|
*/
|
||||||
public MessageReqResp send(UserChannel userChannel, JSONObject body) {
|
public MessageReqResp send(UserChannel userChannel, JSONObject body) {
|
||||||
@@ -67,7 +90,7 @@ public class CoreMessageService {
|
|||||||
sender -> Objects.equals(sender.getChannel(), userChannel.getChannel()) && sender.support());
|
sender -> Objects.equals(sender.getChannel(), userChannel.getChannel()) && sender.support());
|
||||||
if (messageSender != null) {
|
if (messageSender != null) {
|
||||||
MessageReqResp reqResp = messageSender.send(userChannel.getUser(), body);
|
MessageReqResp reqResp = messageSender.send(userChannel.getUser(), body);
|
||||||
coreLogMessageMapper.insert(BeanUtil.copyProperties(reqResp, CoreLogMessage.class));
|
insertMessageLog(reqResp);
|
||||||
return reqResp;
|
return reqResp;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.tiesheng.core.service;
|
package com.tiesheng.core.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import cn.hutool.core.util.StrUtil;
|
||||||
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.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hao
|
* @author hao
|
||||||
@@ -37,11 +38,22 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
platformUnique.setInfo(loginInfo.getInfo());
|
platformUnique.setInfo(loginInfo.getInfo());
|
||||||
saveOrUpdate(platformUnique);
|
saveOrUpdate(platformUnique);
|
||||||
|
|
||||||
|
String oldUserId = platformUnique.getUserId();
|
||||||
TokenBean tokenBean = tieshengWebConfigurer.login(platformUnique);
|
TokenBean tokenBean = tieshengWebConfigurer.login(platformUnique);
|
||||||
if (tokenBean != null) {
|
if (tokenBean != null) {
|
||||||
|
|
||||||
// 添加登录日志
|
// 添加登录日志
|
||||||
coreLogService.addLoginLog(platformUnique, tokenBean);
|
coreLogService.addLoginLog(platformUnique, tokenBean);
|
||||||
|
|
||||||
|
// 更新唯一值
|
||||||
|
if (!StrUtil.isEmpty(tokenBean.getId()) &&
|
||||||
|
!Objects.equals(oldUserId, tokenBean.getId())) {
|
||||||
|
platformUnique.setUserId(tokenBean.getId());
|
||||||
|
saveOrUpdate(platformUnique);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return tokenBean;
|
return tokenBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,19 +67,5 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
tieshengWebConfigurer.onSignError(response);
|
tieshengWebConfigurer.onSignError(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新用户id
|
|
||||||
*
|
|
||||||
* @param uniqueId
|
|
||||||
* @param userId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean updateUserId(String uniqueId, String userId) {
|
|
||||||
return update(new UpdateWrapper<CorePlatformUnique>().eq("unique_id", uniqueId)
|
|
||||||
.set("user_id", userId)
|
|
||||||
.set("is_deleted", 0)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ public class FileUploadService {
|
|||||||
* @param fileMd5
|
* @param fileMd5
|
||||||
*/
|
*/
|
||||||
public String chunkMerge(String fileMd5, String fileExt) {
|
public String chunkMerge(String fileMd5, String fileExt) {
|
||||||
|
// 0,校验文件类型是否合法
|
||||||
|
tieshengWebConfigurer.uploadFileCheck(fileExt);
|
||||||
|
|
||||||
// 1,获取文件块的目录
|
// 1,获取文件块的目录
|
||||||
FileUploadPath folder = FileUploadPath.folder(fileMd5);
|
FileUploadPath folder = FileUploadPath.folder(fileMd5);
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ public interface TieshengWebConfigurer {
|
|||||||
*/
|
*/
|
||||||
default ApiResp<String> addExceptionHandler(Exception e) {
|
default ApiResp<String> addExceptionHandler(Exception e) {
|
||||||
ApiResp<String> apiResp = ApiResp.respCust(ApiRespEnum.ServerError);
|
ApiResp<String> apiResp = ApiResp.respCust(ApiRespEnum.ServerError);
|
||||||
apiResp.setException(e);
|
LogFactory.get().info(e);
|
||||||
LogFactory.get().info(apiResp.getException());
|
|
||||||
return apiResp;
|
return apiResp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user