perf:调整demo
This commit is contained in:
@@ -25,6 +25,12 @@
|
|||||||
<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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user