Compare commits

..

No commits in common. 'c4fb53431f2ea25fc3336cde5c64e238171e30bb' and 'afde28d93dad86f1287a9c1eb4e2e14d91fca2a6' have entirely different histories.

  1. 74
      ant-design-vue-jeecg/src/views/modulex/ModulexList.vue
  2. 98
      ant-design-vue-jeecg/src/views/modulex/modules/ModulexImport.vue
  3. 93
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java
  4. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/impl/TablexServiceImpl.java

@ -72,8 +72,7 @@
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<!-- <a-button type="primary" @click="showModal1()"></a-button> --> <!-- <a-button type="primary" @click="showModal1()"></a-button> -->
<a-button type="primary" icon="import" @click="showModalImport()">导入模块</a-button> <a-button type="primary" icon="import" @click="showModalImport()">导入模块</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
@change="handleImportExcel">
<a-modal <a-modal
title="正在上传..." title="正在上传..."
:visible="ModalData.isVisible==='true'" :visible="ModalData.isVisible==='true'"
@ -94,12 +93,10 @@
</a-modal> </a-modal>
<a-button type="primary" icon="import" @click="showProcess">导入模块</a-button> <a-button type="primary" icon="import" @click="showProcess">导入模块</a-button>
</a-upload> </a-upload>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="functionImportExcelUrl" @change="handleImportExcel">
:action="functionImportExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入功能</a-button> <a-button type="primary" icon="import">导入功能</a-button>
</a-upload> </a-upload>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="ruleImportExcelUrl" @change="handleImportExcel">
:action="ruleImportExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import" @click="showProcess">导入规则</a-button> <a-button type="primary" icon="import" @click="showProcess">导入规则</a-button>
<a-modal <a-modal
@ -122,13 +119,10 @@
</a-modal> </a-modal>
</a-upload> </a-upload>
<!-- <a-upload name="file" :showUploadList="false" :multiple="false" <a-upload name="file" :showUploadList="false" :multiple="false"
:headers="tokenHeader" :action="tablexImportExcelUrl" @change="handleImportExcel">--> :headers="tokenHeader" :action="tablexImportExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import" <a-button type="primary" icon="import" @click="showProcess">导入实体</a-button>
@click="showProcess( 1)">导入实体 <a-modal
</a-button>
<!-- <a-button type="primary" icon="import" @click="showModalImport()">导入实体</a-button>-->
<!-- <a-modal
title="正在上传..." title="正在上传..."
:visible="ModalData.isVisible==='true'" :visible="ModalData.isVisible==='true'"
:confirm-loading="false" :confirm-loading="false"
@ -145,14 +139,13 @@
:percent="parseInt(String(ModalData.uploaded/ModalData.records*100))" :percent="parseInt(String(ModalData.uploaded/ModalData.records*100))"
title="上传进度:" title="上传进度:"
status="active" :steps="ModalData.records"/> status="active" :steps="ModalData.records"/>
</a-modal>--> </a-modal>
<!-- </a-upload>--> </a-upload>
<a-button @click="fanhui" type="primary" icon="rollback">返回</a-button> <a-button @click="fanhui" type="primary" icon="rollback">返回</a-button>
<a-button type="primary" icon="download" @click="exportxsxl('模块,功能,规则表')">导出综合表</a-button> <a-button type="primary" icon="download" @click="exportxsxl('模块,功能,规则表')">导出综合表</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrlf" <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrlf" @change="handleImportExcel">
@change="handleImportExcel">
<a-button type="primary" icon="import">导入字段</a-button> <a-button type="primary" icon="import">导入字段</a-button>
</a-upload> </a-upload>
</div> </div>
@ -269,7 +262,6 @@ import {filterObj} from "@/utils/util"
import FieldxList from "@views/fieldx/FieldxList.vue" import FieldxList from "@views/fieldx/FieldxList.vue"
import TablexList from "@views/tablex/TablexList.vue" import TablexList from "@views/tablex/TablexList.vue"
import axios from 'axios'; import axios from 'axios';
export default { export default {
name: 'ModulexList', name: 'ModulexList',
mixins: [JeecgListMixin, mixinDevice], mixins: [JeecgListMixin, mixinDevice],
@ -486,7 +478,6 @@ export default {
importExcelUrl: "modulex/modulex/importExcel", importExcelUrl: "modulex/modulex/importExcel",
functionImportExcelUrl: "/functionx/functionx/importExcel", functionImportExcelUrl: "/functionx/functionx/importExcel",
tablexImportExcelUrl: "tablex/tablex/importExcel", tablexImportExcelUrl: "tablex/tablex/importExcel",
tablexDownExcelUrl: "tablex/tablex/templateExcel",
ruleImportExcelUrl: "rulex/rulex/importExcel", ruleImportExcelUrl: "rulex/rulex/importExcel",
exportxsxl: "modulex/modulex/exportxsxl" exportxsxl: "modulex/modulex/exportxsxl"
}, },
@ -505,7 +496,7 @@ export default {
this.loginRole(usercode) this.loginRole(usercode)
//console.log('userole1',this.userRole1) //console.log('userole1',this.userRole1)
this.getSuperFieldList() this.getSuperFieldList()
/* this.showProcess()*/ this.showProcess()
}, },
computed: { computed: {
importExcelUrl: function () { importExcelUrl: function () {
@ -524,48 +515,29 @@ export default {
tablexImportExcelUrl: function(){ tablexImportExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.tablexImportExcelUrl}`; return `${window._CONFIG['domianURL']}/${this.url.tablexImportExcelUrl}`;
}, },
tablexDownExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.tablexDownExcelUrl}`;
},
ruleImportExcelUrl: function () { ruleImportExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.ruleImportExcelUrl}` return `${window._CONFIG['domianURL']}/${this.url.ruleImportExcelUrl}`
}, },
}, },
methods: { methods: {
showModalImport(){
this.$refs.moduleximport.edit();
// this.$refs.moduleximport.title = "111111";
this.$refs.moduleximport.disableSubmit = false;
},
// //
showProcess(type) { showProcess(){
let data = {
uploadUrl: '',
downUrl: '',
title: '',
note: []
}
switch (type) {
case 1: {
data.note = ['对应模块id(必填):填写正确的模块名称',
'中文名称(必填):与模块名称相同。',
'英文名称(必填):与模块名称相同,写模块名称的英文名称。',
'结构图(选填):类图或E-R图,可以为空,不填写。',
'实体状态:可填入值为[正常、停用、废弃],若不填写,默认为“正常”状态。',
'版本状态: 可填入值为[当前、历史],若不填写,默认为“当前”状态',
'版本号:请填写小与五位数的正整数'
]
data.title = '导入实体'
data.uploadUrl = this.tablexImportExcelUrl
data.downUrl = this.tablexDownExcelUrl
break;
}
default: {
return
}
}
let userId = store.getters.userInfo.id let userId = store.getters.userInfo.id
let base_url = window._CONFIG['domianURL'] let base_url = window._CONFIG['domianURL']
base_url = base_url.replace('http', 'ws') base_url = base_url.replace('http', 'ws')
let ws = new WebSocket(`${base_url}/uploadProcess/${userId}`) let ws = new WebSocket(`${base_url}/uploadProcess/${userId}`)
this.$refs.moduleximport.show(data);
ws.onmessage = (e) =>{ ws.onmessage = (e) =>{
this.$refs.moduleximport.edit(JSON.parse(e.data)); this.ModalData=JSON.parse(e.data)
if (this.visible===false) {
// this.getList()
console.log("重新获取列表")
}
} }
}, },
// //

@ -11,28 +11,22 @@
<a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 16 }" > <a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 16 }" >
<!-- <a-alert message="请下载" type="info" show-icon /> --> <!-- <a-alert message="请下载" type="info" show-icon /> -->
<a-form-item label="下载标准表格"> <a-form-item label="下载标准表格">
<div class="standB"> <div class="standB"><a-button type="primary" icon="download" @click="handleDownload"/></div>
<a-button type="primary" icon="download" @click="handleDownload"/> <div class="standBu"> <a-alert
</div>
<div class="standBu">
<a-alert
message="必须下载标准表格,否则审核不通过" message="必须下载标准表格,否则审核不通过"
type="error" type="error"
closable closable
@close="onClose" @close="onClose"
/> /></div>
</div>
</a-form-item> </a-form-item>
<a-form-item label="上传标准表格"> <a-form-item label="上传标准表格">
<a-upload name="file" <!-- @click="showProcess" -->
<a-upload
:multiple="false" :multiple="false"
:action="url.uploadUrl" action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
:showUploadList="false" @change="handleChange">
:headers="tokenHeader">
<a-button type="primary" icon="upload" ></a-button> <a-button type="primary" icon="upload" ></a-button>
</a-upload> <!-- <div>
</a-form-item>
<a-form-item v-if="ModalData.isVisible==='true'" class="box">
<p>当前状态{{ ModalData.status }}</p> <p>当前状态{{ ModalData.status }}</p>
<p>总记录数{{ ModalData.records }}</p> <p>总记录数{{ ModalData.records }}</p>
<p>已上传{{ ModalData.uploaded }}</p> <p>已上传{{ ModalData.uploaded }}</p>
@ -41,14 +35,12 @@
title="上传进度:" title="上传进度:"
status="active" status="active"
:steps="ModalData.records"/> :steps="ModalData.records"/>
</div> -->
</a-upload>
</a-form-item> </a-form-item>
<!-- <a-form-model-item label="注意事项" v-if="uploadFinished">--> <a-form-model-item label="注意事项" v-if="uploadFinished">
<a-form-model-item label="注意事项">
<a-list size="small" :data-source="datas"> <a-list size="small" :data-source="datas">
<a-list-item slot="renderItem" slot-scope="item,index" style="border-bottom:0px ;"> {{ index + 1 }} . {{ <a-list-item slot="renderItem" slot-scope="item,index" style="border-bottom:0px ;"> {{ index+1 }} . {{ item }}</a-list-item>
item
}}
</a-list-item>
</a-list> </a-list>
</a-form-model-item> </a-form-model-item>
</a-form> </a-form>
@ -56,18 +48,16 @@
</template> </template>
<script> <script>
import {getAction} from "@api/manage" import getAction from '@api/manage'
import store from '@/store' import store from '@/store'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import {mixinDevice} from '@/utils/mixin'
export default { export default {
name: 'ModelTest', name: 'ModelTest',
mixins: [JeecgListMixin, mixinDevice], comments: {
comments: {},
},
data() { data() {
return { return {
title: '导入xxxxx', title: '导入xxxxxx',
visible: false, visible: false,
model: {}, model: {},
// //
@ -82,9 +72,7 @@ export default {
form: this.$form.createForm(this), form: this.$form.createForm(this),
url: url:
{ {
downfile: '', downfile: ''
uploadUrl: '',
list: "/modulex/modulex/list"
}, },
datas: [ datas: [
'Racing car sprays burning fuel into crowd.', 'Racing car sprays burning fuel into crowd.',
@ -93,16 +81,16 @@ export default {
'Man charged over missing wedding girl.', 'Man charged over missing wedding girl.',
'Los Angeles battles huge wildfires.' 'Los Angeles battles huge wildfires.'
] ]
} }
}, },
created() { created() {
}, },
computed: {}, computed: {
},
methods: { methods: {
// //
// //
/* showProcess() { showProcess() {
let userId = store.getters.userInfo.id let userId = store.getters.userInfo.id
let baseUrl = window._CONFIG['domianURL'] let baseUrl = window._CONFIG['domianURL']
baseUrl = baseUrl.replace('http', 'ws') baseUrl = baseUrl.replace('http', 'ws')
@ -110,7 +98,7 @@ export default {
ws.onmessage = (e) => { ws.onmessage = (e) => {
this.ModalData = JSON.parse(e.data) this.ModalData = JSON.parse(e.data)
} }
},*/ },
// //
handleChange(info) { handleChange(info) {
if (info.file.status !== 'uploading') { if (info.file.status !== 'uploading') {
@ -129,34 +117,23 @@ export default {
}, },
// //
handleDownload() { handleDownload() {
// getAction(this.url.list, params).then((res) => console.log(1111)
getAction(this.url.downfile).then((response) => { // getAction(this.url.downfile).then(response => {
const url = window.URL.createObjectURL(new Blob([response.data])) // const url = window.URL.createObjectURL(new Blob([response.data]))
const link = document.createElement('a') // const link = document.createElement('a')
link.href = url // link.href = url
link.setAttribute('download', 'your-document.pdf') // link.setAttribute('download', 'your-document.pdf')
document.body.appendChild(link) // document.body.appendChild(link)
link.click() // link.click()
}) // })
.catch(error => { // .catch(error => {
console.error(error) // console.error(error)
}) // })
}, },
add() { add() {
},
show(data) {
this.url.uploadUrl = data.uploadUrl
this.url.downfile = data.downUrl
this.datas=data.note
this.title=data.title
this.ModalData = {}
this.visible = true
}, },
edit(record) { edit(record) {
this.ModalData = record
},
edit1(record) {
this.visible = true this.visible = true
}, },
@ -184,15 +161,8 @@ export default {
width: 15%; width: 15%;
float: left; float: left;
} }
.standBu{ .standBu{
width: 85%; width: 85%;
float: right; float: right;
} }
.box{
display: flex;
flex-direction:column;
justify-content:center;
align-items: center;
}
</style> </style>

@ -1,7 +1,5 @@
package org.jeecg.modules.tablex.controller; package org.jeecg.modules.tablex.controller;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.io.IOException; import java.io.IOException;
@ -42,16 +40,12 @@ import org.jeecg.modules.tablex.vo.TablexVo;
import org.jeecg.modules.tablex.ws.WebSocketUtils; import org.jeecg.modules.tablex.ws.WebSocketUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.def.TemplateExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.TemplateExportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecgframework.poi.excel.view.JeecgTemplateExcelView;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -92,9 +86,6 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
@Autowired @Autowired
private WebSocketUtils webSocketUtils; private WebSocketUtils webSocketUtils;
@Value("${jeecg.wordPath}")
private String wordPath;
/** /**
* 分页列表查询 * 分页列表查询
* *
@ -300,7 +291,7 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
if (StringUtils.isBlank(originalFilename) || if (StringUtils.isBlank(originalFilename) ||
(!originalFilename.endsWith("xls") && (!originalFilename.endsWith("xls") &&
!originalFilename.endsWith("xlsx"))) { !originalFilename.endsWith("xlsx"))) {
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件格式不正确"); return Result.error("文件格式不正确");
} }
@ -317,13 +308,13 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
//读取excel数据 //读取excel数据
list = ExcelImportUtil.importExcel(file.getInputStream(), TablexVo.class, params); list = ExcelImportUtil.importExcel(file.getInputStream(), TablexVo.class, params);
} catch (Exception e) { } catch (Exception e) {
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件读取失败"); return Result.error("文件读取失败");
} }
//判断文件中是否存在数据 //判断文件中是否存在数据
if (list == null || list.size() == 0) { if (list == null || list.size() == 0) {
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("Excel数据为空"); return Result.error("Excel数据为空");
} }
@ -332,37 +323,36 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
for (TablexVo tablexVo : list) { for (TablexVo tablexVo : list) {
//判断当前存入行是否为空值 //判断当前存入行是否为空值
if (StringUtils.isBlank(tablexVo.getModuleId()) && if (tablexVo.getModuleId() == null &&
StringUtils.isBlank(tablexVo.getTableName()) && tablexVo.getTableName() == null &&
StringUtils.isBlank(tablexVo.getTableEnName()) && tablexVo.getTableEnName() == null &&
StringUtils.isBlank(tablexVo.getTableStructure()) && tablexVo.getTableStructure() == null &&
StringUtils.isBlank(tablexVo.getStructuralDiagram()) && tablexVo.getStructuralDiagram() == null &&
StringUtils.isBlank(tablexVo.getStatus()) && tablexVo.getStatus() == null &&
StringUtils.isBlank(tablexVo.getVerisonStatus()) && tablexVo.getVerisonStatus() == null &&
StringUtils.isBlank(tablexVo.getVerison())) { tablexVo.getVerison() == null) continue;
list.remove(tablexVo); // 将总的记录数传递给前端
continue; message.put("records", String.valueOf(list.size()));
} webSocketUtils.sendMessage(loginUser.getId(), message);
//判断版本号长度 //判断版本号长度
String verison = tablexVo.getVerison(); String verison = tablexVo.getVerison();
if (verison.length() > 5) { if (verison.length() > 5) {
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("预读入失败,版本号格式错误"); return Result.error("预读入失败,版本号格式错误");
} }
//存入临时表中 //存入临时表中
tablexVoService.save(tablexVo); tablexVoService.save(tablexVo);
} }
//从临时表中取出数据 //从临时表中取出数据
List<TablexVo> voList = tablexVoService.list(); List<TablexVo> voList = tablexVoService.list();
// 将总的记录数传递给前端
message.put("records", String.valueOf(voList.size()));
webSocketUtils.sendMessage(loginUser.getId(), message);
//删除临时表中的数据 //删除临时表中的数据
tablexVoService.removeAll(voList); tablexVoService.removeAll(voList);
if (voList.size() == 0) { if (voList.size() == 0) {
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,数据为空"); return Result.error("导入失败,数据为空");
} }
@ -376,7 +366,7 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
String moduleId = voList.get(i).getModuleId(); String moduleId = voList.get(i).getModuleId();
if (moduleId == null || moduleId.equals("")){ if (moduleId == null || moduleId.equals("")){
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("对应模块填写不能为空"); return Result.error("对应模块填写不能为空");
} }
@ -384,7 +374,7 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
queryWrapper.eq(Modulex::getId,moduleId); queryWrapper.eq(Modulex::getId,moduleId);
Modulex modulex = modulexService.getOne(queryWrapper); Modulex modulex = modulexService.getOne(queryWrapper);
if(modulex == null){ if(modulex == null){
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("对应模块填写错误"); return Result.error("对应模块填写错误");
} }
@ -426,70 +416,43 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
tablexService.saveSingleBatch(tablexList,loginUser,message); tablexService.saveSingleBatch(tablexList,loginUser,message);
} else { } else {
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + i + 1 + "行的版本号填写错误!"); return Result.error("导入失败,第" + i + 1 + "行的版本号填写错误!");
} }
} else { } else {
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + i + 1 + "行的版本状态填写错误!"); return Result.error("导入失败,第" + i + 1 + "行的版本状态填写错误!");
} }
} else { } else {
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + i + 1 + "行的实体状态填写错误!"); return Result.error("导入失败,第" + i + 1 + "行的实体状态填写错误!");
} }
} else { } else {
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + i + 1 + "行的英文名称填写错误!"); return Result.error("导入失败,第" + i + 1 + "行的英文名称填写错误!");
} }
} else { } else {
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + i + 1 + "行的中文名称填写错误!"); return Result.error("导入失败,第" + i + 1 + "行的中文名称填写错误!");
} }
} else { } else {
/*message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + i + 1 + "行的对应模块填写错误!"); return Result.error("导入失败,第" + i + 1 + "行的对应模块填写错误!");
} }
} }
} catch (Exception e) { } catch (Exception e) {
/* message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件导入失败"); return Result.error("文件导入失败");
} }
/*message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.ok("文件导入成功!"); return Result.ok("文件导入成功!");
} }
//导出实体标准模板
@RequestMapping(value = "/templateExcel")
public ModelAndView wbsExcelTemplate(HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> map = new HashMap<String, Object>();
//设置导出文件名称
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date(System.currentTimeMillis());
String currTime = formatter.format(date);
String fileName = currTime + "-" + "模板.xlsx";
try {
String url = getClass().getClassLoader().getResource("static").getPath();
// 模板存放地址 这里写的地址根本拿不到 在其他人的电脑上
String templateUrl = wordPath + File.separator + "实体表模板.xls";
TemplateExportParams params = new TemplateExportParams(
templateUrl);
ModelAndView mv = new ModelAndView(new JeecgTemplateExcelView());
mv.addObject(TemplateExcelConstants.FILE_NAME, fileName);
mv.addObject(TemplateExcelConstants.PARAMS, params);
// 添加模板参数
mv.addObject(TemplateExcelConstants.MAP_DATA, map); //data
return mv;
} catch (Exception e) {
log.error("下载模板异常--》{}", e);
}
return null;
}
} }

@ -48,7 +48,7 @@ public class TablexServiceImpl extends ServiceImpl<TablexMapper, Tablex> impleme
this.save(tablexList.get(i)); this.save(tablexList.get(i));
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
} catch (InterruptedException e) { } catch (InterruptedException e) {
/*message.put("isVisible", "false");*/ message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }

Loading…
Cancel
Save