From 710fa7ca2381f408549cf7999877caefb884a473 Mon Sep 17 00:00:00 2001 From: sunzheng Date: Sat, 12 Oct 2024 18:53:38 +0800 Subject: [PATCH] =?UTF-8?q?update:=E4=BF=AE=E6=94=B9=E7=A4=BE=E5=9B=A2?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=AA=8C=E6=94=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/laws/club/entity/LawsClub.java | 4 + .../laws/club/mapper/LawsClubMapper.java | 5 + .../laws/club/mapper/xml/LawsClubMapper.xml | 30 +++++ .../impl/LawsClubMeetingServiceImpl.java | 6 +- .../service/impl/LawsClubServiceImpl.java | 118 +++++++++++++----- .../LawsClubWorkingGroupFileServiceImpl.java | 6 +- ...sCompanyStandardStatisticsServiceImpl.java | 18 +-- 7 files changed, 141 insertions(+), 46 deletions(-) diff --git a/laws-modules/src/main/java/com/jero/modules/laws/club/entity/LawsClub.java b/laws-modules/src/main/java/com/jero/modules/laws/club/entity/LawsClub.java index a568960e..239ed8c3 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/club/entity/LawsClub.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/club/entity/LawsClub.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.*; import java.io.Serializable; import java.util.Date; import java.util.List; +import java.util.Set; import com.fasterxml.jackson.annotation.JsonFormat; import com.jero.common.aspect.annotation.Dict; import io.swagger.annotations.ApiModel; @@ -107,4 +108,7 @@ public class LawsClub implements Serializable { @TableField(exist = false) @ApiModelProperty(value = "公钥") private String rsaPublicKey; + + @TableField(exist = false) + private Set descendantIds; } diff --git a/laws-modules/src/main/java/com/jero/modules/laws/club/mapper/LawsClubMapper.java b/laws-modules/src/main/java/com/jero/modules/laws/club/mapper/LawsClubMapper.java index 627c320a..9fd3a8a2 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/club/mapper/LawsClubMapper.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/club/mapper/LawsClubMapper.java @@ -2,8 +2,12 @@ package com.jero.modules.laws.club.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.jero.modules.laws.club.entity.LawsClub; +import java.util.Set; + /** *

* 社团管理表 Mapper 接口 @@ -14,4 +18,5 @@ import com.jero.modules.laws.club.entity.LawsClub; */ public interface LawsClubMapper extends BaseMapper { + IPage queryPageList(Page page, LawsClub lawsClub); } diff --git a/laws-modules/src/main/java/com/jero/modules/laws/club/mapper/xml/LawsClubMapper.xml b/laws-modules/src/main/java/com/jero/modules/laws/club/mapper/xml/LawsClubMapper.xml index c4f3a86e..840042e3 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/club/mapper/xml/LawsClubMapper.xml +++ b/laws-modules/src/main/java/com/jero/modules/laws/club/mapper/xml/LawsClubMapper.xml @@ -2,4 +2,34 @@ + diff --git a/laws-modules/src/main/java/com/jero/modules/laws/club/service/impl/LawsClubMeetingServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/club/service/impl/LawsClubMeetingServiceImpl.java index debdb337..f4e27bf4 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/club/service/impl/LawsClubMeetingServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/club/service/impl/LawsClubMeetingServiceImpl.java @@ -338,7 +338,11 @@ public class LawsClubMeetingServiceImpl extends ServiceImpl i private IOSSFileService iossFileService; @Resource private ISysUserService sysUserService; + @Resource + private LawsClubMapper lawsClubMapper; @Override public List getTreeStructure(String parentId, String nodeType) { @@ -210,11 +212,11 @@ public class LawsClubServiceImpl extends ServiceImpl i if (StringUtils.isBlank(parentId)) { throw new JeroBootException(ResultCommon.EMPTY_COMMON, "parentId"); } - // 创建 LambdaQueryWrapper 来查询符合条件的记录 - LambdaQueryWrapper lawsClubQueryWrapper = createLawsClubQueryWrapper(lawsClub); + Set descendantIds = findDescendantsIds(lawsClub.getParentId()); + lawsClub.setDescendantIds(descendantIds); // 执行分页查询 Page page = new Page<>(pageNo, pageSize); - Page pageResult = page(page, lawsClubQueryWrapper); + IPage pageResult = lawsClubMapper.queryPageList(page, lawsClub); // 解密联系方式 List records = pageResult.getRecords(); for (LawsClub record : records) { @@ -448,12 +450,21 @@ public class LawsClubServiceImpl extends ServiceImpl i @Override public void exportAll(LawsClub lawsClub, HttpServletRequest request, HttpServletResponse response) { - LambdaQueryWrapper lawsClubQueryWrapper = createLawsClubQueryWrapper(lawsClub); + String parentId = lawsClub.getParentId(); + if (!StringUtils.isBlank(parentId)) { + Set descendantIds = findDescendantsIds(lawsClub.getParentId()); + lawsClub.setDescendantIds(descendantIds); + } + Page page = new Page<>(-1, -1); + IPage pageResult = lawsClubMapper.queryPageList(page, lawsClub); + List clubList = pageResult.getRecords(); String selections = request.getParameter("selections"); if(!oConvertUtils.isEmpty(selections)){ - lawsClubQueryWrapper.in(LawsClub::getId, Arrays.asList(selections.split(","))); + List selectionIds = Arrays.asList(selections.split(",")); + clubList = clubList.stream() + .filter(club -> selectionIds.contains(club.getId())) + .collect(Collectors.toList()); } - List clubList = list(lawsClubQueryWrapper); List lawsClubJoinTeams = new ArrayList<>(); List lawsClubMeetings = new ArrayList<>(); List lawsClubPayments = new ArrayList<>(); @@ -568,14 +579,23 @@ public class LawsClubServiceImpl extends ServiceImpl i @Override public ModelAndView exportTeamXls(LawsClub lawsClub, HttpServletRequest request) { - LambdaQueryWrapper lawsClubQueryWrapper = createLawsClubQueryWrapper(lawsClub); ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + String parentId = lawsClub.getParentId(); + if (!StringUtils.isBlank(parentId)) { + Set descendantIds = findDescendantsIds(lawsClub.getParentId()); + lawsClub.setDescendantIds(descendantIds); + } + Page page = new Page<>(-1, -1); + IPage pageResult = lawsClubMapper.queryPageList(page, lawsClub); + List clubList = pageResult.getRecords(); String selections = request.getParameter("selections"); if(!oConvertUtils.isEmpty(selections)){ - lawsClubQueryWrapper.in(LawsClub::getId, Arrays.asList(selections.split(","))); + List selectionIds = Arrays.asList(selections.split(",")); + clubList = clubList.stream() + .filter(club -> selectionIds.contains(club.getId())) + .collect(Collectors.toList()); } - List list = list(lawsClubQueryWrapper); - List ids = list.stream().map(LawsClub::getId).collect(Collectors.toList()); + List ids = clubList.stream().map(LawsClub::getId).collect(Collectors.toList()); List excelList = new ArrayList<>(); if (!CollectionUtils.isEmpty(ids)) { excelList = lawsClubJoinTeamService.list(new LambdaQueryWrapper().in(LawsClubJoinTeam::getClubId, ids)); @@ -590,14 +610,23 @@ public class LawsClubServiceImpl extends ServiceImpl i @Override public ModelAndView exportPaymentXls(LawsClub lawsClub, HttpServletRequest request) { - LambdaQueryWrapper lawsClubQueryWrapper = createLawsClubQueryWrapper(lawsClub); ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + String parentId = lawsClub.getParentId(); + if (!StringUtils.isBlank(parentId)) { + Set descendantIds = findDescendantsIds(lawsClub.getParentId()); + lawsClub.setDescendantIds(descendantIds); + } + Page page = new Page<>(-1, -1); + IPage pageResult = lawsClubMapper.queryPageList(page, lawsClub); + List clubList = pageResult.getRecords(); String selections = request.getParameter("selections"); if(!oConvertUtils.isEmpty(selections)){ - lawsClubQueryWrapper.in(LawsClub::getId, Arrays.asList(selections.split(","))); + List selectionIds = Arrays.asList(selections.split(",")); + clubList = clubList.stream() + .filter(club -> selectionIds.contains(club.getId())) + .collect(Collectors.toList()); } - List list = list(lawsClubQueryWrapper); - List ids = list.stream().map(LawsClub::getId).collect(Collectors.toList()); + List ids = clubList.stream().map(LawsClub::getId).collect(Collectors.toList()); List excelList = new ArrayList<>(); if (!CollectionUtils.isEmpty(ids)) { excelList = lawsClubPaymentService.list(new LambdaQueryWrapper().in(LawsClubPayment::getClubId, ids)); @@ -612,13 +641,23 @@ public class LawsClubServiceImpl extends ServiceImpl i @Override public void exportMeetingXls(LawsClub lawsClub, HttpServletRequest request, HttpServletResponse response) { - LambdaQueryWrapper lawsClubQueryWrapper = createLawsClubQueryWrapper(lawsClub); + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + String parentId = lawsClub.getParentId(); + if (!StringUtils.isBlank(parentId)) { + Set descendantIds = findDescendantsIds(lawsClub.getParentId()); + lawsClub.setDescendantIds(descendantIds); + } + Page page = new Page<>(-1, -1); + IPage pageResult = lawsClubMapper.queryPageList(page, lawsClub); + List clubList = pageResult.getRecords(); String selections = request.getParameter("selections"); if(!oConvertUtils.isEmpty(selections)){ - lawsClubQueryWrapper.in(LawsClub::getId, Arrays.asList(selections.split(","))); + List selectionIds = Arrays.asList(selections.split(",")); + clubList = clubList.stream() + .filter(club -> selectionIds.contains(club.getId())) + .collect(Collectors.toList()); } - List list = list(lawsClubQueryWrapper); - List ids = list.stream().map(LawsClub::getId).collect(Collectors.toList()); + List ids = clubList.stream().map(LawsClub::getId).collect(Collectors.toList()); List excelList = new ArrayList<>(); List fileIdList = new ArrayList<>(); if (!CollectionUtils.isEmpty(ids)) { @@ -660,15 +699,23 @@ public class LawsClubServiceImpl extends ServiceImpl i @Override public void exportWorkingGroupFileXls(LawsClub lawsClub, HttpServletRequest request, HttpServletResponse response) { - // Step.1 组装查询条件 - LambdaQueryWrapper lawsClubQueryWrapper = createLawsClubQueryWrapper(lawsClub); - //Step.2 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + String parentId = lawsClub.getParentId(); + if (!StringUtils.isBlank(parentId)) { + Set descendantIds = findDescendantsIds(lawsClub.getParentId()); + lawsClub.setDescendantIds(descendantIds); + } + Page page = new Page<>(-1, -1); + IPage pageResult = lawsClubMapper.queryPageList(page, lawsClub); + List clubList = pageResult.getRecords(); String selections = request.getParameter("selections"); if(!oConvertUtils.isEmpty(selections)){ - lawsClubQueryWrapper.in(LawsClub::getId, Arrays.asList(selections.split(","))); + List selectionIds = Arrays.asList(selections.split(",")); + clubList = clubList.stream() + .filter(club -> selectionIds.contains(club.getId())) + .collect(Collectors.toList()); } - List list = list(lawsClubQueryWrapper); - List ids = list.stream().map(LawsClub::getId).collect(Collectors.toList()); + List ids = clubList.stream().map(LawsClub::getId).collect(Collectors.toList()); List excelList = new ArrayList<>(); if (!CollectionUtils.isEmpty(ids)) { excelList = lawsClubWorkingGroupFileService.list(new LambdaQueryWrapper().in(LawsClubWorkingGroupFile::getClubId, ids)); @@ -702,16 +749,23 @@ public class LawsClubServiceImpl extends ServiceImpl i @Override public ModelAndView exportresearchXls(LawsClub lawsClub, HttpServletRequest request) { - // Step.1 组装查询条件 - LambdaQueryWrapper lawsClubQueryWrapper = createLawsClubQueryWrapper(lawsClub); - //Step.2 AutoPoi 导出Excel ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + String parentId = lawsClub.getParentId(); + if (!StringUtils.isBlank(parentId)) { + Set descendantIds = findDescendantsIds(lawsClub.getParentId()); + lawsClub.setDescendantIds(descendantIds); + } + Page page = new Page<>(-1, -1); + IPage pageResult = lawsClubMapper.queryPageList(page, lawsClub); + List clubList = pageResult.getRecords(); String selections = request.getParameter("selections"); if(!oConvertUtils.isEmpty(selections)){ - lawsClubQueryWrapper.in(LawsClub::getId, Arrays.asList(selections.split(","))); + List selectionIds = Arrays.asList(selections.split(",")); + clubList = clubList.stream() + .filter(club -> selectionIds.contains(club.getId())) + .collect(Collectors.toList()); } - List list = list(lawsClubQueryWrapper); - List ids = list.stream().map(LawsClub::getId).collect(Collectors.toList()); + List ids = clubList.stream().map(LawsClub::getId).collect(Collectors.toList()); List excelList = new ArrayList<>(); if (!CollectionUtils.isEmpty(ids)) { excelList = lawsClubResearchInformationService.list(new LambdaQueryWrapper().in(LawsClubResearchInformation::getClubId, ids)); @@ -834,10 +888,10 @@ public class LawsClubServiceImpl extends ServiceImpl i if (StringUtils.isNotBlank(lawsClubExcel.getClubContact()) && lawsClubExcel.getClubContact().length() > 50) { msgSub.append(getErrorMsg(i, "社团联系人长度不能超过50;")); } - // 校验联系方式 + // 校验联系电话 String contactNumber = lawsClubExcel.getContactNumber(); if (StringUtils.isNotBlank(contactNumber) && !contactNumber.matches("^(?:(0\\d{2,3}-)?\\d{7,8}|1[3-9]\\d{9})$")) { - msgSub.append(getErrorMsg(i, "联系方式格式不正确;")); + msgSub.append(getErrorMsg(i, "联系电话格式不正确;")); } else { lawsClubExcel.setContactNumber(PasswordUtil.encrypt(contactNumber)); } diff --git a/laws-modules/src/main/java/com/jero/modules/laws/club/service/impl/LawsClubWorkingGroupFileServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/club/service/impl/LawsClubWorkingGroupFileServiceImpl.java index 0258ac31..74238f25 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/club/service/impl/LawsClubWorkingGroupFileServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/club/service/impl/LawsClubWorkingGroupFileServiceImpl.java @@ -214,7 +214,11 @@ public class LawsClubWorkingGroupFileServiceImpl extends ServiceImpl queryPageList(LawsCompanyStandardStatistics lawsCompanyStandardStatistics, Integer pageNo, Integer pageSize, HttpServletRequest req) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(lawsCompanyStandardStatistics, req.getParameterMap()); String standardNumberOrName = lawsCompanyStandardStatistics.getStandardNumberOrName(); - String stage = lawsCompanyStandardStatistics.getStage(); - String standardDrafter = lawsCompanyStandardStatistics.getStandardDrafter(); if (StringUtils.isNotBlank(standardNumberOrName)) { - lambdaQueryWrapper.and(wrapper -> wrapper.like(LawsCompanyStandardStatistics::getStandardNumber, standardNumberOrName).or() - .like(LawsCompanyStandardStatistics::getStandardName, standardNumberOrName)); - } - if (StringUtils.isNotBlank(stage)) { - lambdaQueryWrapper.eq(LawsCompanyStandardStatistics::getStage, stage); - } - if (StringUtils.isNotBlank(standardDrafter)) { - lambdaQueryWrapper.like(LawsCompanyStandardStatistics::getStandardDrafter, standardDrafter); + queryWrapper.and(wrapper -> wrapper.like("standard_number", standardNumberOrName).or() + .like("standard_name", standardNumberOrName)); } Page page = new Page<>(pageNo, pageSize); - Page result = page(page, lambdaQueryWrapper); + Page result = page(page, queryWrapper); return result; }