Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38d6bae04f | ||
|
|
e49bf32117 | ||
|
|
bc3ea0e10c | ||
|
|
305dc743b2 | ||
|
|
6f0360bad5 | ||
|
|
5012c4bd53 | ||
|
|
dd69b3bb1f | ||
|
|
33d20c518e | ||
|
|
d0935cbda0 | ||
|
|
3ed9a47c66 | ||
|
|
3f6989d039 | ||
|
|
6f6e997fd3 | ||
|
|
d9987b41ea | ||
|
|
c33ad6075e | ||
|
|
a32c333a6c | ||
|
|
ed66f035e5 | ||
|
|
f5dd706e6e | ||
|
|
6766694272 | ||
|
|
2f22b64c0e | ||
|
|
4e6b108e7e | ||
|
|
24629f06b4 | ||
|
|
47c9251389 | ||
|
|
dda5f64910 | ||
|
|
704030729a | ||
|
|
c708809a19 | ||
|
|
2bbec9b79a |
@@ -9,8 +9,8 @@ deploy-jar:
|
|||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_TAG
|
- if: $CI_COMMIT_TAG
|
||||||
script:
|
script:
|
||||||
- mvn clean deploy -Dmaven.test.skip -DaltDeploymentRepository=master::default::file:/usr/local/nginx/html/kepai-repo
|
- mvn clean deploy -Dmaven.test.skip -DaltDeploymentRepository=master::default::file:/usr/local/nginx/html/tiesheng-repo
|
||||||
- cd /usr/local/nginx/html/kepai-repo
|
- cd /usr/local/nginx/html/tiesheng-repo
|
||||||
- git checkout master
|
- git checkout master
|
||||||
- git pull
|
- git pull
|
||||||
- git add .
|
- git add .
|
||||||
|
|||||||
24
pom.xml
24
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>0.9.6</version>
|
<version>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>0.9.6</version>
|
<version>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>0.9.6</version>
|
<version>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>0.9.6</version>
|
<version>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>0.9.6</version>
|
<version>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>0.9.6</version>
|
<version>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>0.9.6</version>
|
<version>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>0.9.6</version>
|
<version>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>0.9.6</version>
|
<version>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>0.9.6</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
<version>3.5.1</version>
|
<version>3.5.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
<pluginRepositories>
|
<pluginRepositories>
|
||||||
<pluginRepository>
|
<pluginRepository>
|
||||||
<id>kepai-repo-plugin</id>
|
<id>kepai-repo-plugin</id>
|
||||||
<url>http://git.kepai365.com/zeng_wenhao/kepai-repo/raw/master</url>
|
<url>http://git.kepai365.com/tiesheng/repository/raw/master</url>
|
||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
|
|
||||||
|
|||||||
BIN
springboot-ademo/.DS_Store
vendored
Normal file
BIN
springboot-ademo/.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>0.9.6</version>
|
<version>1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-ademo</artifactId>
|
<artifactId>springboot-ademo</artifactId>
|
||||||
@@ -25,12 +25,18 @@
|
|||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>easyexcel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>kepai-repo</id>
|
<id>kepai-repo</id>
|
||||||
<url>http://git.kepai365.com/zeng_wenhao/kepai-repo/raw/master</url>
|
<url>http://git.kepai365.com/tiesheng/repository/raw/master</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
|
|||||||
@@ -27,30 +27,28 @@ public class DemoWebConfigurer implements TieshengWebConfigurer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoginConfigurer loginConfigurer() {
|
public TokenBean login(CorePlatformUnique platformUnique) {
|
||||||
return new LoginConfigurer() {
|
TokenBean tokenBean = null;
|
||||||
@Override
|
if (!StrUtil.isEmpty(platformUnique.getUserId())) {
|
||||||
public TokenBean doLogin(CorePlatformUnique platformUnique, String to) {
|
tokenBean = new TokenBean(platformUnique.getUserId(), "", globalConfig.getService());
|
||||||
|
} else {
|
||||||
|
// 获取用户信息判断是否可登录
|
||||||
|
|
||||||
// 默认跳转到mobile
|
}
|
||||||
to = StrUtil.emptyToDefault(to, "mobile");
|
|
||||||
|
|
||||||
TokenBean tokenBean = null;
|
return tokenBean;
|
||||||
if (!StrUtil.isEmpty(platformUnique.getUserId())) {
|
|
||||||
tokenBean = new TokenBean(platformUnique.getUserId(), to, globalConfig.getService());
|
|
||||||
} else {
|
|
||||||
// 获取用户信息判断是否可登录
|
|
||||||
}
|
|
||||||
|
|
||||||
return tokenBean;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void redirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
|
||||||
if (Objects.equals(bean.getEnvironmentType(), "mobile")) {
|
|
||||||
globalConfig.redirect("mobile", "/?token=" + bean.toToken(), response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void redirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
||||||
|
|
||||||
|
// 默认跳转到mobile
|
||||||
|
to = StrUtil.emptyToDefault(to, "mobile");
|
||||||
|
bean.setEnvironmentType(to);
|
||||||
|
|
||||||
|
if (Objects.equals(bean.getEnvironmentType(), "mobile")) {
|
||||||
|
globalConfig.redirect("mobile", "/?token=" + bean.toToken(), response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
package com.tiesheng.demo.controller;
|
package com.tiesheng.demo.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.TimeInterval;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.hutool.log.LogFactory;
|
import cn.hutool.log.LogFactory;
|
||||||
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
|
import cn.hutool.poi.excel.sax.handler.RowHandler;
|
||||||
|
import com.alibaba.excel.EasyExcel;
|
||||||
|
import com.alibaba.excel.context.AnalysisContext;
|
||||||
|
import com.alibaba.excel.read.listener.ReadListener;
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
import com.tiesheng.core.service.CoreMessageService;
|
import com.tiesheng.core.service.CoreMessageService;
|
||||||
|
import com.tiesheng.demo.pojos.PoiBean;
|
||||||
import com.tiesheng.demo.pojos.TestFile;
|
import com.tiesheng.demo.pojos.TestFile;
|
||||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
import com.tiesheng.login.config.token.TsTokenConfig;
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
@@ -19,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,4 +129,43 @@ public class TestController {
|
|||||||
return ApiResp.respOK("");
|
return ApiResp.respOK("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping("poi")
|
||||||
|
@TokenIgnore
|
||||||
|
public ApiResp<String> poi() {
|
||||||
|
TimeInterval timeInterval = new TimeInterval();
|
||||||
|
|
||||||
|
FileUploadPath file = FileUploadPath.file("/upload/test.xlsx");
|
||||||
|
|
||||||
|
EasyExcel.read(new File(file.getAbsolutePath()), PoiBean.class, new ReadListener<PoiBean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(PoiBean poiBean, AnalysisContext analysisContext) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}).sheet().doRead();
|
||||||
|
|
||||||
|
System.out.println("timeInterval: " + timeInterval.interval());
|
||||||
|
return ApiResp.respOK("");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("poiTool")
|
||||||
|
@TokenIgnore
|
||||||
|
public ApiResp<String> poiTool() {
|
||||||
|
TimeInterval timeInterval = new TimeInterval();
|
||||||
|
|
||||||
|
FileUploadPath file = FileUploadPath.file("/upload/test.xlsx");
|
||||||
|
|
||||||
|
ExcelUtil.getReader(new File(file.getAbsolutePath())).read();
|
||||||
|
|
||||||
|
System.out.println("timeInterval: " + timeInterval.interval());
|
||||||
|
|
||||||
|
return ApiResp.respOK("");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.tiesheng.demo.pojos;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
|
||||||
|
public class PoiBean {
|
||||||
|
|
||||||
|
@ExcelProperty("学院")
|
||||||
|
private String college;
|
||||||
|
private String type;
|
||||||
|
private String name;
|
||||||
|
private String no;
|
||||||
|
private String sex;
|
||||||
|
private String fdy;
|
||||||
|
private String fdyNo;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getCollege() {
|
||||||
|
return college;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCollege(String college) {
|
||||||
|
this.college = college;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNo() {
|
||||||
|
return no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNo(String no) {
|
||||||
|
this.no = no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSex() {
|
||||||
|
return sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSex(String sex) {
|
||||||
|
this.sex = sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFdy() {
|
||||||
|
return fdy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFdy(String fdy) {
|
||||||
|
this.fdy = fdy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFdyNo() {
|
||||||
|
return fdyNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFdyNo(String fdyNo) {
|
||||||
|
this.fdyNo = fdyNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,31 +7,10 @@
|
|||||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
|
||||||
name="viewport"
|
name="viewport"
|
||||||
/>
|
/>
|
||||||
<title>钉钉授权</title>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="dingtalk.open.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function getQueryString(name) {
|
|
||||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
||||||
var r = window.location.search.substr(1).match(reg);
|
|
||||||
if (r != null) return decodeURI(r[2]);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd.runtime.permission.requestAuthCode({
|
|
||||||
corpId: getQueryString("corpId"),
|
|
||||||
onSuccess: function (result) {
|
|
||||||
let search = window.location.search + "&code=" + result.code;
|
|
||||||
window.location.href = "/auth/ding/oauth2/" + getQueryString("service") + search;
|
|
||||||
},
|
|
||||||
onFail: function (err) {
|
|
||||||
window.location.href = "./error.html?message=" + JSON.stringify(err);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -7,30 +7,10 @@
|
|||||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
|
||||||
name="viewport"
|
name="viewport"
|
||||||
/>
|
/>
|
||||||
<title>钉钉授权</title>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="dingtalk.open.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function getQueryString(name) {
|
|
||||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
||||||
var r = window.location.search.substr(1).match(reg);
|
|
||||||
if (r != null) return decodeURI(r[2]);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd.runtime.permission.requestAuthCode({
|
|
||||||
corpId: getQueryString("corpId"),
|
|
||||||
onSuccess: function (result) {
|
|
||||||
let search = window.location.search + "&code=" + result.code;
|
|
||||||
window.location.href = "/auth/ding/oauth2/" + getQueryString("service") + search;
|
|
||||||
},
|
|
||||||
onFail: function (err) {
|
|
||||||
window.location.href = "./error.html?message=" + JSON.stringify(err);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -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>0.9.6</version>
|
<version>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>0.9.6</version>
|
<version>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>0.9.6</version>
|
<version>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>0.9.6</version>
|
<version>1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ public class LoginController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/unique/redirect")
|
@GetMapping("/unique/redirect")
|
||||||
public void uniqueIndex(UniqueIndexDTO dto, HttpServletResponse response) {
|
public void uniqueIndex(UniqueIndexDTO dto, HttpServletResponse response) {
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("unique_index_web",
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_redirect",
|
||||||
dto.getNo(), "web", dto.getTo(), dto.getInfo()));
|
dto.getNo(), dto.getPlatform(), dto.getInfo()));
|
||||||
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,8 +72,8 @@ public class LoginController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/unique/index")
|
@PostMapping("/unique/index")
|
||||||
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
|
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("unique_index_web",
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_index",
|
||||||
dto.getNo(), "web", dto.getTo(), dto.getInfo()));
|
dto.getNo(), dto.getPlatform(), dto.getInfo()));
|
||||||
if (tokenBean == null) {
|
if (tokenBean == null) {
|
||||||
throw new ApiException("登录失败");
|
throw new ApiException("登录失败");
|
||||||
}
|
}
|
||||||
@@ -120,8 +120,7 @@ public class LoginController {
|
|||||||
String ddUserId = platformDingConfig.getUserIdByCode(service, dto.getCode());
|
String ddUserId = platformDingConfig.getUserIdByCode(service, dto.getCode());
|
||||||
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, ddUserId);
|
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, ddUserId);
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(dingUserInfo.getAppId(),
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(dingUserInfo.getAppId(),
|
||||||
dingUserInfo.getUserid(), "ding", dto.getTo(),
|
dingUserInfo.getUserid(), "ding", JSON.toJSONString(dingUserInfo)));
|
||||||
JSON.toJSONString(dingUserInfo)));
|
|
||||||
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +166,7 @@ public class LoginController {
|
|||||||
public void wxmpOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
public void wxmpOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
||||||
WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
|
WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(wxUserInfo.getAppId(),
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(wxUserInfo.getAppId(),
|
||||||
wxUserInfo.getOpenid(), "wxmp", dto.getTo(), JSON.toJSONString(wxUserInfo)));
|
wxUserInfo.getOpenid(), "wxmp", JSON.toJSONString(wxUserInfo)));
|
||||||
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +197,7 @@ public class LoginController {
|
|||||||
String openid = platformWxminiConfig.jscode2session(service, code);
|
String openid = platformWxminiConfig.jscode2session(service, code);
|
||||||
WxConfigBean configBean = platformWxminiConfig.getConfigBean(service);
|
WxConfigBean configBean = platformWxminiConfig.getConfigBean(service);
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(configBean.getAppId(),
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(configBean.getAppId(),
|
||||||
openid, "wxmini", "mini", "{}"));
|
openid, "wxmini", "{}"));
|
||||||
|
|
||||||
WxminiLoginVo loginVo = new WxminiLoginVo();
|
WxminiLoginVo loginVo = new WxminiLoginVo();
|
||||||
loginVo.setOpenid(openid);
|
loginVo.setOpenid(openid);
|
||||||
|
|||||||
@@ -5,15 +5,13 @@ public class DoLoginInfo {
|
|||||||
private String appId;
|
private String appId;
|
||||||
private String unique;
|
private String unique;
|
||||||
private String platform;
|
private String platform;
|
||||||
private String to;
|
|
||||||
private String info;
|
private String info;
|
||||||
private String extra;
|
private String extra;
|
||||||
|
|
||||||
public DoLoginInfo(String appId, String unique, String platform, String to, String info) {
|
public DoLoginInfo(String appId, String unique, String platform, String info) {
|
||||||
this.appId = appId;
|
this.appId = appId;
|
||||||
this.unique = unique;
|
this.unique = unique;
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
this.to = to;
|
|
||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,14 +43,6 @@ public class DoLoginInfo {
|
|||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTo() {
|
|
||||||
return to;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTo(String to) {
|
|
||||||
this.to = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInfo() {
|
public String getInfo() {
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class UniqueIndexDTO extends LoginToInfo {
|
|||||||
private String no;
|
private String no;
|
||||||
private String extra;
|
private String extra;
|
||||||
private String info;
|
private String info;
|
||||||
|
private String platform = "web";
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// setter\getter
|
// setter\getter
|
||||||
@@ -38,4 +39,12 @@ public class UniqueIndexDTO extends LoginToInfo {
|
|||||||
public void setInfo(String info) {
|
public void setInfo(String info) {
|
||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatform(String platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public interface TieshengLoginConfigurer {
|
|||||||
/**
|
/**
|
||||||
* 授权登录回调
|
* 授权登录回调
|
||||||
*
|
*
|
||||||
* @param tokenBean
|
* @param bean
|
||||||
*/
|
*/
|
||||||
void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
||||||
|
|
||||||
|
|||||||
@@ -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>0.9.6</version>
|
<version>1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</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>0.9.6</version>
|
<version>1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</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>0.9.6</version>
|
<version>1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</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>0.9.6</version>
|
<version>1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
@@ -33,14 +33,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
<version>5.8.11</version>
|
<version>5.8.16</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- fastJson -->
|
<!-- fastJson -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
<version>1.2.78</version>
|
<version>1.2.83</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 加解密 -->
|
<!-- 加解密 -->
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.comparator.VersionComparator;
|
|||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.hutool.log.LogFactory;
|
import cn.hutool.log.LogFactory;
|
||||||
import com.tiesheng.util.exception.ApiException;
|
import com.tiesheng.util.exception.ApiException;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
@@ -13,6 +14,7 @@ import org.springframework.core.io.Resource;
|
|||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -71,12 +73,24 @@ public class GlobalConfig {
|
|||||||
}
|
}
|
||||||
PathMatchingResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
|
PathMatchingResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
|
||||||
try {
|
try {
|
||||||
Resource[] resources = patternResolver.getResources(String.format("classpath*:static/%s*/index.html", htmlDir));
|
|
||||||
List<String> versions = new ArrayList<>();
|
List<String> versions = new ArrayList<>();
|
||||||
|
|
||||||
|
// jar包中的资源
|
||||||
|
Resource[] resources = patternResolver.getResources(String.format("classpath*:static/%s*/index.html", htmlDir));
|
||||||
for (Resource resource : resources) {
|
for (Resource resource : resources) {
|
||||||
String path = FileUtil.normalize(resource.getURL().getPath());
|
String path = FileUtil.normalize(resource.getURL().getPath());
|
||||||
versions.add(StrUtil.subBetween(path, htmlDir, "/index.html"));
|
versions.add(StrUtil.subBetween(path, htmlDir, "/index.html"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 目录中的资源
|
||||||
|
String folder = String.format("%s/static/%s", System.getProperty("user.dir"), htmlDir);
|
||||||
|
if (FileUtil.exist(folder)) {
|
||||||
|
File[] files = FileUtil.ls(folder);
|
||||||
|
for (File file : files) {
|
||||||
|
versions.add(StrUtil.subAfter(file.getAbsolutePath(), htmlDir, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (CollUtil.isEmpty(versions)) {
|
if (CollUtil.isEmpty(versions)) {
|
||||||
throw new ApiException("无法重定向,请检查资源");
|
throw new ApiException("无法重定向,请检查资源");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import javax.annotation.PostConstruct;
|
|||||||
@ConfigurationProperties(prefix = "tiesheng.ip2region")
|
@ConfigurationProperties(prefix = "tiesheng.ip2region")
|
||||||
public class Ip2regionConfig {
|
public class Ip2regionConfig {
|
||||||
|
|
||||||
private String dbUrl = "http://git.kepai365.com/zeng_wenhao/kepai-repo/raw/master/ipdb/ip2region.xdb";
|
private String dbUrl = "http://git.kepai365.com/tiesheng/repository/raw/master/ipdb/ip2region.xdb";
|
||||||
private String dbPath = System.getProperty("user.dir") + "/runtime/ip2region/ip2region.xdb";
|
private String dbPath = System.getProperty("user.dir") + "/runtime/ip2region/ip2region.xdb";
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -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>0.9.6</version>
|
<version>1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.tiesheng.core.pojos.dto.config.ConfigFuncDTO;
|
|||||||
import com.tiesheng.core.pojos.dto.config.ConfigSystemDTO;
|
import com.tiesheng.core.pojos.dto.config.ConfigSystemDTO;
|
||||||
import com.tiesheng.core.pojos.dto.config.EnumTypeDTO;
|
import com.tiesheng.core.pojos.dto.config.EnumTypeDTO;
|
||||||
import com.tiesheng.core.service.CoreConfigService;
|
import com.tiesheng.core.service.CoreConfigService;
|
||||||
|
import com.tiesheng.core.service.TieshengWebConfigurer;
|
||||||
import com.tiesheng.util.exception.ApiException;
|
import com.tiesheng.util.exception.ApiException;
|
||||||
import com.tiesheng.util.pojos.ApiResp;
|
import com.tiesheng.util.pojos.ApiResp;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -31,6 +32,8 @@ public class ConfigController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
CoreConfigService coreConfigService;
|
CoreConfigService coreConfigService;
|
||||||
|
@Autowired
|
||||||
|
TieshengWebConfigurer tieshengWebConfigurer;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,6 +75,8 @@ public class ConfigController {
|
|||||||
configKey.setConfigVal(dto.getConfigVal());
|
configKey.setConfigVal(dto.getConfigVal());
|
||||||
configKey.setRemark(dto.getRemark());
|
configKey.setRemark(dto.getRemark());
|
||||||
configKey.setExtra(dto.getExtra());
|
configKey.setExtra(dto.getExtra());
|
||||||
|
|
||||||
|
tieshengWebConfigurer.configSystemCheck(configKey);
|
||||||
coreConfigService.updateById(configKey);
|
coreConfigService.updateById(configKey);
|
||||||
|
|
||||||
return ApiResp.respOK("");
|
return ApiResp.respOK("");
|
||||||
|
|||||||
@@ -43,11 +43,29 @@ public class CoreLogProcess extends DaoBase {
|
|||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0-未完成,1-完成)
|
* 状态(0-未完成,1-已完成)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "`status`")
|
@TableField(value = "`status`")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败的文件
|
||||||
|
*/
|
||||||
|
@TableField(value = "fail_file")
|
||||||
|
private String failFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常说明
|
||||||
|
*/
|
||||||
|
@TableField(value = "error")
|
||||||
|
private String error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进度
|
||||||
|
*/
|
||||||
|
@TableField(value = "`process`")
|
||||||
|
private Integer process;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取标题
|
* 获取标题
|
||||||
*
|
*
|
||||||
@@ -139,20 +157,74 @@ public class CoreLogProcess extends DaoBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取状态(0-未完成,1-完成)
|
* 获取状态(0-未完成,1-已完成)
|
||||||
*
|
*
|
||||||
* @return status - 状态(0-未完成,1-完成)
|
* @return status - 状态(0-未完成,1-已完成)
|
||||||
*/
|
*/
|
||||||
public Integer getStatus() {
|
public Integer getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置状态(0-未完成,1-完成)
|
* 设置状态(0-未完成,1-已完成)
|
||||||
*
|
*
|
||||||
* @param status 状态(0-未完成,1-完成)
|
* @param status 状态(0-未完成,1-已完成)
|
||||||
*/
|
*/
|
||||||
public void setStatus(Integer status) {
|
public void setStatus(Integer status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取失败的文件
|
||||||
|
*
|
||||||
|
* @return fail_file - 失败的文件
|
||||||
|
*/
|
||||||
|
public String getFailFile() {
|
||||||
|
return failFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置失败的文件
|
||||||
|
*
|
||||||
|
* @param failFile 失败的文件
|
||||||
|
*/
|
||||||
|
public void setFailFile(String failFile) {
|
||||||
|
this.failFile = failFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取异常说明
|
||||||
|
*
|
||||||
|
* @return error - 异常说明
|
||||||
|
*/
|
||||||
|
public String getError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置异常说明
|
||||||
|
*
|
||||||
|
* @param error 异常说明
|
||||||
|
*/
|
||||||
|
public void setError(String error) {
|
||||||
|
this.error = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取进度
|
||||||
|
*
|
||||||
|
* @return process - 进度
|
||||||
|
*/
|
||||||
|
public Integer getProcess() {
|
||||||
|
return process;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置进度
|
||||||
|
*
|
||||||
|
* @param process 进度
|
||||||
|
*/
|
||||||
|
public void setProcess(Integer process) {
|
||||||
|
this.process = process;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -13,10 +13,16 @@ public class ProcessDetailVo {
|
|||||||
|
|
||||||
private Integer failNum;
|
private Integer failNum;
|
||||||
|
|
||||||
|
private Integer process;
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
private String failFile;
|
||||||
|
|
||||||
|
private String error;
|
||||||
|
|
||||||
public Integer getStatus() {
|
public Integer getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -64,4 +70,28 @@ public class ProcessDetailVo {
|
|||||||
public void setType(String type) {
|
public void setType(String type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFailFile() {
|
||||||
|
return failFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFailFile(String failFile) {
|
||||||
|
this.failFile = failFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getProcess() {
|
||||||
|
return process;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcess(Integer process) {
|
||||||
|
this.process = process;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setError(String error) {
|
||||||
|
this.error = error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.tiesheng.core.service;
|
package com.tiesheng.core.service;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.servlet.ServletUtil;
|
import cn.hutool.extra.servlet.ServletUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
@@ -15,6 +17,8 @@ import com.tiesheng.core.pojos.dao.CoreLogOperation;
|
|||||||
import com.tiesheng.core.pojos.dao.CoreLogProcess;
|
import com.tiesheng.core.pojos.dao.CoreLogProcess;
|
||||||
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
||||||
import com.tiesheng.core.pojos.vo.ProcessDetailVo;
|
import com.tiesheng.core.pojos.vo.ProcessDetailVo;
|
||||||
|
import com.tiesheng.core.util.ProcessImportConsumer;
|
||||||
|
import com.tiesheng.core.util.ProcessSyncConsumer;
|
||||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
import com.tiesheng.login.config.token.TsTokenConfig;
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
import com.tiesheng.util.ServletKit;
|
import com.tiesheng.util.ServletKit;
|
||||||
@@ -24,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hao
|
* @author hao
|
||||||
@@ -53,37 +58,97 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
|||||||
public CoreLogProcessMapper getCoreLogProcessMapper() {
|
public CoreLogProcessMapper getCoreLogProcessMapper() {
|
||||||
return coreLogProcessMapper;
|
return coreLogProcessMapper;
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// 操作日志
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// 导入日志
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加空的过程 返回id 用于更新
|
* 添加导入过程
|
||||||
*
|
*
|
||||||
* @param title 标题
|
* @param title 标题
|
||||||
* @param type 类型 import-导入,sync-同步
|
* @param list 要导入的数据
|
||||||
* @param total 总数
|
|
||||||
*/
|
*/
|
||||||
public CoreLogProcess addProcess(String title, String type, Integer total) {
|
public <T> CoreLogProcess addProcess(String title, List<T> list, ProcessImportConsumer<T> consumer) {
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
throw new ApiException("文件中不存在数据");
|
||||||
|
}
|
||||||
CoreLogProcess coreLogProcess = new CoreLogProcess();
|
CoreLogProcess coreLogProcess = new CoreLogProcess();
|
||||||
coreLogProcess.setTitle(title);
|
coreLogProcess.setTitle(title);
|
||||||
coreLogProcess.setTotal(total);
|
coreLogProcess.setTotal(list.size());
|
||||||
coreLogProcess.setType(type);
|
coreLogProcess.setType("import");
|
||||||
|
coreLogProcess.setSuccessNum(0);
|
||||||
|
coreLogProcess.setFailNum(0);
|
||||||
|
coreLogProcess.setProcess(0);
|
||||||
|
coreLogProcess.setError("");
|
||||||
coreLogProcessMapper.insert(coreLogProcess);
|
coreLogProcessMapper.insert(coreLogProcess);
|
||||||
|
|
||||||
|
ThreadUtil.execute(() -> {
|
||||||
|
CollUtil.split(list, 100).forEach((it) -> {
|
||||||
|
int accept = 0;
|
||||||
|
try {
|
||||||
|
accept = consumer.accept(it);
|
||||||
|
} catch (Exception e) {
|
||||||
|
coreLogProcess.setError(coreLogProcess.getError() + ";" + JSONUtil.toJsonStr(e));
|
||||||
|
}
|
||||||
|
coreLogProcess.setProcess(coreLogProcess.getProcess() + it.size());
|
||||||
|
coreLogProcess.setSuccessNum(coreLogProcess.getSuccessNum() + accept);
|
||||||
|
coreLogProcess.setFailNum(coreLogProcess.getFailNum() + it.size() - accept);
|
||||||
|
coreLogProcessMapper.updateById(coreLogProcess);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 执行结束
|
||||||
|
coreLogProcess.setFailFile(consumer.getFailFile());
|
||||||
|
coreLogProcess.setStatus(1);
|
||||||
|
coreLogProcessMapper.updateById(coreLogProcess);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
return coreLogProcess;
|
return coreLogProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新过程
|
* 添加同步过程
|
||||||
*
|
*
|
||||||
* @param coreLogProcess 过程对象
|
* @param title
|
||||||
|
* @param consumer
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public void upProcess(CoreLogProcess coreLogProcess) {
|
public CoreLogProcess addProcess(String title, ProcessSyncConsumer consumer) {
|
||||||
if (coreLogProcess == null || coreLogProcess.getId().isEmpty()) {
|
CoreLogProcess coreLogProcess = new CoreLogProcess();
|
||||||
throw new ApiException("更新过程id不能为空");
|
coreLogProcess.setTitle(title);
|
||||||
}
|
|
||||||
coreLogProcessMapper.updateById(coreLogProcess);
|
coreLogProcess.setType("sync");
|
||||||
|
coreLogProcess.setSuccessNum(0);
|
||||||
|
coreLogProcess.setFailNum(0);
|
||||||
|
coreLogProcess.setTotal(0);
|
||||||
|
coreLogProcess.setProcess(0);
|
||||||
|
coreLogProcess.setError("");
|
||||||
|
coreLogProcessMapper.insert(coreLogProcess);
|
||||||
|
|
||||||
|
ThreadUtil.execute(() -> {
|
||||||
|
int pageSize = 1000;
|
||||||
|
int pageNum = 1, lastCount = pageSize;
|
||||||
|
while (lastCount == pageSize) {
|
||||||
|
try {
|
||||||
|
lastCount = consumer.accept(pageNum, pageSize);
|
||||||
|
coreLogProcess.setTotal(coreLogProcess.getTotal() + lastCount);
|
||||||
|
coreLogProcess.setProcess(coreLogProcess.getTotal());
|
||||||
|
coreLogProcess.setSuccessNum(coreLogProcess.getSuccessNum() + lastCount);
|
||||||
|
} catch (Exception e) {
|
||||||
|
coreLogProcess.setError(coreLogProcess.getError() + ";" + JSONUtil.toJsonStr(e));
|
||||||
|
}
|
||||||
|
coreLogProcessMapper.updateById(coreLogProcess);
|
||||||
|
pageNum++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行结束
|
||||||
|
coreLogProcess.setStatus(1);
|
||||||
|
coreLogProcessMapper.updateById(coreLogProcess);
|
||||||
|
});
|
||||||
|
|
||||||
|
return coreLogProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,6 +161,10 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
|||||||
return BeanUtil.copyProperties(coreLogProcess, ProcessDetailVo.class);
|
return BeanUtil.copyProperties(coreLogProcess, ProcessDetailVo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// 操作日志
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加操作日志
|
* 添加操作日志
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
if (platformUnique == null) {
|
if (platformUnique == null) {
|
||||||
platformUnique = new CorePlatformUnique();
|
platformUnique = new CorePlatformUnique();
|
||||||
platformUnique.setAppId(loginInfo.getAppId());
|
platformUnique.setAppId(loginInfo.getAppId());
|
||||||
platformUnique.setPlatform(loginInfo.getPlatform());
|
|
||||||
platformUnique.setUniqueId(loginInfo.getUnique());
|
platformUnique.setUniqueId(loginInfo.getUnique());
|
||||||
}
|
}
|
||||||
|
platformUnique.setPlatform(loginInfo.getPlatform());
|
||||||
platformUnique.setInfo(loginInfo.getInfo());
|
platformUnique.setInfo(loginInfo.getInfo());
|
||||||
saveOrUpdate(platformUnique);
|
saveOrUpdate(platformUnique);
|
||||||
|
|
||||||
TokenBean tokenBean = tieshengWebConfigurer.loginConfigurer().doLogin(platformUnique, loginInfo.getTo());
|
TokenBean tokenBean = tieshengWebConfigurer.login(platformUnique);
|
||||||
if (tokenBean != null) {
|
if (tokenBean != null) {
|
||||||
// 添加登录日志
|
// 添加登录日志
|
||||||
coreLogService.addLoginLog(platformUnique, tokenBean);
|
coreLogService.addLoginLog(platformUnique, tokenBean);
|
||||||
@@ -45,7 +45,7 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
public void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
||||||
tieshengWebConfigurer.loginConfigurer().redirect(bean, to, extra, response);
|
tieshengWebConfigurer.redirect(bean, to, extra, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.tiesheng.core.service;
|
|||||||
|
|
||||||
import cn.hutool.log.LogFactory;
|
import cn.hutool.log.LogFactory;
|
||||||
import com.tiesheng.core.pojos.RequestUserInfo;
|
import com.tiesheng.core.pojos.RequestUserInfo;
|
||||||
|
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
||||||
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;
|
||||||
import com.tiesheng.util.exception.ApiRespEnum;
|
import com.tiesheng.util.exception.ApiRespEnum;
|
||||||
@@ -56,34 +57,28 @@ public interface TieshengWebConfigurer {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置登录
|
* 系统配置验证
|
||||||
|
* 如果不符合规则,可以抛出异常
|
||||||
|
*/
|
||||||
|
default void configSystemCheck(CoreConfigSystem configSystem) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录逻辑
|
||||||
*
|
*
|
||||||
|
* @param platformUnique
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
LoginConfigurer loginConfigurer();
|
TokenBean login(CorePlatformUnique platformUnique);
|
||||||
|
|
||||||
|
/**
|
||||||
interface LoginConfigurer {
|
* 登录重定向
|
||||||
|
*
|
||||||
/**
|
* @param bean
|
||||||
* 登录逻辑
|
* @param extra
|
||||||
*
|
* @param response
|
||||||
* @param platformUnique
|
*/
|
||||||
* @return
|
void redirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
||||||
*/
|
|
||||||
TokenBean doLogin(CorePlatformUnique platformUnique, String to);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录重定向
|
|
||||||
*
|
|
||||||
* @param bean
|
|
||||||
* @param extra
|
|
||||||
* @param response
|
|
||||||
*/
|
|
||||||
void redirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.tiesheng.core.util;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ProcessImportConsumer<T> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理数据
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @param <T>
|
||||||
|
* @return 返回成功的数量
|
||||||
|
*/
|
||||||
|
int accept(List<T> list);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取失败的文件路径
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getFailFile();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.tiesheng.core.util;
|
||||||
|
|
||||||
|
public interface ProcessSyncConsumer {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页数据
|
||||||
|
*
|
||||||
|
* @param pageNum
|
||||||
|
* @param pageSize
|
||||||
|
* @return 返回成功的数量
|
||||||
|
*/
|
||||||
|
int accept(Integer pageNum, Integer pageSize);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -61,6 +61,18 @@ CREATE TABLE `core_log_process`
|
|||||||
ALTER TABLE core_log_process
|
ALTER TABLE core_log_process
|
||||||
ADD status int(6) default 0 COMMENT '状态(0-未完成,1-已完成)';
|
ADD status int(6) default 0 COMMENT '状态(0-未完成,1-已完成)';
|
||||||
|
|
||||||
|
ALTER TABLE core_log_process
|
||||||
|
ADD fail_file varchar(500) null default null COMMENT '失败的文件';
|
||||||
|
|
||||||
|
ALTER TABLE core_log_process
|
||||||
|
ADD error text null default null COMMENT '异常说明';
|
||||||
|
|
||||||
|
ALTER TABLE core_log_process
|
||||||
|
ADD process int(6) not null default 0 COMMENT '进度';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for core_log_operation
|
||||||
|
-- ----------------------------
|
||||||
|
|
||||||
CREATE TABLE `core_log_operation`
|
CREATE TABLE `core_log_operation`
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -14,10 +14,13 @@
|
|||||||
<result column="fail_num" jdbcType="INTEGER" property="failNum" />
|
<result column="fail_num" jdbcType="INTEGER" property="failNum" />
|
||||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
<result column="status" jdbcType="INTEGER" property="status" />
|
<result column="status" jdbcType="INTEGER" property="status" />
|
||||||
|
<result column="fail_file" jdbcType="VARCHAR" property="failFile" />
|
||||||
|
<result column="error" jdbcType="LONGVARCHAR" property="error" />
|
||||||
|
<result column="process" jdbcType="INTEGER" property="process" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
id, create_time, update_time, is_deleted, title, total, success_num, fail_num, `type`,
|
id, create_time, update_time, is_deleted, title, total, success_num, fail_num, `type`,
|
||||||
`status`
|
`status`, fail_file, error, `process`
|
||||||
</sql>
|
</sql>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user