From 42797ee4bef2d826014913f23b99e39e2f0937c2 Mon Sep 17 00:00:00 2001 From: mqh <1571896045@qq.com> Date: Fri, 21 Jul 2023 15:26:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AF=BC=E5=85=A5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/modulex/ModulexList.vue | 3 +- .../views/modulex/modules/ModulexImport.vue | 12 ++-- .../tablex/controller/TablexController.java | 64 ++++++++++--------- .../service/impl/TablexServiceImpl.java | 2 +- 4 files changed, 45 insertions(+), 36 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue b/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue index d972fec..a2f33f1 100644 --- a/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue +++ b/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue @@ -508,7 +508,7 @@ export default { return { note: ['对应模块id(必填):填写正确的模块名称', '中文名称(必填):与模块名称相同。', - '英文名称(必填):与模块名称相同,写模块名称的英文名称。', + '英文名称(必填):与模块名称相同,填写模块名称的英文名称。', '实体状态:可填入值为[正常、停用、废弃],若不填写,默认为“正常”状态。', '版本状态: 可填入值为[当前、历史],若不填写,默认为“当前”状态', '版本号:请填写小与五位数的正整数' @@ -605,6 +605,7 @@ export default { let flag = false this.ws.onmessage = (e) => { let res = JSON.parse(e.data); + console.log('1111111111111',res) this.$refs.moduleximport.edit(res); if (res.isError === 'true') { this.$message.error(res.status) diff --git a/ant-design-vue-jeecg/src/views/modulex/modules/ModulexImport.vue b/ant-design-vue-jeecg/src/views/modulex/modules/ModulexImport.vue index fe114be..d28fec2 100644 --- a/ant-design-vue-jeecg/src/views/modulex/modules/ModulexImport.vue +++ b/ant-design-vue-jeecg/src/views/modulex/modules/ModulexImport.vue @@ -6,6 +6,7 @@ :closable="closable" @cancel="handleCancel" :maskClosable="maskClosable" + > @@ -16,7 +17,7 @@
@@ -76,16 +77,13 @@ export default { visible: false, model: {}, // 注意事项默认值 - closeable: 'true', uploadFinished: false, ModalData: { uploaded: '0', isVisible: 'false', records: '0', status: '判断文件结构', - // closeable: 'false' }, - btnState: false, form: this.$form.createForm(this), url: { @@ -149,11 +147,14 @@ export default { this.datas = data.note this.title = data.title this.ModalData = {} + this.ModalData.closeable = "true" this.visible = true this.ws=ws + }, edit(record) { this.ModalData = record + // this.closeable = this.ModalData.closeable === "true" }, edit1(record) { this.visible = true @@ -165,6 +166,7 @@ export default { this.ws.close() }, handleCancel() { + console.log(this.ModalData,'11111') this.close() this.ws.close() }, diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java index 3c86d3f..08deabb 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java @@ -311,8 +311,8 @@ public class TablexController extends JeecgController { //获取上传文件对象 ImportParams params = new ImportParams(); - params.setTitleRows(1);//表格标题行数,默认0 - params.setHeadRows(1);//表头行数,默认1 + params.setTitleRows(1);//表格标题条数,默认0 + params.setHeadRows(1);//表头条数,默认1 params.setNeedSave(true);//是否需要保存上传的Excel,默认为false List list = null; try { @@ -336,8 +336,10 @@ public class TablexController extends JeecgController { message.put("status", "数据预读入"); webSocketUtils.sendMessage(loginUser.getId(), message); + Iterator iterator = list.iterator(); +// for (TablexVo tablexVo : list) { for (TablexVo tablexVo : list) { - //判断当前存入行是否为空值 + //判断当前存入条是否为空值 if (StringUtils.isBlank(tablexVo.getModuleId()) && StringUtils.isBlank(tablexVo.getTableName()) && StringUtils.isBlank(tablexVo.getTableEnName()) && @@ -346,7 +348,8 @@ public class TablexController extends JeecgController { StringUtils.isBlank(tablexVo.getStatus()) && StringUtils.isBlank(tablexVo.getVerisonStatus()) && StringUtils.isBlank(tablexVo.getVerison())) { - list.remove(tablexVo); +// list.remove(tablexVo); +// break; continue; } //判断版本号长度 @@ -379,9 +382,11 @@ public class TablexController extends JeecgController { message.put("status", "开始数据校验"); webSocketUtils.sendMessage(loginUser.getId(), message); + + List tablexList = new ArrayList<>(); + for (int i = 0; i < voList.size(); i++) { - List tablexList = new ArrayList<>(); Tablex tablex = new Tablex(); String moduleId = voList.get(i).getModuleId(); @@ -415,9 +420,9 @@ public class TablexController extends JeecgController { //判断对应模块 if (modulexId != null && voList.get(i).getModuleId() != null && !voList.get(i).getModuleId().equals("")) { //判断中文名称 - if (voList.get(i).getTableName() != null && !voList.get(i).getTableName().equals("") && !voList.get(i).getTableName().equals(modulex.getModuleName())) { + if (voList.get(i).getTableName() != null && !voList.get(i).getTableName().equals("") && voList.get(i).getTableName().equals(modulex.getModuleName())) { //判断英文名称 - if (voList.get(i).getTableEnName() != null && !voList.get(i).getTableEnName().equals("") && !voList.get(i).getTableEnName().equals(modulex.getModuleEnName())) { + if (voList.get(i).getTableEnName() != null && !voList.get(i).getTableEnName().equals("") && voList.get(i).getTableEnName().equals(modulex.getModuleEnName())) { //判断实体状态 if (status.equals("1") || status.equals("0") || status.equals("9")) { //判断版本状态 @@ -440,64 +445,65 @@ public class TablexController extends JeecgController { tablexList.add(tablex); - message.put("status", "正在上传"); - webSocketUtils.sendMessage(loginUser.getId(), message); - - //单条保存到真实表中 - tablexService.saveSingleBatch(tablexList, loginUser, message); - - message.put("status", "上传成功"); - message.put("closeable","true"); - webSocketUtils.sendMessage(loginUser.getId(), message); - } else { message.put("isError", "true"); - message.put("status","导入失败,第" + i + 1 + "行的版本号填写错误!"); + message.put("status","导入失败,第" + (i + 1) + "条的版本号填写错误!"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); - return Result.error("导入失败,第" + i + 1 + "行的版本号填写错误!"); + return Result.error("导入失败,第" + (i + 1) + "条的版本号填写错误!"); } } else { message.put("isError", "true"); - message.put("status","导入失败,第" + i + 1 + "行的版本状态填写错误!"); + message.put("status","导入失败,第" + (i + 1) + "条的版本状态填写错误!"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); - return Result.error("导入失败,第" + i + 1 + "行的版本状态填写错误!"); + return Result.error("导入失败,第" + (i + 1) + "条的版本状态填写错误!"); } } else { message.put("isError", "true"); - message.put("status","导入失败,第" + i + 1 + "行的实体状态填写错误!"); + message.put("status","导入失败,第" + (i + 1) + "条的实体状态填写错误!"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); - return Result.error("导入失败,第" + i + 1 + "行的实体状态填写错误!"); + return Result.error("导入失败,第" + (i + 1) + "条的实体状态填写错误!"); } } else { message.put("isError", "true"); - message.put("status","导入失败,第" + i + 1 + "行的英文名称填写错误!"); + message.put("status","导入失败,第" + (i + 1) + "条的英文名称填写错误!"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); - return Result.error("导入失败,第" + i + 1 + "行的英文名称填写错误!"); + return Result.error("导入失败,第" + (i + 1) + "条的英文名称填写错误!"); } } else { message.put("isError", "true"); - message.put("status","导入失败,第" + i + 1 + "行的中文名称填写错误!"); + message.put("status","导入失败,第" + (i + 1) + "条的中文名称填写错误!"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); - return Result.error("导入失败,第" + i + 1 + "行的中文名称填写错误!"); + return Result.error("导入失败,第" + (i + 1) + "条的中文名称填写错误!"); } } else { message.put("isError", "true"); - message.put("status","导入失败,第" + i + 1 + "行的对应模块填写错误!"); + message.put("status","导入失败,第" + (i + 1) + "条的对应模块填写错误!"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); - return Result.error("导入失败,第" + i + 1 + "行的对应模块填写错误!"); + return Result.error("导入失败,第" + (i + 1) + "条的对应模块填写错误!"); } } + message.put("status", "正在上传"); + webSocketUtils.sendMessage(loginUser.getId(), message); + + //保存到真实表中 + tablexService.saveSingleBatch(tablexList, loginUser, message); + + message.put("status", "上传成功"); + message.put("closeable","true"); + webSocketUtils.sendMessage(loginUser.getId(), message); + } catch (Exception e) { message.put("isError", "true"); message.put("status","文件导入失败"); message.put("closeable","true"); webSocketUtils.sendMessage(loginUser.getId(), message); + log.error(e.getMessage(),e); return Result.error("文件导入失败"); } return Result.ok("文件导入成功!"); diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/impl/TablexServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/impl/TablexServiceImpl.java index 1fad2b0..be1132c 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/impl/TablexServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/impl/TablexServiceImpl.java @@ -43,7 +43,7 @@ public class TablexServiceImpl extends ServiceImpl impleme public void saveSingleBatch(List tablexList, LoginUser loginUser, Map message) { for (int i = 0; i < tablexList.size(); i++){ try { - Thread.sleep(1000L); + Thread.sleep(3000L); message.put("uploaded", String.valueOf(i + 1)); this.save(tablexList.get(i)); webSocketUtils.sendMessage(loginUser.getId(), message);