添加下载流程文件

This commit is contained in:
yangjun 2024-07-08 23:00:59 +08:00
parent 6af9133463
commit 7fd0c77d35
9 changed files with 72 additions and 27 deletions

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.demo.blTeacherAnswer.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
@ -12,6 +13,8 @@ import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.demo.blTeacherAnswer.entity.BlTeacherAnswer;
import org.jeecg.modules.demo.blTeacherAnswer.service.IBlTeacherAnswerService;
import org.jeecg.modules.demo.blTeacherInfo.entity.BlTeacherInfo;
import org.jeecg.modules.demo.blTeacherInfo.service.IBlTeacherInfoService;
import org.jeecg.modules.tools.word.ExportWord;
import org.jeecg.modules.tools.word.WordOperator;
import org.jeecgframework.poi.excel.ExcelImportUtil;
@ -42,6 +45,9 @@ import java.util.Map;
public class BlTeacherAnswerController extends JeecgController<BlTeacherAnswer, IBlTeacherAnswerService> {
@Autowired
private IBlTeacherAnswerService blTeacherAnswerService;
@Autowired
private IBlTeacherInfoService blTeacherInfoService;
/**
* 分页列表查询
@ -217,4 +223,23 @@ public class BlTeacherAnswerController extends JeecgController<BlTeacherAnswer,
ExportWord.download_word(request, response, "file.doc", wo);
}
@ApiOperation(value="生成教师问卷报表", notes="生成教师问卷报表")
@GetMapping(value = "/createWord")
public Result<String> createWord(@RequestParam(name="id",required=true) String id) throws Exception {
//直接导出附件
WordOperator wo = service.createWordTjfx(id);
BlTeacherInfo blTeacherInfo = blTeacherInfoService.getById(id);
//保存到本地附件里
String exportWordPath = ExportWord.wordPathToLocalFile(wo,"["+blTeacherInfo.getSchoolName()+"]-"+blTeacherInfo.getPgrq()+"-问卷分析情况.docx", "exportWords");
//保存到主表里
var updateWp = new UpdateWrapper<BlTeacherInfo>();
updateWp.lambda().eq(BlTeacherInfo::getId, id);
updateWp.lambda().set(BlTeacherInfo::getFilePath,exportWordPath);
blTeacherInfoService.update(updateWp);
return Result.OK("生成成功");
}
}

View File

@ -439,13 +439,6 @@ public class BlTeacherAnswerServiceImpl extends ServiceImpl<BlTeacherAnswerMappe
});
//----------------插入表格-----------------------
try {
tab33(wo, blTeacherMain);
}catch (Exception e){
e.printStackTrace();
}
calls.forEach(threadService::submit);
calls.forEach(fn -> {
try {

View File

@ -88,9 +88,9 @@ public class BlTeacherInfoController extends JeecgController<BlTeacherInfo, IBlT
@AutoLog(value = "教师调研报告-添加")
@ApiOperation(value="教师调研报告-添加", notes="教师调研报告-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BlTeacherInfo blTeacherInfo) {
public Result<BlTeacherInfo> add(@RequestBody BlTeacherInfo blTeacherInfo) {
blTeacherInfoService.save(blTeacherInfo);
return Result.OK("添加成功!");
return Result.OK(blTeacherInfo);
}
/**

View File

@ -81,5 +81,9 @@ public class BlTeacherInfo implements Serializable {
@ApiModelProperty(value = "最小样有效本数")
private Integer minNum;
/**附件*/
@Excel(name = "附件", width = 15)
@ApiModelProperty(value = "附件")
private java.lang.String filePath;
}

View File

@ -307,6 +307,11 @@ justauth:
type: default
prefix: 'demo::'
timeout: 1h
# libreOffice5
libreOffice:
url: 127.0.0.1
port: 8100
# 浏览器调用
webDriver:
driverName: webdriver.chrome.driver

View File

@ -6,10 +6,10 @@ VITE_PUBLIC_PATH = /
# 跨域代理,您可以配置多个 ,请注意,没有换行符
VITE_PROXY = [["/jeecgboot","http://localhost:8080/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
VITE_PROXY = [["/jeecgboot","http://localhost:8083/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
#后台接口全路径地址(必填)
VITE_GLOB_DOMAIN_URL=http://localhost:8080/jeecg-boot
VITE_GLOB_DOMAIN_URL=http://localhost:8083/jeecg-boot
#后台接口父地址(必填)
VITE_GLOB_API_URL=/jeecgboot

View File

@ -40,11 +40,19 @@ export const columns: BasicColumn[] = [
dataIndex: 'minNum'
},
{
title: '导入',
title: '是否生成报告',
align: "center",
dataIndex: 'dysd',
slots: { customRender: 'importXlsBtn' },
dataIndex: 'filePath',
customRender: (text) => {
return text ? '是' : '否'
}
},
// {
// title: '导入',
// align: "center",
// dataIndex: 'dysd',
// slots: { customRender: 'importXlsBtn' },
// },
];
//查询数据

View File

@ -24,8 +24,9 @@
<BasicTable @register="registerTable" >
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 下载导出模板</a-button>
<!-- <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> -->
<a-button type="primary" @click="handleV2Add" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 下载导入模板</a-button>
<!-- <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> -->
</template>
<!--操作栏-->
@ -40,6 +41,7 @@
</BasicTable>
<!-- 表单区域 -->
<BlTeacherInfoModal ref="registerModal" @success="handleSuccess"></BlTeacherInfoModal>
<BlTeacherInfoV2Modal ref="registerV2Modal" @success="handleSuccess"></BlTeacherInfoV2Modal>
</div>
</template>
@ -51,6 +53,7 @@
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './BlTeacherInfo.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import BlTeacherInfoModal from './components/BlTeacherInfoModal.vue'
import BlTeacherInfoV2Modal from './components/BlTeacherInfoV2Modal.vue'
import { useUserStore } from '/@/store/modules/user';
import { useMethods } from '/@/hooks/system/useMethods';
import { useMessage } from '/@/hooks/web/useMessage';
@ -64,6 +67,7 @@ const $message = useMessage();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const registerV2Modal = ref();
const userStore = useUserStore();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
@ -123,6 +127,11 @@ const $message = useMessage();
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
function handleV2Add(){
registerV2Modal.value.disableSubmit = true;
registerV2Modal.value.add();
}
/**
* 编辑事件
@ -202,18 +211,19 @@ const $message = useMessage();
*/
function getTableAction(record) {
return [
// {
// label: '',
// onClick: handleEdit.bind(null, record),
// },
{
label: '编辑',
onClick: handleEdit.bind(null, record),
label: '下载报告',
onClick: downloadFile.bind(null, record.filePath),
},
// {
// label: '',
// onClick: handleDetail.bind(null, record),
// },
{
label: '报表',
onClick: handleTjfx.bind(null, record),
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',

View File

@ -148,10 +148,10 @@
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
createMessage.success("操作成功");
emit('ok');
} else {
createMessage.warning(res.message);
createMessage.warning("操作失败");
}
})
.finally(() => {