update:修改社团管理导出,按sheet页导出不同信息

This commit is contained in:
sunzheng
2024-09-12 15:03:05 +08:00
parent a8bf4a69b3
commit 9947fc2299
9 changed files with 175 additions and 111 deletions
@@ -0,0 +1,24 @@
package com.jero.modules.laws.club.config;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.Workbook;
import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerDefaultImpl;
/**
* 自定义excel导出格式,让标题左对齐
*/
public class CustomExcelExportStyler extends ExcelExportStylerDefaultImpl {
public CustomExcelExportStyler(Workbook workbook) {
super(workbook);
}
// 设置标题的左对齐样式
@Override
public HSSFCellStyle getHeaderStyle(short color) {
HSSFCellStyle headerStyle = (HSSFCellStyle) super.getHeaderStyle(color);
headerStyle.setAlignment(HorizontalAlignment.LEFT); // 左对齐
return headerStyle;
}
}
@@ -45,9 +45,6 @@ public class LawsClub implements Serializable {
@Excel(name = "节点类型", width = 20)
private String nodeType;
@ApiModelProperty(value = "编号")
private String number;
@ApiModelProperty(value = "社团名称")
@Excel(name = "社团名称", width = 20)
private String clubName;
@@ -64,6 +61,10 @@ public class LawsClub implements Serializable {
@Excel(name = "联系电话", width = 20)
private String contactNumber;
@ApiModelProperty(value = "编号")
@Excel(name = "编号", width = 20)
private String number;
@ApiModelProperty(value = "0表示未删除,1表示删除")
@TableLogic(value = "0", delval = "1")
private Integer delFlag;
@@ -86,7 +87,7 @@ public class LawsClub implements Serializable {
@TableField(exist = false)
@ApiModelProperty(value = "入团信息列表数据")
@ExcelCollection(name = "入团信息")
// @ExcelCollection(name = "入团信息")
private List<LawsClubJoinTeam> lawsClubJoinTeamList;
@TableField(exist = false)
@@ -95,7 +96,7 @@ public class LawsClub implements Serializable {
@TableField(exist = false)
@ApiModelProperty(value = "参会信息列表数据")
@ExcelCollection(name = "参会信息")
// @ExcelCollection(name = "参会信息")
private List<LawsClubMeeting> lawsClubMeetings;
@TableField(exist = false)
@@ -104,7 +105,7 @@ public class LawsClub implements Serializable {
@TableField(exist = false)
@ApiModelProperty(value = "征集调研信息列表数据")
@ExcelCollection(name = "征集调研信息")
// @ExcelCollection(name = "征集调研信息")
private List<LawsClubResearchInformation> lawsClubResearchInformations;
@TableField(exist = false)
@@ -37,6 +37,7 @@ public class LawsClubJoinTeam implements Serializable {
private String id;
@ApiModelProperty(value = "社团id")
@Excel(name = "社团名称", width = 20, dicText = "club_name", dicCode = "id", dictTable = "laws_club")
private String clubId;
@ApiModelProperty(value = "入团日期")
@@ -47,12 +48,15 @@ public class LawsClubJoinTeam implements Serializable {
@ApiModelProperty(value = "社团职务担任者id")
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
@Excel(name = "社团职务担任者", width = 20, dicCode = "id", dicText= "realname",dictTable = "sys_user")
private String leadId;
@ApiModelProperty(value = "入团经费")
@Excel(name = "入团经费", width = 20)
private String joinCast;
@ApiModelProperty(value = "社团简介")
@Excel(name = "社团简介", width = 20)
private String clubProfile;
@ApiModelProperty(value = "部门id")
@@ -62,6 +66,7 @@ public class LawsClubJoinTeam implements Serializable {
@ApiModelProperty(value = "专业模块")
@Dict(dicCode = "professional_module")
@Excel(name = "专业模块", width = 20, dicCode = "professional_module")
private String specializedModule;
@ApiModelProperty(value = "申请人的id")
@@ -70,9 +75,11 @@ public class LawsClubJoinTeam implements Serializable {
private String proposerId;
@ApiModelProperty(value = "秘书处")
@Excel(name = "秘书处", width = 20)
private String secretariat;
@ApiModelProperty(value = "联系人")
@Excel(name = "联系人", width = 20)
private String contacts;
@ApiModelProperty(value = "备注")
@@ -15,6 +15,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import org.springframework.format.annotation.DateTimeFormat;
/**
@@ -39,6 +40,7 @@ public class LawsClubMeeting implements Serializable {
private String id;
@ApiModelProperty(value = "社团id")
@Excel(name = "社团名称", width = 20, dicText = "club_name", dicCode = "id", dictTable = "laws_club")
private String clubId;
@ApiModelProperty(value = "会议名称")
@@ -62,14 +64,17 @@ public class LawsClubMeeting implements Serializable {
@ApiModelProperty(value = "计划完成日期")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@Excel(name = "计划完成日期", width = 20, format = "yyyy-MM-dd")
private Date planCompletionDate;
@ApiModelProperty(value = "通知人id")
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
@Excel(name = "通知人", width = 20, dicCode = "id", dicText= "realname",dictTable = "sys_user")
private String notifierId;
@ApiModelProperty(value = "通知部门id")
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
@Excel(name = "通知部门", width = 20, dicText = "depart_name", dicCode = "id", dictTable = "sys_depart")
private String notifyDepartId;
@ApiModelProperty(value = "通知部门专业模块")
@@ -77,13 +82,16 @@ public class LawsClubMeeting implements Serializable {
private String informSpecializedModule;
@ApiModelProperty(value = "是否宣贯 0-否 1-是")
@Excel(name = "是否宣贯", width = 20, dicCode = "yn")
@Dict(dicCode = "yn")
private String isPublicize;
@ApiModelProperty(value = "会议组织人")
@Excel(name = "会议组织人", width = 20)
private String meetingOrganizer;
@ApiModelProperty(value = "会议内容")
@Excel(name = "会议内容", width = 20)
private String meetingContent;
@ApiModelProperty(value = "创建人")
@@ -104,6 +112,7 @@ public class LawsClubMeeting implements Serializable {
@TableField(exist = false)
@ApiModelProperty(value = "会议成员列表")
@ExcelCollection(name = "")
private List<LawsClubMeetingMember> meetingMemberList;
@@ -45,23 +45,23 @@ public class LawsClubMeetingMember implements Serializable {
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
private String memberId;
@ApiModelProperty(value = "参会部门专业模块")
@Excel(name = "参会部门专业模块", dicCode = "professional_module")
@Dict(dicCode = "professional_module")
private String meetingSpecializedModule;
@ApiModelProperty(value = "参会部门的id")
@Excel(name = "参会部门", width = 20, dicText = "depart_name", dicCode = "id", dictTable = "sys_depart")
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
private String departId;
@ApiModelProperty(value = "参会部门专业模块")
@Excel(name = "参会部门专业模块", dicCode = "professional_module")
@Dict(dicCode = "professional_module")
private String meetingSpecializedModule;
@ApiModelProperty(value = "参会报告文件id")
@Excel(name = "参会报告文件", width = 20, dictTable = "oss_file", dicCode = "id", dicText = "file_name")
@Dict(dictTable = "oss_file", dicCode = "id", dicText = "file_name")
private String meetingFileId;
@ApiModelProperty(value = "备注")
@Excel(name = "备注", width = 20)
private String remark;
@ApiModelProperty(value = "创建人")
@@ -37,6 +37,7 @@ public class LawsClubResearchInformation implements Serializable {
private String id;
@ApiModelProperty(value = "社团id")
@Excel(name = "社团名称", width = 20, dicText = "club_name", dicCode = "id", dictTable = "laws_club")
private String clubId;
@ApiModelProperty(value = "名称")
@@ -60,32 +61,44 @@ public class LawsClubResearchInformation implements Serializable {
private Date deadlineDate;
@ApiModelProperty(value = "专业接口人")
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
private String specializedInterfacePerson;
@ApiModelProperty(value = "专业模块")
@Excel(name = "专业模块", width = 20, dicCode = "professional_module")
@Dict(dicCode = "professional_module")
private String specializedModule;
@ApiModelProperty(value = "反馈人")
@Excel(name = "反馈人", width = 20, dicText = "realname", dicCode = "id", dictTable = "sys_user")
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
private String feedbackPerson;
@ApiModelProperty(value = "反馈部门")
@Excel(name = "反馈部门", width = 20, dicText = "depart_name", dicCode = "id", dictTable = "sys_depart")
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
private String feedbackDepart;
@ApiModelProperty(value = "反馈部门专业模块")
@Dict(dicCode = "professional_module")
@Excel(name = "反馈部门专业模块", width = 20, dicCode = "professional_module")
private String feedbackSpecializedModule;
@ApiModelProperty(value = "反馈情况")
@Excel(name = "反馈情况", width = 20)
private String feedbackSituation;
@ApiModelProperty(value = "任务来源 1:邮件 2:汽车标志数字化平台 3:其他")
@Dict(dicCode = "club_task_source")
@Excel(name = "任务来源", width = 20, dicCode = "club_task_source")
private String taskSource;
@ApiModelProperty(value = "盖章流程完成情况")
@Excel(name = "盖章流程完成情况", width = 20)
private String sealSituation;
@ApiModelProperty(value = "所属社团")
@Excel(name = "所属社团", width = 20)
private String clubName;
@ApiModelProperty(value = "创建人")
@@ -71,10 +71,8 @@ public class LawsCompanyStandardStatistics implements Serializable {
private String stage;
@ApiModelProperty(value = "领奖(领奖时间)")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@Excel(name = "领奖(领奖时间)", width = 15, format = "yyyy-MM-dd")
private Date awardTime;
@Excel(name = "领奖(领奖时间)", width = 15)
private String awardTime;
@ApiModelProperty(value = "所属工作组")
@Excel(name = "所属工作组", width = 15)
@@ -1,7 +1,6 @@
package com.jero.modules.laws.club.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -9,12 +8,11 @@ import com.jero.common.api.vo.Result;
import com.jero.common.api.vo.ResultCommon;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.util.*;
import com.jero.modules.laws.club.config.CustomExcelExportStyler;
import com.jero.modules.laws.club.entity.*;
import com.jero.modules.laws.club.mapper.LawsClubMapper;
import com.jero.modules.laws.club.service.*;
import com.jero.modules.laws.club.vo.LawsClubMeetingExcel;
import com.jero.modules.laws.club.vo.LawsClubTreeNodeModel;
import com.jero.modules.laws.club.vo.excel.*;
import com.jero.modules.system.entity.SysDepart;
@@ -26,6 +24,7 @@ import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@@ -194,28 +193,16 @@ public class LawsClubServiceImpl extends ServiceImpl<LawsClubMapper, LawsClub> i
@Override
public IPage<LawsClub> queryPageList(LawsClub lawsClub, Integer pageNo, Integer pageSize, HttpServletRequest req) {
String parentId = req.getParameter("parentId");
String parentId = lawsClub.getParentId();
if (StringUtils.isBlank(parentId)) {
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "parentId");
}
// 1. 查找 parentId 及所有子孙节点的 ID 列表
Set<String> descendantIds = findDescendantsIds(parentId);
// 2. 创建 LambdaQueryWrapper 来查询符合条件的记录
LambdaQueryWrapper<LawsClub> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.and(wrapper ->
wrapper.in(LawsClub::getParentId, descendantIds)
.or().eq(LawsClub::getId, parentId));
if (StringUtils.isNotBlank(lawsClub.getClubName())) {
lambdaQueryWrapper.like(LawsClub::getClubName, lawsClub.getClubName());
}
if (StringUtils.isNotBlank(lawsClub.getNodeType())) {
lambdaQueryWrapper.like(LawsClub::getNodeType, lawsClub.getNodeType());
}
lambdaQueryWrapper.orderByAsc(LawsClub::getCreateTime);
// 3. 执行分页查询
// 创建 LambdaQueryWrapper 来查询符合条件的记录
LambdaQueryWrapper<LawsClub> lawsClubQueryWrapper = createLawsClubQueryWrapper(lawsClub);
// 执行分页查询
Page<LawsClub> page = new Page<>(pageNo, pageSize);
Page<LawsClub> pageResult = page(page, lambdaQueryWrapper);
// 4. 解密联系方式
Page<LawsClub> pageResult = page(page, lawsClubQueryWrapper);
// 解密联系方式
List<LawsClub> records = pageResult.getRecords();
for (LawsClub record : records) {
// 解密联系方式
@@ -227,6 +214,30 @@ public class LawsClubServiceImpl extends ServiceImpl<LawsClubMapper, LawsClub> i
return pageResult;
}
private LambdaQueryWrapper<LawsClub> createLawsClubQueryWrapper(LawsClub lawsClub) {
// 构建查询条件
LambdaQueryWrapper<LawsClub> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(lawsClub.getParentId())) {
// 查找 parentId 及所有子孙节点的 ID 列表
Set<String> descendantIds = findDescendantsIds(lawsClub.getParentId());
lambdaQueryWrapper.and(wrapper ->
wrapper.in(LawsClub::getParentId, descendantIds)
.or().eq(LawsClub::getId, lawsClub.getParentId())
);
}
// 根据 clubName 模糊查询
if (StringUtils.isNotBlank(lawsClub.getClubName())) {
lambdaQueryWrapper.like(LawsClub::getClubName, lawsClub.getClubName());
}
// 根据 nodeType 模糊查询
if (StringUtils.isNotBlank(lawsClub.getNodeType())) {
lambdaQueryWrapper.like(LawsClub::getNodeType, lawsClub.getNodeType());
}
// 按照创建时间升序排序
lambdaQueryWrapper.orderByAsc(LawsClub::getCreateTime);
return lambdaQueryWrapper;
}
private Set<String> findDescendantsIds(String parentId) {
Set<String> ids = new HashSet<>();
List<LawsClub> allNodes = list(); // 获取所有节点
@@ -415,15 +426,17 @@ public class LawsClubServiceImpl extends ServiceImpl<LawsClubMapper, LawsClub> i
@Override
public ModelAndView exportAll(LawsClub lawsClub, HttpServletRequest request) {
// Step.1 组装查询条件
QueryWrapper<LawsClub> queryWrapper = QueryGenerator.initQueryWrapper(lawsClub, request.getParameterMap());
LambdaQueryWrapper<LawsClub> lawsClubQueryWrapper = createLawsClubQueryWrapper(lawsClub);
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
String selections = request.getParameter("selections");
if(!oConvertUtils.isEmpty(selections)){
queryWrapper.in("id", Arrays.asList(selections.split(",")));
lawsClubQueryWrapper.in(LawsClub::getId, Arrays.asList(selections.split(",")));
}
List<LawsClub> excelList = list(queryWrapper);
for (LawsClub club : excelList) {
List<LawsClub> clubList = list(lawsClubQueryWrapper);
List<LawsClubJoinTeam> lawsClubJoinTeams = new ArrayList<>();
List<LawsClubMeeting> lawsClubMeetings = new ArrayList<>();
List<LawsClubResearchInformation> lawsClubResearchInformations = new ArrayList<>();
for (LawsClub club : clubList) {
// 如果是根节点那么上级节点为空
if ("Part".equals(club.getParentId())) {
club.setParentId("-");
@@ -434,42 +447,82 @@ public class LawsClubServiceImpl extends ServiceImpl<LawsClubMapper, LawsClub> i
String encryptNumber = PasswordUtil.decrypt(contactNumber);
club.setContactNumber(encryptNumber);
}
List<LawsClubJoinTeam> lawsClubJoinTeams = lawsClubJoinTeamService.list(new LambdaQueryWrapper<LawsClubJoinTeam>().eq(LawsClubJoinTeam::getClubId, club.getId()));
List<LawsClubMeeting> lawsClubMeetings = lawsClubMeetingService.list(new LambdaQueryWrapper<LawsClubMeeting>().eq(LawsClubMeeting::getClubId, club.getId()));
List<LawsClubResearchInformation> lawsClubResearchInformations = lawsClubResearchInformationService.list(new LambdaQueryWrapper<LawsClubResearchInformation>().eq(LawsClubResearchInformation::getClubId, club.getId()));
club.setLawsClubMeetings(lawsClubMeetings);
club.setLawsClubJoinTeamList(lawsClubJoinTeams);
club.setLawsClubResearchInformations(lawsClubResearchInformations);
}
List<String> ids = clubList.stream().map(LawsClub::getId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(ids)) {
lawsClubJoinTeams = lawsClubJoinTeamService.list(new LambdaQueryWrapper<LawsClubJoinTeam>().in(LawsClubJoinTeam::getClubId, ids));
lawsClubMeetings = lawsClubMeetingService.list(new LambdaQueryWrapper<LawsClubMeeting>().in(LawsClubMeeting::getClubId, ids));
for (LawsClubMeeting lawsClubMeeting : lawsClubMeetings) {
List<LawsClubMeetingMember> memberList = lawsClubMeetingMemberService.list(new LambdaQueryWrapper<LawsClubMeetingMember>().eq(LawsClubMeetingMember::getMeetingId, lawsClubMeeting.getId()));
lawsClubMeeting.setMeetingMemberList(memberList);
}
lawsClubResearchInformations = lawsClubResearchInformationService.list(new LambdaQueryWrapper<LawsClubResearchInformation>().in(LawsClubResearchInformation::getClubId, ids));
}
//导出文件名称
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(JeroController.FILE_NAME, "社团管理信息");
mv.addObject(JeroController.CLASS, LawsClub.class);
ExportParams exportParams = new ExportParams("社团管理信息", "导出信息");
mv.addObject(JeroController.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, excelList);
List<Map<String, Object>> sheetList = new ArrayList<>();
// 基本信息
Map<String, Object> basicSheet = new HashMap<>();
basicSheet.put(NormalExcelConstants.DATA_LIST, clubList);
basicSheet.put(JeroController.CLASS, LawsClub.class);
basicSheet.put(JeroController.PARAMS, createExportParams("密级:核心商密□普通商密□内部资料■外部公开□", "基本信息"));
basicSheet.put(JeroController.FILE_NAME, "基本信息");
sheetList.add(basicSheet);
// 入团信息
Map<String, Object> joinTeamSheet = new HashMap<>();
joinTeamSheet.put(NormalExcelConstants.DATA_LIST, lawsClubJoinTeams);
joinTeamSheet.put(JeroController.CLASS, LawsClubJoinTeam.class);
joinTeamSheet.put(JeroController.PARAMS, createExportParams(null, "入团信息"));
joinTeamSheet.put(JeroController.FILE_NAME, "入团信息");
sheetList.add(joinTeamSheet);
// 参会信息
Map<String, Object> meetingSheet = new HashMap<>();
meetingSheet.put(NormalExcelConstants.DATA_LIST, lawsClubMeetings);
meetingSheet.put(JeroController.CLASS, LawsClubMeeting.class);
meetingSheet.put(JeroController.PARAMS, createExportParams(null, "参会信息"));
meetingSheet.put(JeroController.FILE_NAME, "参会信息");
sheetList.add(meetingSheet);
// 征集调研信息
Map<String, Object> researchSheet = new HashMap<>();
researchSheet.put(NormalExcelConstants.DATA_LIST, lawsClubResearchInformations);
researchSheet.put(JeroController.CLASS, LawsClubResearchInformation.class);
researchSheet.put(JeroController.PARAMS, createExportParams(null, "征集调研信息"));
researchSheet.put(JeroController.FILE_NAME, "征集调研信息");
sheetList.add(researchSheet);
mv.addObject(NormalExcelConstants.MAP_LIST, sheetList);
return mv;
}
private ExportParams createExportParams(String title, String sheetName) {
ExportParams exportParams = new ExportParams();
exportParams.setTitle(title);
exportParams.setType(ExcelType.HSSF);
exportParams.setSheetName(sheetName);
exportParams.setStyle(CustomExcelExportStyler.class); // 使用自定义的样式
return exportParams;
}
@Override
public ModelAndView exportTeamXls(LawsClub lawsClub, HttpServletRequest request) {
// Step.1 组装查询条件
QueryWrapper<LawsClub> queryWrapper = QueryGenerator.initQueryWrapper(lawsClub, request.getParameterMap());
LambdaQueryWrapper<LawsClub> lawsClubQueryWrapper = createLawsClubQueryWrapper(lawsClub);
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
String selections = request.getParameter("selections");
if(!oConvertUtils.isEmpty(selections)){
queryWrapper.in("id", Arrays.asList(selections.split(",")));
lawsClubQueryWrapper.in(LawsClub::getId, Arrays.asList(selections.split(",")));
}
List<LawsClub> list = list(queryWrapper);
List<LawsClub> list = list(lawsClubQueryWrapper);
List<String> ids = list.stream().map(LawsClub::getId).collect(Collectors.toList());
List<LawsClubJoinTeam> excelList = new ArrayList<>();
if (!CollectionUtils.isEmpty(ids)) {
excelList = lawsClubJoinTeamService.list(new LambdaQueryWrapper<LawsClubJoinTeam>().in(LawsClubJoinTeam::getClubId, ids));
}
//导出文件名称
mv.addObject(JeroController.FILE_NAME, "入团信息");
mv.addObject(JeroController.FILE_NAME, "入团信息统计表");
mv.addObject(JeroController.CLASS, LawsClubJoinTeam.class);
ExportParams exportParams = new ExportParams("入团信息", "导出信息");
ExportParams exportParams = new ExportParams(null, "入团信息");
mv.addObject(JeroController.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, excelList);
return mv;
@@ -478,31 +531,27 @@ public class LawsClubServiceImpl extends ServiceImpl<LawsClubMapper, LawsClub> i
@Override
public ModelAndView exportMeetingXls(LawsClub lawsClub, HttpServletRequest request) {
// Step.1 组装查询条件
QueryWrapper<LawsClub> queryWrapper = QueryGenerator.initQueryWrapper(lawsClub, request.getParameterMap());
LambdaQueryWrapper<LawsClub> lawsClubQueryWrapper = createLawsClubQueryWrapper(lawsClub);
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
String selections = request.getParameter("selections");
if(!oConvertUtils.isEmpty(selections)){
queryWrapper.in("id", Arrays.asList(selections.split(",")));
lawsClubQueryWrapper.in(LawsClub::getId, Arrays.asList(selections.split(",")));
}
List<LawsClub> list = list(queryWrapper);
List<LawsClub> list = list(lawsClubQueryWrapper);
List<String> ids = list.stream().map(LawsClub::getId).collect(Collectors.toList());
List<LawsClubMeeting> recordList = new ArrayList<>();
List<LawsClubMeetingExcel> excelList = new ArrayList<>();
List<LawsClubMeeting> excelList = new ArrayList<>();
if (!CollectionUtils.isEmpty(ids)) {
recordList = lawsClubMeetingService.list(new LambdaQueryWrapper<LawsClubMeeting>().in(LawsClubMeeting::getClubId, ids));
for (LawsClubMeeting lawsClubMeeting : recordList) {
excelList = lawsClubMeetingService.list(new LambdaQueryWrapper<LawsClubMeeting>().in(LawsClubMeeting::getClubId, ids));
for (LawsClubMeeting lawsClubMeeting : excelList) {
List<LawsClubMeetingMember> memberList = lawsClubMeetingMemberService.list(new LambdaQueryWrapper<LawsClubMeetingMember>().eq(LawsClubMeetingMember::getMeetingId, lawsClubMeeting.getId()));
lawsClubMeeting.setMeetingMemberList(memberList);
LawsClubMeetingExcel lawsClubMeetingExcel = new LawsClubMeetingExcel();
BeanUtils.copyProperties(lawsClubMeeting, lawsClubMeetingExcel);
excelList.add(lawsClubMeetingExcel);
}
}
//导出文件名称
mv.addObject(JeroController.FILE_NAME, "参会信息");
mv.addObject(JeroController.CLASS, LawsClubMeetingExcel.class);
ExportParams exportParams = new ExportParams("参会信息", "导出信息");
mv.addObject(JeroController.FILE_NAME, "参会记录表");
mv.addObject(JeroController.CLASS, LawsClubMeeting.class);
ExportParams exportParams = new ExportParams(null, "参会信息");
mv.addObject(JeroController.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, excelList);
return mv;
@@ -511,23 +560,23 @@ public class LawsClubServiceImpl extends ServiceImpl<LawsClubMapper, LawsClub> i
@Override
public ModelAndView exportresearchXls(LawsClub lawsClub, HttpServletRequest request) {
// Step.1 组装查询条件
QueryWrapper<LawsClub> queryWrapper = QueryGenerator.initQueryWrapper(lawsClub, request.getParameterMap());
LambdaQueryWrapper<LawsClub> lawsClubQueryWrapper = createLawsClubQueryWrapper(lawsClub);
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
String selections = request.getParameter("selections");
if(!oConvertUtils.isEmpty(selections)){
queryWrapper.in("id", Arrays.asList(selections.split(",")));
lawsClubQueryWrapper.in(LawsClub::getId, Arrays.asList(selections.split(",")));
}
List<LawsClub> list = list(queryWrapper);
List<LawsClub> list = list(lawsClubQueryWrapper);
List<String> ids = list.stream().map(LawsClub::getId).collect(Collectors.toList());
List<LawsClubResearchInformation> excelList = new ArrayList<>();
if (!CollectionUtils.isEmpty(ids)) {
excelList = lawsClubResearchInformationService.list(new LambdaQueryWrapper<LawsClubResearchInformation>().in(LawsClubResearchInformation::getClubId, ids));
}
//导出文件名称
mv.addObject(JeroController.FILE_NAME, "征集调研信");
mv.addObject(JeroController.FILE_NAME, "征集调研信记录表");
mv.addObject(JeroController.CLASS, LawsClubResearchInformation.class);
ExportParams exportParams = new ExportParams("征集调研信息", "征集调研信息");
ExportParams exportParams = new ExportParams(null, "征集调研信息");
mv.addObject(JeroController.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, excelList);
return mv;
@@ -1,37 +0,0 @@
package com.jero.modules.laws.club.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jero.modules.laws.club.entity.LawsClubMeetingMember;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
@Data
public class LawsClubMeetingExcel {
@ApiModelProperty(value = "会议名称")
@Excel(name = "会议名称", width = 20)
private String meetingName;
@ApiModelProperty(value = "会议日期")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@Excel(name = "会议日期", width = 20, format = "yyyy-MM-dd")
private Date meetingDate;
@ApiModelProperty(value = "会议费用")
@Excel(name = "会议费用", width = 20)
private String meetingCost;
@ApiModelProperty(value = "线下/线上地点")
@Excel(name = "线下/线上地点", width = 20)
private String meetingPlace;
@ApiModelProperty(value = "会议成员列表")
@ExcelCollection(name = "会议成员列表")
private List<LawsClubMeetingMember> meetingMemberList;
}