!91 feat(excel): 导出模板自动生成示例数据行
* feat(excel): 导出模板自动生成示例数据行 * fix(excel): 字典导入兼容中英文逗号分隔多值,修复BgPartymatter导入Map.of参数错位 * fix(import): Excel导入时注入bpmStatus和delFlag默认值,避免新增记录缺少流程状态
This commit is contained in:
+4
-1
@@ -18,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.excel.ExcelAnnotationUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import org.jeecg.modules.bg.constant.BpmStatus;
|
||||
@@ -456,7 +457,9 @@ public class BgXiSpeakController extends JeecgController<BgXiSpeak, IBgXiSpeakSe
|
||||
@RequiresPermissions("bg.xispeak:bg_xi_speak:exportXls")
|
||||
@GetMapping(value = "/exportXlsHeaders")
|
||||
public void exportXlsHeaders(HttpServletResponse response) throws IOException {
|
||||
super.exportXlsHeadersByEasyExcel(response, BgXiSpeak.class, "习总书记重要讲话指示批示情况");
|
||||
BgXiSpeak example = ExcelAnnotationUtils.buildExample(BgXiSpeak.class);
|
||||
super.exportXlsWithData(response, BgXiSpeak.class, "习总书记重要讲话指示批示情况",
|
||||
java.util.Collections.singletonList(example));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+9
-4
@@ -10,6 +10,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.excel.ExcelAnnotationUtils;
|
||||
import org.jeecg.modules.bg.constant.BpmStatus;
|
||||
import org.jeecg.modules.bg.constant.SupervisionConstant;
|
||||
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeak;
|
||||
import org.jeecg.modules.demo.dqinspecttask.entity.DqInspectTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -466,10 +469,11 @@ public class BgPartymatterController extends JeecgController<BgPartymatter, IBgP
|
||||
return super.importExcelByEasyExcel(request, BgPartymatter.class,
|
||||
Map.of(
|
||||
BgPartymatterConstant.ClassFieldName.MEETING_TYPE_NAME, meetingType,
|
||||
BgPartymatterConstant.ClassFieldName.DEL_FLAG_NAME,
|
||||
BgPartymatterConstant.DelFlag.NORMAL));
|
||||
BgPartymatterConstant.ClassFieldName.DEL_FLAG_NAME, BgPartymatterConstant.DelFlag.NORMAL,
|
||||
SupervisionConstant.ClassFieldName.BPM_STATUS_NAME, BpmStatus.NOT_START.getCode()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过EasyExcel导出数据,根据 meetingType 动态切换标题
|
||||
*/
|
||||
@@ -482,14 +486,15 @@ public class BgPartymatterController extends JeecgController<BgPartymatter, IBgP
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅导出Excel表头(EasyExcel),通过 meetingType 参数指定模板类型
|
||||
* 导出Excel模板(含表头和一行示例数据),通过 meetingType 参数指定模板类型
|
||||
*/
|
||||
@RequiresPermissions("bgpartymatter:bg_partymatter:exportXls")
|
||||
@GetMapping(value = "/exportXlsHeaders")
|
||||
public void exportXlsHeaders(HttpServletResponse response,
|
||||
@RequestParam(defaultValue = "party") String meetingType) throws IOException {
|
||||
String title = BgPartymatterConstant.MeetingType.OFFICE.equals(meetingType) ? "所务会" : "党委会";
|
||||
super.exportXlsHeadersByEasyExcel(response, BgPartymatter.class, title);
|
||||
BgPartymatter example = ExcelAnnotationUtils.buildExample(BgPartymatter.class);
|
||||
super.exportXlsWithData(response, BgPartymatter.class, title, java.util.Collections.singletonList(example));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+13
-2
@@ -13,6 +13,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.jeecg.modules.bg.constant.BpmStatus;
|
||||
import org.jeecg.modules.bg.constant.SupervisionConstant;
|
||||
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeak;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
@@ -24,6 +27,7 @@ import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.excel.ExcelAnnotationUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.demo.bqtakepulse.dto.BgTakepulseBpmSaveDTO;
|
||||
import org.jeecg.modules.demo.bqtakepulse.entity.BgTakepulseFeedback;
|
||||
@@ -449,7 +453,12 @@ public class BgTakepulseController extends JeecgController<BgTakepulse, IBgTakep
|
||||
@RequiresPermissions("bqtakepulse:bg_takepulse:importExcel")
|
||||
@PostMapping(value = "/importExcelByEasyExcel")
|
||||
public Result<?> importExcelByEasyExcel(HttpServletRequest request) {
|
||||
return super.importExcelByEasyExcel(request, BgTakepulse.class);
|
||||
return super.importExcelByEasyExcel(request, BgTakepulse.class,
|
||||
Map.of(
|
||||
SupervisionConstant.ClassFieldName.BPM_STATUS_NAME,
|
||||
BpmStatus.NOT_START.getCode(),
|
||||
SupervisionConstant.ClassFieldName.DEL_FLAG_NAME,
|
||||
SupervisionConstant.DelFlag.NORMAL));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -468,7 +477,9 @@ public class BgTakepulseController extends JeecgController<BgTakepulse, IBgTakep
|
||||
@RequiresPermissions("bqtakepulse:bg_takepulse:exportXls")
|
||||
@GetMapping(value = "/exportXlsHeaders")
|
||||
public void exportXlsHeaders(HttpServletResponse response) throws IOException {
|
||||
super.exportXlsHeadersByEasyExcel(response, BgTakepulse.class, "我为四所把把脉");
|
||||
BgTakepulse example = ExcelAnnotationUtils.buildExample(BgTakepulse.class);
|
||||
super.exportXlsWithData(response, BgTakepulse.class, "我为四所把把脉",
|
||||
java.util.Collections.singletonList(example));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-1
@@ -23,6 +23,7 @@ import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.excel.ExcelAnnotationUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.modules.demo.dqinspecttask.entity.DqInspectProgress;
|
||||
@@ -354,7 +355,9 @@ public class DqInspectTaskController extends JeecgController<DqInspectTask, IDqI
|
||||
@RequiresPermissions("dqinspecttask:dq_inspect_task:exportXls")
|
||||
@GetMapping(value = "/exportXlsHeaders")
|
||||
public void exportXlsHeaders(HttpServletResponse response) throws IOException {
|
||||
super.exportXlsHeadersByEasyExcel(response, DqInspectTask.class, "dq_inspect_task");
|
||||
DqInspectTask example = ExcelAnnotationUtils.buildExample(DqInspectTask.class);
|
||||
super.exportXlsWithData(response, DqInspectTask.class, "dq_inspect_task",
|
||||
java.util.Collections.singletonList(example));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
-1
@@ -13,6 +13,9 @@ import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import org.jeecg.modules.bg.constant.BpmStatus;
|
||||
import org.jeecg.modules.bg.constant.SupervisionConstant;
|
||||
import org.jeecg.modules.demo.bqtakepulse.entity.BgTakepulse;
|
||||
import org.jeecg.modules.dj.inspectimprove.entity.DjInspectImprove;
|
||||
import org.jeecg.modules.dj.inspectimprove.service.IDjInspectImproveService;
|
||||
|
||||
@@ -310,7 +313,12 @@ public class DjInspectImproveController extends JeecgController<DjInspectImprove
|
||||
@RequiresPermissions("dj.inspectimprove:dj_inspect_improve:importExcel")
|
||||
@RequestMapping(value = "/importExcelByEasyExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcelByEasyExcel(HttpServletRequest request) {
|
||||
return super.importExcelByEasyExcel(request, DjInspectImprove.class);
|
||||
return super.importExcelByEasyExcel(request, DjInspectImprove.class,
|
||||
Map.of(
|
||||
SupervisionConstant.ClassFieldName.BPM_STATUS_NAME,
|
||||
BpmStatus.NOT_START.getCode(),
|
||||
SupervisionConstant.ClassFieldName.DEL_FLAG_NAME,
|
||||
SupervisionConstant.DelFlag.NORMAL));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user