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 + ","); headerSb.append(key + ",");
} }
} else if(i > 2){ } 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(",")); List<String> headList = Arrays.asList(headerSb.toString().split(","));
String field =""; String field ="";
if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) { if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) {
@@ -1092,23 +1108,22 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
} }
} }
// 校验头部是否符合模板 // 校验头部是否符合模板
String substring = headerSb.toString(); // String substring = headerSb.toString();
if (substring.endsWith(",") || substring.endsWith(",")){ // if (substring.endsWith(",") || substring.endsWith(",")){
substring = headerSb.substring(0, headerSb.length() - 1); // substring = headerSb.substring(0, headerSb.length() - 1);
} // }
// String excelHeader = substring.toString();
String excelHeader = substring.toString(); // if (!title.equals(excelHeader)) {
if (!title.equals(excelHeader)) { // workbook.close();
workbook.close(); // //删除原上传文件
//删除原上传文件 // FileUnZip.deleteDir(saveDirectory);
FileUnZip.deleteDir(saveDirectory); // if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){ // throw new JeroBootException("读取失败,请严格按照模板文件导入数据");
throw new JeroBootException("读取失败,请严格按照模板文件导入数据"); // }else{
}else{ // throw new JeroBootException("The data fails to be read. Import data strictly according to the template file");
throw new JeroBootException("The data fails to be read. Import data strictly according to the template file"); // }
} //
// }
}
} }
} }
workbook.close(); workbook.close();
+5 -3
View File
@@ -24,7 +24,8 @@
import Vue from 'vue' import Vue from 'vue'
import {ACCESS_TOKEN} from '@/store/mutation-types' import {ACCESS_TOKEN} from '@/store/mutation-types'
import eventBUs from '../../common/event' import eventBUs from '../../common/event'
import {Modal} from 'ant-design-vue'
import store from '@/store'
export default { export default {
name: 'index', name: 'index',
props: { props: {
@@ -129,7 +130,8 @@
} else { } else {
let data = info.file.response let data = info.file.response
const token = Vue.ls.get(ACCESS_TOKEN) 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({ Modal.error({
title: '登录已过期', title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录', content: '很抱歉,登录已过期,请重新登录',
@@ -169,7 +171,7 @@
if (info.file.response.status === 500) { if (info.file.response.status === 500) {
let data = info.file.response let data = info.file.response
const token = Vue.ls.get(ACCESS_TOKEN) 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({ Modal.error({
title: '登录已过期', title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录', content: '很抱歉,登录已过期,请重新登录',