Merge remote-tracking branch 'origin/master'

This commit is contained in:
liyawei
2022-06-10 17:07:16 +08:00
2 changed files with 47 additions and 30 deletions
@@ -1047,6 +1047,22 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
headerSb.append(key + ",");
}
} else if(i > 2){
// 校验头部是否符合模板
String substring = headerSb.toString();
if (substring.endsWith(",") || substring.endsWith("")){
substring = headerSb.substring(0, headerSb.length() - 1);
}
String excelHeader = substring.toString();
if (!title.equals(excelHeader)) {
workbook.close();
//删除原上传文件
FileUnZip.deleteDir(saveDirectory);
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
throw new JeroBootException("读取失败,请严格按照模板文件导入数据");
}else{
throw new JeroBootException("The data fails to be read. Import data strictly according to the template file");
}
}
List<String> headList = Arrays.asList(headerSb.toString().split(","));
String field ="";
if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) {
@@ -1092,23 +1108,22 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
}
}
// 校验头部是否符合模板
String substring = headerSb.toString();
if (substring.endsWith(",") || substring.endsWith("")){
substring = headerSb.substring(0, headerSb.length() - 1);
}
String excelHeader = substring.toString();
if (!title.equals(excelHeader)) {
workbook.close();
//删除原上传文件
FileUnZip.deleteDir(saveDirectory);
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
throw new JeroBootException("读取失败,请严格按照模板文件导入数据");
}else{
throw new JeroBootException("The data fails to be read. Import data strictly according to the template file");
}
}
// String substring = headerSb.toString();
// if (substring.endsWith(",") || substring.endsWith("")){
// substring = headerSb.substring(0, headerSb.length() - 1);
// }
// String excelHeader = substring.toString();
// if (!title.equals(excelHeader)) {
// workbook.close();
// //删除原上传文件
// FileUnZip.deleteDir(saveDirectory);
// if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
// throw new JeroBootException("读取失败,请严格按照模板文件导入数据");
// }else{
// throw new JeroBootException("The data fails to be read. Import data strictly according to the template file");
// }
//
// }
}
}
workbook.close();
+15 -13
View File
@@ -22,9 +22,10 @@
<script>
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import {ACCESS_TOKEN} from '@/store/mutation-types'
import eventBUs from '../../common/event'
import {Modal} from 'ant-design-vue'
import store from '@/store'
export default {
name: 'index',
props: {
@@ -60,7 +61,7 @@
},
data() {
return {
tokenHeader: { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) },
tokenHeader: {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)},
spinning: false,
cut: ''
}
@@ -98,14 +99,14 @@
if (info.file.status === 'done') {
if (info.file.response.success) {
if (info.file.response.code === 201) {
let { message } = info.file.response
let { name } = info.file
let {message} = info.file.response
let {name} = info.file
let content = []
if (message) {
message = message.split('</br>')
message.forEach(res => {
if (res) {
content.push( < div > { res } < /div>)
content.push( < div > {res} < /div>)
}
})
}
@@ -113,7 +114,7 @@
title: name,
content: (
< div >
{ content }
{content}
< /div>
)
})
@@ -129,7 +130,8 @@
} else {
let data = info.file.response
const token = Vue.ls.get(ACCESS_TOKEN)
if (token && data.message.includes('Token失效')) {
if ((token && data.message.includes('Token失效')) || (token && data.message.includes('token')) || (token && data.message.includes('用户不存在'))) {
this.spinning = false
Modal.error({
title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录',
@@ -144,14 +146,14 @@
})
return
}
let { message } = info.file.response
let { name } = info.file
let {message} = info.file.response
let {name} = info.file
let content = []
if (message) {
message = message.split('</br>')
message.forEach(res => {
if (res) {
content.push( < div > { res } < /div>)
content.push( < div > {res} < /div>)
}
})
}
@@ -159,7 +161,7 @@
title: name,
content: (
< div >
{ content }
{content}
< /div>
)
})
@@ -169,7 +171,7 @@
if (info.file.response.status === 500) {
let data = info.file.response
const token = Vue.ls.get(ACCESS_TOKEN)
if (token && data.message.includes('Token失效')) {
if ((token && data.message.includes('Token失效')) || (token && data.message.includes('token')) || (token && data.message.includes('用户不存在'))) {
Modal.error({
title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录',