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();
+15 -13
View File
@@ -22,9 +22,10 @@
<script> <script>
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: {
@@ -60,7 +61,7 @@
}, },
data() { data() {
return { return {
tokenHeader: { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) }, tokenHeader: {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)},
spinning: false, spinning: false,
cut: '' cut: ''
} }
@@ -98,14 +99,14 @@
if (info.file.status === 'done') { if (info.file.status === 'done') {
if (info.file.response.success) { if (info.file.response.success) {
if (info.file.response.code === 201) { if (info.file.response.code === 201) {
let { message } = info.file.response let {message} = info.file.response
let { name } = info.file let {name} = info.file
let content = [] let content = []
if (message) { if (message) {
message = message.split('</br>') message = message.split('</br>')
message.forEach(res => { message.forEach(res => {
if (res) { if (res) {
content.push( < div > { res } < /div>) content.push( < div > {res} < /div>)
} }
}) })
} }
@@ -113,7 +114,7 @@
title: name, title: name,
content: ( content: (
< div > < div >
{ content } {content}
< /div> < /div>
) )
}) })
@@ -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: '很抱歉,登录已过期,请重新登录',
@@ -144,14 +146,14 @@
}) })
return return
} }
let { message } = info.file.response let {message} = info.file.response
let { name } = info.file let {name} = info.file
let content = [] let content = []
if (message) { if (message) {
message = message.split('</br>') message = message.split('</br>')
message.forEach(res => { message.forEach(res => {
if (res) { if (res) {
content.push( < div > { res } < /div>) content.push( < div > {res} < /div>)
} }
}) })
} }
@@ -159,7 +161,7 @@
title: name, title: name,
content: ( content: (
< div > < div >
{ content } {content}
< /div> < /div>
) )
}) })
@@ -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: '很抱歉,登录已过期,请重新登录',