From 844b3dd99f375c8705cc9877489395889596d857 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Sat, 16 Dec 2023 15:58:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hz/pm/api/common/constant/CommonConst.java | 2 +- .../helper/basic/AbstractRegionCacheHelper.java | 6 +- .../common/helper/impl/RegionsCacheHelperImpl.java | 5 + .../com/hz/pm/api/common/model/entity/DataDTO.java | 1 + .../hz/pm/api/common/util/FreemarkerWordUtil.java | 8 +- .../java/com/hz/pm/api/common/util/GzipUtil.java | 66 ++ .../java/com/hz/pm/api/common/util/GzipUtils.java | 89 --- .../api/dashboard/manage/FundStatisticsManage.java | 173 +++-- .../model/vo/EarlyWarningStatisticsVO.java | 1 - .../hz/pm/api/ding/task/GovBusinessStripsTask.java | 19 +- .../pm/api/expert/helper/ExpertManageHelper.java | 21 +- .../com/hz/pm/api/expert/manage/ExpertManage.java | 25 +- .../expert/service/impl/ExpertInfoServiceImpl.java | 10 +- .../controller/GovProjectCollectionController.java | 6 +- .../api/gov/manage/GovProjectCollectionManage.java | 781 +++++++++++---------- .../api/gov/model/dto/GovBizProjectApplyDTO.java | 1 - .../api/gov/model/dto/GovBizProjectApproveDTO.java | 1 - .../gov/model/dto/GovBizProjectBaseinfoDTO.java | 1 - .../gov/model/dto/GovBizProjectCimplementDTO.java | 1 - .../gov/model/dto/GovBizProjectMimplementDTO.java | 1 - .../api/gov/model/dto/GovBizProjectProcureDTO.java | 1 - .../pm/api/gov/model/dto/GovBizProjectSaveDTO.java | 1 - .../gov/model/entity/GovBizProjectBaseinfo.java | 1 - .../pm/api/meeting/manage/ExpertInviteManage.java | 8 +- .../service/impl/ExpertInviteRuleServiceImpl.java | 1 - .../meta/helper/basic/AbstractDictionaryCache.java | 17 +- .../api/meta/helper/basic/AbstractTagsCache.java | 8 +- .../api/meta/helper/impl/DictionaryCacheImpl.java | 5 + .../hz/pm/api/meta/helper/impl/TagsCacheImpl.java | 5 + .../controller/GovBusinessStripController.java | 1 - .../helper/impl/GovBusinessStripHelperImpl.java | 9 +- .../manage/GovBusinessStripManage.java | 1 - .../hz/pm/api/performance/manage/VerifyManage.java | 184 +++-- .../model/dto/AddAppraisalObjectDTO.java | 14 +- .../contants/DeclaredProjectConst.java | 79 +++ .../contants/DeclaredProjectContant.java | 52 -- .../manage/DeclaredProjectManage.java | 8 +- .../manage/FinalAcceptanceManage.java | 54 +- .../manage/ReviewChecklistManage.java | 22 +- .../model/dto/DeclaredProjectExportDTO.java | 4 +- .../utils/GenerateProjectCodeUtil.java | 41 +- .../controller/AnnualPlanController.java | 4 +- .../pm/api/projectlib/handle/AnnualPlanHandle.java | 13 +- .../api/projectlib/manage/AnnualPlanLibManage.java | 83 +-- .../projectlib/model/dto/AnnualLibImportDTO.java | 1 - .../model/entity/AnalysisEventMonitor.java | 9 +- .../com/hz/pm/api/provincial/utils/FileUtil.java | 32 - .../com/hz/pm/api/scheduler/utils/DateUtil.java | 37 - .../hz/pm/api/sys/manage/EarlyWarningManage.java | 256 +++---- .../auth/agent/AgentAuthSecurityConfig.java | 53 +- .../user/security/auth/agent/AgentAuthToken.java | 1 - 51 files changed, 1069 insertions(+), 1154 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtil.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtils.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectConst.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectContant.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/provincial/utils/FileUtil.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/scheduler/utils/DateUtil.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/CommonConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/CommonConst.java index d81257d..2cbff53 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/CommonConst.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/constant/CommonConst.java @@ -7,7 +7,7 @@ package com.hz.pm.api.common.constant; */ public interface CommonConst { - String COOKIE_KEY = "ND_JSESSION"; + String COOKIE_KEY = "HZPM_JSESSION"; Integer EXPORT_PAGE_NUMBER = 1; Integer EXPORT_PAGE_SIZE = 100000; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/basic/AbstractRegionCacheHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/basic/AbstractRegionCacheHelper.java index 701401b..23eab78 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/basic/AbstractRegionCacheHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/basic/AbstractRegionCacheHelper.java @@ -8,9 +8,9 @@ import com.hz.pm.api.sys.convert.RegionConverter; import com.hz.pm.api.sys.model.dto.RegionDTO; import com.hz.pm.api.sys.model.entity.Region; import com.hz.pm.api.sys.service.IRegionService; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; import java.util.List; import java.util.Objects; @@ -25,12 +25,12 @@ import java.util.concurrent.TimeUnit; * @since 14:41 2023/3/1 */ @Slf4j +@RequiredArgsConstructor public abstract class AbstractRegionCacheHelper implements InitializingBean { private static final String PARENT_CODE_ROOT = "-1"; - @Autowired - private IRegionService regionService; + private final IRegionService regionService; protected LoadingCache regionsCache; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionsCacheHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionsCacheHelperImpl.java index 20a1c0b..16c775e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionsCacheHelperImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionsCacheHelperImpl.java @@ -2,6 +2,7 @@ package com.hz.pm.api.common.helper.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.text.StrPool; +import com.hz.pm.api.sys.service.IRegionService; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.CollUtils; import com.hz.pm.api.common.constant.RegionConst; @@ -30,6 +31,10 @@ import java.util.stream.Collectors; @Component public class RegionsCacheHelperImpl extends AbstractRegionCacheHelper implements RegionCacheHelper { + public RegionsCacheHelperImpl(IRegionService regionService) { + super(regionService); + } + @Override public RegionDTO getByCodeAndLevel(String code, Integer level) { if (StringUtils.isBlank(code) || Objects.isNull(level)) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/DataDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/DataDTO.java index ced9cbc..40b338b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/DataDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/DataDTO.java @@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; + import java.math.BigDecimal; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java index a117069..f97097f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java @@ -1,10 +1,10 @@ package com.hz.pm.api.common.util; import cn.hutool.core.io.IoUtil; -import com.ningdatech.basic.exception.BizException; import com.hz.pm.api.common.model.FreemarkerBatchExportDTO; import com.hz.pm.api.meeting.entity.dto.ExpertFeeExportDTO; import com.hz.pm.api.meeting.entity.dto.ExpertInfoDTO; +import com.ningdatech.basic.exception.BizException; import freemarker.template.Configuration; import freemarker.template.Template; import freemarker.template.TemplateException; @@ -40,7 +40,7 @@ public class FreemarkerWordUtil { try { fileNameEncoded = URLEncoder.encode(fileName, "UTF-8"); } catch (UnsupportedEncodingException e) { - throw new RuntimeException("文件名编码异常"); + throw new BizException("文件名编码异常"); } response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileNameEncoded); } @@ -67,7 +67,9 @@ public class FreemarkerWordUtil { File outFile = new File(filePath + File.separator + fileName); //如果输出目标文件夹不存在,则创建 if (!outFile.getParentFile().exists()) { - boolean ignore = outFile.getParentFile().mkdirs(); + if (outFile.getParentFile().mkdirs()) { + log.info("创建文件目录:{}", outFile.getParentFile().getAbsolutePath()); + } } //将模板和数据模型合并生成文件 Writer out = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(outFile.toPath()), StandardCharsets.UTF_8)); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtil.java new file mode 100644 index 0000000..a8df87f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtil.java @@ -0,0 +1,66 @@ +package com.hz.pm.api.common.util; + +import cn.hutool.core.util.StrUtil; +import com.ningdatech.basic.exception.BizException; +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +/** + *

+ * gzip压缩工具类 + *

+ * + * @author WendyYang + */ +public class GzipUtil { + + private GzipUtil() { + } + + /** + * 使用gzip进行压缩 + */ + public static String zip(String content) { + if (StrUtil.isBlank(content)) { + return content; + } + try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); + GZIPOutputStream gzip = new GZIPOutputStream(bos)) { + gzip.write(content.getBytes()); + gzip.finish(); + byte[] bytes = bos.toByteArray(); + return new BASE64Encoder().encode(bytes); + } catch (IOException e) { + throw new BizException(e); + } + } + + /** + * 使用gzip进行解压缩 + */ + public static String unzip(String content) { + if (StrUtil.isBlank(content)) { + return content; + } + BASE64Decoder decoder = new BASE64Decoder(); + try (ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(content)); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + GZIPInputStream gis = new GZIPInputStream(bis)) { + byte[] buffer = new byte[1024 * 16]; + int offset; + while ((offset = gis.read(buffer)) != -1) { + bos.write(buffer, 0, offset); + } + return bos.toString(); + } catch (IOException e) { + throw new BizException(e); + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtils.java deleted file mode 100644 index 1a3cf74..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtils.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.hz.pm.api.common.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - -/** - *

- * 压缩为Gzip - *

- * - * @author WendyYang - */ -public class GzipUtils { - /** - * 使用gzip进行压缩 - */ - public static String compress(String primStr) { - if (primStr == null || primStr.length() == 0) { - return primStr; - } - ByteArrayOutputStream out = new ByteArrayOutputStream(); - GZIPOutputStream gzip = null; - try { - gzip = new GZIPOutputStream(out); - gzip.write(primStr.getBytes()); - } catch (IOException e) { - throw new RuntimeException(e); - } finally { - if (gzip != null) { - try { - gzip.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - } - return new sun.misc.BASE64Encoder().encode(out.toByteArray()); - } - - /** - * 使用gzip进行解压缩 - */ - public static String uncompress(String compressedStr) { - if (compressedStr == null) { - return null; - } - ByteArrayOutputStream out = new ByteArrayOutputStream(); - ByteArrayInputStream in = null; - GZIPInputStream ginzip = null; - byte[] compressed = null; - String decompressed = null; - try { - compressed = new sun.misc.BASE64Decoder().decodeBuffer(compressedStr); - in = new ByteArrayInputStream(compressed); - ginzip = new GZIPInputStream(in); - - byte[] buffer = new byte[1024]; - int offset = -1; - while ((offset = ginzip.read(buffer)) != -1) { - out.write(buffer, 0, offset); - } - decompressed = out.toString(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - if (ginzip != null) { - try { - ginzip.close(); - } catch (IOException e) { - } - } - if (in != null) { - try { - in.close(); - } catch (IOException e) { - } - } - try { - out.close(); - } catch (IOException e) { - } - } - return decompressed; - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/FundStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/FundStatisticsManage.java index bd7f81b..9377bc5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/FundStatisticsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/FundStatisticsManage.java @@ -19,6 +19,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; + import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.*; @@ -48,13 +49,14 @@ public class FundStatisticsManage { private final IGovBizProjectProcureService procureService; - private Integer[] years = new Integer[]{2021,2022,2023,2024,2025}; + private Integer[] years = new Integer[]{2021, 2022, 2023, 2024, 2025}; - private Integer[] threeYears = new Integer[]{LocalDateTime.now().getYear()-2, - LocalDateTime.now().getYear()-1,LocalDateTime.now().getYear()}; + private Integer[] threeYears = new Integer[]{LocalDateTime.now().getYear() - 2, + LocalDateTime.now().getYear() - 1, LocalDateTime.now().getYear()}; /** * 项目统计 + * * @param year * @return */ @@ -64,7 +66,7 @@ public class FundStatisticsManage { CompletableFuture.allOf( CompletableFuture.runAsync(() -> { //选择的年份去计算的数据 - yearCompleteAmount(res,year); + yearCompleteAmount(res, year); }, ForkJoinPool.commonPool()), CompletableFuture.runAsync(() -> { //近三年 @@ -81,6 +83,7 @@ public class FundStatisticsManage { /** * 计算 所有年的 + * * @param res */ private void allYearsCompleteAmount(FundStatisticsVO res) { @@ -97,34 +100,35 @@ public class FundStatisticsManage { List allProjIds = allApplieYears.stream().map(GovBizProjectApply::getBaseProjId) .collect(Collectors.toList()); - List allBaseInfos = Lists.newArrayList(); + List allBaseInfos; List allApplies = Lists.newArrayList(); List allApproves = Lists.newArrayList(); List allProcures = Lists.newArrayList(); - if(CollUtil.isNotEmpty(allProjIds)){ + if (CollUtil.isNotEmpty(allProjIds)) { allBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .in(GovBizProjectBaseinfo::getBaseProjId,allProjIds)); - if(CollUtil.isNotEmpty(allBaseInfos)){ + .in(GovBizProjectBaseinfo::getBaseProjId, allProjIds)); + if (CollUtil.isNotEmpty(allBaseInfos)) { List allBaseProjIds = allBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) .collect(Collectors.toList()); allApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,allBaseProjIds)); + .in(GovBizProjectApply::getBaseProjId, allBaseProjIds)); allApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId,allBaseProjIds)); + .in(GovBizProjectApprove::getBaseProjId, allBaseProjIds)); allProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId,allBaseProjIds)); + .in(GovBizProjectProcure::getBaseProjId, allBaseProjIds)); } } //2.4 累积 核减 - res.setAccumulatedDeductionTotalAmount(completeDeductionAmount(allProjects,allApplies, - allApproves,allProcures)); + res.setAccumulatedDeductionTotalAmount(completeDeductionAmount(allProjects, allApplies, + allApproves, allProcures)); } /** * 计算核减资金的方法 + * * @param projects * @param applies * @param approves @@ -132,7 +136,7 @@ public class FundStatisticsManage { * @return */ private BigDecimal completeDeductionAmount(List projects, - List applies, List approves, + List applies, List approves, List procures) { //首先完成年度计划 并且未注销的项目 List normalProjects = projects.stream().filter(p -> { @@ -143,46 +147,37 @@ public class FundStatisticsManage { return Boolean.FALSE; }).collect(Collectors.toList()); //计划核减 - FundStatisticsVO.HeJianAmount planHejian = computePlanHeJian(normalProjects,applies,approves); + FundStatisticsVO.HeJianAmount planHejian = computePlanHeJian(normalProjects, applies, approves); //批复核减 - FundStatisticsVO.HeJianAmount approvalHejian = computeApprovalHeJian(normalProjects,approves,planHejian.getApproval()); + FundStatisticsVO.HeJianAmount approvalHejian = computeApprovalHeJian(normalProjects, approves, planHejian.getApproval()); //合同核减 - FundStatisticsVO.HeJianAmount contractHejian = computeContractHeJian(normalProjects,procures,approvalHejian.getApproval()); + FundStatisticsVO.HeJianAmount contractHejian = computeContractHeJian(normalProjects, procures, approvalHejian.getApproval()); return planHejian.getDiff().add(approvalHejian.getDiff()).add(contractHejian.getDiff()); } //计算 计划阶段的 核减金额 private FundStatisticsVO.HeJianAmount computePlanHeJian(List projects, List applies, - List approves) { + List approves) { FundStatisticsVO.HeJianAmount heJianAmount = new FundStatisticsVO.HeJianAmount(); //申报的申报金额(申报项目:初步方案申报金额 项目归集:项目总投资) final BigDecimal[] declaredAmountApprove = {BigDecimal.ZERO}; - projects.stream().map(p -> { - BigDecimal declareAmount = Objects.nonNull(p.getDeclareAmount()) ? - p.getDeclareAmount() : BigDecimal.ZERO; - return declareAmount; - }).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApprove[0] = b); + projects.stream().map(p -> Objects.nonNull(p.getDeclareAmount()) ? p.getDeclareAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> declaredAmountApprove[0] = b); final BigDecimal[] declaredAmountApproveGov = {BigDecimal.ZERO}; - applies.stream().map(g -> { - BigDecimal totalAmount = Objects.nonNull(g.getBaseProjTotalAmount()) ? g.getBaseProjTotalAmount() : BigDecimal.ZERO; - return totalAmount; - }).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApproveGov[0] = b); + applies.stream().map(g -> Objects.nonNull(g.getBaseProjTotalAmount()) ? g.getBaseProjTotalAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> declaredAmountApproveGov[0] = b); BigDecimal declaredAmountApproveTotal = declaredAmountApprove[0].add(declaredAmountApproveGov[0]); heJianAmount.setApprove(declaredAmountApproveTotal); //申报的批复金额(申报项目:建设方案申报金额 项目归集:建议总投资) final BigDecimal[] approvalAmountApprove = {BigDecimal.ZERO}; - projects.stream().map(p -> { - BigDecimal declareAmount = Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO; - return declareAmount; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprove[0] = b); + projects.stream().map(p -> Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprove[0] = b); final BigDecimal[] approvalAmountApproveGov = {BigDecimal.ZERO}; - approves.stream().map(p -> { - BigDecimal expertTotalMoney = Objects.nonNull(p.getBaseExpertTotalMoney()) ? p.getBaseExpertTotalMoney() : BigDecimal.ZERO; - return expertTotalMoney; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproveGov[0] = b); + approves.stream().map(p -> Objects.nonNull(p.getBaseExpertTotalMoney()) ? p.getBaseExpertTotalMoney() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproveGov[0] = b); BigDecimal approvalAmountApproveTotal = approvalAmountApprove[0].add(approvalAmountApproveGov[0]); heJianAmount.setApproval(approvalAmountApproveTotal); //申报的差额 @@ -192,21 +187,17 @@ public class FundStatisticsManage { } //计算 批复阶段的 核减金额 - private FundStatisticsVO.HeJianAmount computeApprovalHeJian(List projects,List approves, - BigDecimal approvalAmountApproveTotal){ + private FundStatisticsVO.HeJianAmount computeApprovalHeJian(List projects, List approves, + BigDecimal approvalAmountApproveTotal) { FundStatisticsVO.HeJianAmount approvalHejian = new FundStatisticsVO.HeJianAmount(); approvalHejian.setApprove(approvalAmountApproveTotal); //批复的批复金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) final BigDecimal[] approvalAmountApproval = {BigDecimal.ZERO}; - projects.stream().map(p -> { - BigDecimal proposeTotalInvest = Objects.nonNull(p.getProposeTotalInvest()) ? p.getProposeTotalInvest() : BigDecimal.ZERO; - return proposeTotalInvest; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproval[0] = b); + projects.stream().map(p -> Objects.nonNull(p.getProposeTotalInvest()) ? p.getProposeTotalInvest() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproval[0] = b); final BigDecimal[] approvalAmountApprovalGov = {BigDecimal.ZERO}; - approves.stream().map(p -> { - BigDecimal reviewTotalMoney = Objects.nonNull(p.getBaseInitialReviewTotalMoney()) ? p.getBaseInitialReviewTotalMoney() : BigDecimal.ZERO; - return reviewTotalMoney; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprovalGov[0] = b); + approves.stream().map(p -> Objects.nonNull(p.getBaseInitialReviewTotalMoney()) ? p.getBaseInitialReviewTotalMoney() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprovalGov[0] = b); BigDecimal approvalAmountApprovalTotal = approvalAmountApproval[0].add(approvalAmountApprovalGov[0]); approvalHejian.setApproval(approvalAmountApprovalTotal); //批复的差额 @@ -216,22 +207,17 @@ public class FundStatisticsManage { } //计算 合同阶段的 核减金额 - private FundStatisticsVO.HeJianAmount computeContractHeJian(List projects,List procures, - BigDecimal approvalAmountApprovalTotal){ + private FundStatisticsVO.HeJianAmount computeContractHeJian(List projects, List procures, + BigDecimal approvalAmountApprovalTotal) { FundStatisticsVO.HeJianAmount contractHejian = new FundStatisticsVO.HeJianAmount(); contractHejian.setApprove(approvalAmountApprovalTotal); //合同的批复金额(申报项目:成交金额 项目归集:成交金额) final BigDecimal[] approvalAmountContract = {BigDecimal.ZERO}; - projects.stream().map(p -> { - BigDecimal transactionAmount = Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO; - return transactionAmount; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContract[0] = b); + projects.stream().map(p -> Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> approvalAmountContract[0] = b); final BigDecimal[] approvalAmountContractGov = {BigDecimal.ZERO}; - procures.stream().map(p -> { - BigDecimal purchaseAmount = Objects.nonNull(p.getBaseProjPurchaseAmount()) ? - p.getBaseProjPurchaseAmount() : BigDecimal.ZERO; - return purchaseAmount; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContractGov[0] = b); + procures.stream().map(p -> Objects.nonNull(p.getBaseProjPurchaseAmount()) ? p.getBaseProjPurchaseAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> approvalAmountContractGov[0] = b); BigDecimal approvalAmountContractTotal = approvalAmountContract[0].add(approvalAmountContractGov[0]); contractHejian.setApproval(approvalAmountContractTotal); //合同的差额 @@ -242,6 +228,7 @@ public class FundStatisticsManage { /** * 近三年 + * * @param res */ private void threeYearsCompleteAmount(FundStatisticsVO res) { @@ -259,31 +246,31 @@ public class FundStatisticsManage { List threeYearsApproves = Lists.newArrayList(); List threeYearsProcures = Lists.newArrayList(); - if(CollUtil.isNotEmpty(threeYearsProjIds)){ + if (CollUtil.isNotEmpty(threeYearsProjIds)) { threeYearsBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .in(GovBizProjectBaseinfo::getBaseProjId,threeYearsProjIds)); - if(CollUtil.isNotEmpty(threeYearsBaseInfos)){ + .in(GovBizProjectBaseinfo::getBaseProjId, threeYearsProjIds)); + if (CollUtil.isNotEmpty(threeYearsBaseInfos)) { List threeYearsBaseProjIds = threeYearsBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) .collect(Collectors.toList()); threeYearsApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,threeYearsBaseProjIds)); + .in(GovBizProjectApply::getBaseProjId, threeYearsBaseProjIds)); threeYearsApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId,threeYearsBaseProjIds)); + .in(GovBizProjectApprove::getBaseProjId, threeYearsBaseProjIds)); threeYearsProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId,threeYearsBaseProjIds)); + .in(GovBizProjectProcure::getBaseProjId, threeYearsBaseProjIds)); } } //2.4 近三年 核减 - res.setThreeYearsDeductionTotalAmount(completeDeductionAmount(threeYearsProjects,threeYearsApplies, - threeYearsApproves,threeYearsProcures)); + res.setThreeYearsDeductionTotalAmount(completeDeductionAmount(threeYearsProjects, threeYearsApplies, + threeYearsApproves, threeYearsProcures)); //安全起见 再排序下 Arrays.sort(threeYears); List threeYearsDeduction = Lists.newArrayList(); - for(Integer year : threeYears){ + for (Integer year : threeYears) { FundStatisticsVO.AmountData amountData = new FundStatisticsVO.AmountData(); //申报项目 List thisYearsProjects = projectService.list(Wrappers.lambdaQuery(Project.class) @@ -294,29 +281,29 @@ public class FundStatisticsManage { .eq(GovBizProjectApply::getBaseProjSetYear, year)); List thisYearProjIds = thisYearApplieYears.stream().map(GovBizProjectApply::getBaseProjId) .collect(Collectors.toList()); - List thisYearBaseInfos = Lists.newArrayList(); + List thisYearBaseInfos; List thisYearApplies = Lists.newArrayList(); List thisYearApproves = Lists.newArrayList(); List thisYearProcures = Lists.newArrayList(); - if(CollUtil.isNotEmpty(thisYearProjIds)){ + if (CollUtil.isNotEmpty(thisYearProjIds)) { thisYearBaseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .in(GovBizProjectBaseinfo::getBaseProjId,threeYearsProjIds)); - if(CollUtil.isNotEmpty(thisYearBaseInfos)){ + .in(GovBizProjectBaseinfo::getBaseProjId, threeYearsProjIds)); + if (CollUtil.isNotEmpty(thisYearBaseInfos)) { List threeYearsBaseProjIds = threeYearsBaseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) .collect(Collectors.toList()); thisYearApplies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,threeYearsBaseProjIds)); + .in(GovBizProjectApply::getBaseProjId, threeYearsBaseProjIds)); thisYearApproves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId,threeYearsBaseProjIds)); + .in(GovBizProjectApprove::getBaseProjId, threeYearsBaseProjIds)); thisYearProcures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId,threeYearsBaseProjIds)); + .in(GovBizProjectProcure::getBaseProjId, threeYearsBaseProjIds)); } } amountData.setName(year.toString()); - amountData.setAmount(completeDeductionAmount(thisYearsProjects,thisYearApplies, - thisYearApproves,thisYearProcures)); + amountData.setAmount(completeDeductionAmount(thisYearsProjects, thisYearApplies, + thisYearApproves, thisYearProcures)); threeYearsDeduction.add(amountData); } res.setThreeYearsDeduction(threeYearsDeduction); @@ -324,6 +311,7 @@ public class FundStatisticsManage { /** * 选择年份去计算 + * * @param res */ private void yearCompleteAmount(FundStatisticsVO res, Integer year) { @@ -342,19 +330,19 @@ public class FundStatisticsManage { List applies = Lists.newArrayList(); List approves = Lists.newArrayList(); List procures = Lists.newArrayList(); - if(CollUtil.isNotEmpty(yearProjIds)){ + if (CollUtil.isNotEmpty(yearProjIds)) { baseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .in(GovBizProjectBaseinfo::getBaseProjId,yearProjIds)); - if(CollUtil.isNotEmpty(baseInfos)){ + .in(GovBizProjectBaseinfo::getBaseProjId, yearProjIds)); + if (CollUtil.isNotEmpty(baseInfos)) { List baseProjIds = baseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId) .collect(Collectors.toList()); applies = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,baseProjIds)); + .in(GovBizProjectApply::getBaseProjId, baseProjIds)); approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) - .in(GovBizProjectApprove::getBaseProjId,baseProjIds)); + .in(GovBizProjectApprove::getBaseProjId, baseProjIds)); procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .in(GovBizProjectProcure::getBaseProjId,baseProjIds)); + .in(GovBizProjectProcure::getBaseProjId, baseProjIds)); } } //2 @@ -390,39 +378,40 @@ public class FundStatisticsManage { res.setApprovalTotalAmount(contractTotalAmount[0].add(contractTotalAmountGov[0])); //计划核减 - FundStatisticsVO.HeJianAmount planHejian = computePlanHeJian(projects,applies,approves); + FundStatisticsVO.HeJianAmount planHejian = computePlanHeJian(projects, applies, approves); //批复核减 - FundStatisticsVO.HeJianAmount approvalHejian = computeApprovalHeJian(projects,approves,planHejian.getApproval()); + FundStatisticsVO.HeJianAmount approvalHejian = computeApprovalHeJian(projects, approves, planHejian.getApproval()); //合同核减 - FundStatisticsVO.HeJianAmount contractHejian = computeContractHeJian(projects,procures,approvalHejian.getApproval()); + FundStatisticsVO.HeJianAmount contractHejian = computeContractHeJian(projects, procures, approvalHejian.getApproval()); res.setPlanDeduction(planHejian); res.setApprovalDeduction(approvalHejian); res.setContractDeduction(contractHejian); //部门TOP10 - res.setDepartmentTop10(computeTop10(projects,baseInfos,applies,approves,procures)); + res.setDepartmentTop10(computeTop10(projects, baseInfos, applies, approves, procures)); } /** * 计算 部门TOP10 + * * @param projects * @param applies * @param approves * @param procures * @return */ - private List computeTop10(List projects,List baseInfos, - List applies, List approves, - List procures) { + private List computeTop10(List projects, List baseInfos, + List applies, List approves, + List procures) { //申报项目颗粒度 Map> groupProjectMap = projects.stream() .filter(p -> StringUtils.isNotBlank(p.getBuildOrgCode())) .collect(Collectors.groupingBy(Project::getBuildOrgCode)); List projectAmounts = Lists.newArrayList(); - for(Map.Entry> entry : groupProjectMap.entrySet()){ + for (Map.Entry> entry : groupProjectMap.entrySet()) { FundStatisticsVO.AmountData orgAmount = new FundStatisticsVO.AmountData(); List ps = entry.getValue(); - if(CollUtil.isNotEmpty(ps)){ + if (CollUtil.isNotEmpty(ps)) { orgAmount.setName(ps.get(0).getBuildOrgName()); } orgAmount.setAmount(completeDeductionAmount(entry.getValue(), @@ -436,11 +425,11 @@ public class FundStatisticsManage { .filter(b -> StringUtils.isNotBlank(b.getBaseBuildDeprtDing())) .collect(Collectors.groupingBy(GovBizProjectBaseinfo::getBaseBuildDeprtDing)); List govAmounts = Lists.newArrayList(); - for(Map.Entry> entry : groupGovMap.entrySet()){ + for (Map.Entry> entry : groupGovMap.entrySet()) { FundStatisticsVO.AmountData govAmount = new FundStatisticsVO.AmountData(); List bs = entry.getValue(); List baseProjIds = Lists.newArrayList(); - if(CollUtil.isNotEmpty(bs)){ + if (CollUtil.isNotEmpty(bs)) { govAmount.setName(bs.get(0).getBaseBuildDeprt()); baseProjIds = bs.stream().map(GovBizProjectBaseinfo::getBaseProjId) .collect(Collectors.toList()); @@ -454,7 +443,7 @@ public class FundStatisticsManage { List procuresThis = procures.stream().filter(a -> Objects.nonNull(a.getBaseProjId()) && finalBaseProjIds.contains(a.getBaseProjId())).collect(Collectors.toList()); govAmount.setAmount(completeDeductionAmount(Collections.emptyList(), - appliesThis, approvesThis,procuresThis)); + appliesThis, approvesThis, procuresThis)); govAmounts.add(govAmount); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/EarlyWarningStatisticsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/EarlyWarningStatisticsVO.java index 1f16e4e..b3b952f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/EarlyWarningStatisticsVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/EarlyWarningStatisticsVO.java @@ -6,7 +6,6 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; -import java.math.BigDecimal; import java.util.List; @Data diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/GovBusinessStripsTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/GovBusinessStripsTask.java index 1ac4a44..e86f682 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/GovBusinessStripsTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/GovBusinessStripsTask.java @@ -2,16 +2,15 @@ package com.hz.pm.api.ding.task; import cn.hutool.core.collection.CollectionUtil; import com.alibaba.fastjson.JSON; -import com.ningdatech.basic.model.GenericResult; import com.hz.pm.api.organization.entity.GovBusinessStrip; import com.hz.pm.api.organization.service.IGovBusinessStripService; +import com.ningdatech.basic.model.GenericResult; import com.ningdatech.zwdd.client.ZwddClient; import com.ningdatech.zwdd.model.Page; import com.ningdatech.zwdd.model.dto.SubGovBusinessStripsDTO; import com.ningdatech.zwdd.model.query.PageSubGovBusinessStripsQuery; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -25,17 +24,15 @@ import java.util.stream.Collectors; @Component @Slf4j +@RequiredArgsConstructor public class GovBusinessStripsTask { - private final static Integer PAGE_SIZE = 20; - - private final static Integer GROUP_SIZE = 100; + private static final Integer PAGE_SIZE = 20; - @Autowired - private ZwddClient zwddClient; + private static final Integer GROUP_SIZE = 100; - @Autowired - private IGovBusinessStripService iGovBusinessStripService; + private final ZwddClient zwddClient; + private final IGovBusinessStripService iGovBusinessStripService; @Transactional(rollbackFor = Exception.class) // @Scheduled(cron = "0 0 1 * * ?") @@ -47,7 +44,7 @@ public class GovBusinessStripsTask { log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); - if(!pageGenericResult.isSuccess()){ + if (!pageGenericResult.isSuccess()) { return; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java index 76a9284..1da18f1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java @@ -1,14 +1,14 @@ package com.hz.pm.api.expert.helper; import cn.hutool.core.collection.CollUtil; -import com.ningdatech.basic.exception.BizException; import com.hz.pm.api.expert.model.*; import com.hz.pm.api.meta.helper.DictionaryCache; import com.hz.pm.api.meta.helper.TagCache; import com.hz.pm.api.meta.model.ExpertRegionInfo; import com.hz.pm.api.meta.model.dto.DictionaryDTO; import com.hz.pm.api.meta.model.dto.TagDTO; -import org.springframework.beans.factory.annotation.Autowired; +import com.ningdatech.basic.exception.BizException; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; import java.util.ArrayList; @@ -21,16 +21,11 @@ import java.util.Objects; */ @Component +@RequiredArgsConstructor public class ExpertManageHelper { -// @Autowired -// private RegionCache regionCache; - - @Autowired - private TagCache tagCache; - - @Autowired - private DictionaryCache dictionaryCache; + private final TagCache tagCache; + private final DictionaryCache dictionaryCache; /** @@ -81,9 +76,9 @@ public class ExpertManageHelper { /** * 校验字典code是否合法 * - * @param expertBasicInfo - * @param expertEduInfo - * @param expertJobInfo + * @param expertBasicInfo \ + * @param expertEduInfo \ + * @param expertJobInfo \ */ public void dictionaryFieldCheck(ExpertBasicInfo expertBasicInfo, ExpertEduInfo expertEduInfo , ExpertJobInfo expertJobInfo) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java index 504b366..35528dc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java @@ -3,12 +3,6 @@ package com.hz.pm.api.expert.manage; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.cache.model.cache.CacheKey; -import com.ningdatech.cache.repository.CachePlusOps; -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import com.ningdatech.file.service.FileService; import com.hz.pm.api.common.model.FileBasicInfo; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.expert.assembler.ExpertInfoCmdAssembler; @@ -42,6 +36,12 @@ import com.hz.pm.api.user.entity.UserInfo; import com.hz.pm.api.user.entity.enumeration.RoleEnum; import com.hz.pm.api.user.service.IUserInfoService; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.GenericResult; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import com.ningdatech.file.service.FileService; import com.ningdatech.zwdd.client.ZwddClient; import com.ningdatech.zwdd.model.dto.DingInfoByMobileDTO; import lombok.RequiredArgsConstructor; @@ -150,10 +150,7 @@ public class ExpertManage { } } - - @Transactional(rollbackFor = Exception.class) - public Long expertRecommendProofSubmit - (List recommendedWay, List recommendProofFile, Long expertUserId) { + private void expertRecommendProofSubmit(List recommendedWay, List recommendProofFile, Long expertUserId) { // 用户id ExpertUserFullInfo expertUserFullInfo = expertUserFullInfoService.getByUserId(expertUserId); // 判断专家状态,是否可以进行证明材料提交 @@ -179,7 +176,7 @@ public class ExpertManage { } expertRecommendProofSaveCmd.setRecommendedWay(recommendedWayDictionaryDTOList); expertRecommendProofSaveCmd.setUserId(expertUserId); - return expertInfoService.expertRecommendProofSave(expertRecommendProofSaveCmd); + expertInfoService.expertRecommendProofSave(expertRecommendProofSaveCmd); } public ExpertFullInfoVO getExpertFullInfoDetail(Long expertUserId) { @@ -196,7 +193,6 @@ public class ExpertManage { return expertUserInfoAssembler.buildExpertFullInfo(attachFiles, expertUserFullInfoAll); } - @Transactional(rollbackFor = Exception.class) public Long generateOrGetUserId(ExpertBasicInfo basicInfo, Long operatorId) { String phoneNo = basicInfo.getPhoneNo(); UserInfo userInfo = userInfoService.getUserInfoByPhoneNo(phoneNo); @@ -238,21 +234,20 @@ public class ExpertManage { /** * 社会专家报名 需要校验手机号 * - * @param request + * @param request \ */ @Transactional(rollbackFor = Exception.class) public void expertRegistration(ExpertRegistrationRequest request) { String verificationCode = request.getVerificationCode(); String phoneNo = request.getBasicInfo().getPhoneNo(); //校验 专家验证码 - if (expertRegistrationVerifyCodeCheck) { + if (Boolean.TRUE.equals(expertRegistrationVerifyCodeCheck)) { verifyCodeCheckHelper.verification(VerificationCodeType.EXPERT_REGISTER, phoneNo, verificationCode); } assemblerAndGenerateExpert(request, null); } - @Transactional(rollbackFor = Exception.class) public Long assemblerAndGenerateExpert(ExpertUserBasicInfoSubmitRequest req, Long operatorId) { if (Objects.isNull(operatorId)) { operatorId = -1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java index a8f1626..0f92918 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java @@ -12,7 +12,7 @@ import com.ningdatech.basic.util.CollUtils; import com.hz.pm.api.common.enumeration.BoolDisplayEnum; import com.hz.pm.api.common.model.ExpertRegionModifyDiffBO; import com.hz.pm.api.common.util.ExpertRegionInfoUtils; -import com.hz.pm.api.common.util.GzipUtils; +import com.hz.pm.api.common.util.GzipUtil; import com.hz.pm.api.expert.assembler.ExpertUserInfoAssembler; import com.hz.pm.api.expert.constant.*; import com.hz.pm.api.expert.entity.*; @@ -21,13 +21,11 @@ import com.hz.pm.api.expert.model.SensitiveModifySegment; import com.hz.pm.api.expert.model.TagFieldInfo; import com.hz.pm.api.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; import com.hz.pm.api.expert.model.cmd.*; -import com.hz.pm.api.expert.model.constant.ExpertAuditMsgTemplate; import com.hz.pm.api.expert.model.dto.*; import com.hz.pm.api.expert.service.*; import com.hz.pm.api.expert.utils.SensitiveModifySegmentUtils; import com.hz.pm.api.meeting.helper.YxtCallOrSmsHelper; import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; -import com.hz.pm.api.meta.constant.ExpertTagEnum; import com.hz.pm.api.meta.model.ExpertRegionInfo; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.model.entity.ExpertTag; @@ -618,7 +616,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { public Long createExpertInfoModifyApply(List expertSensitiveInfoFieldSegmentList , ExpertUserFullInfo originalExpertUserFullInfo, ModifyApplyExtraInfoDTO modifyApplyExtraInfo) { expertSensitiveInfoFieldSegmentList = expertSensitiveInfoFieldSegmentList.stream().filter(r -> !r.isValueEquals()).collect(Collectors.toList()); - String compressedModifyJsonStr = GzipUtils.compress(JSONObject.toJSONString(expertSensitiveInfoFieldSegmentList)); + String compressedModifyJsonStr = GzipUtil.zip(JSONObject.toJSONString(expertSensitiveInfoFieldSegmentList)); ExpertMetaApply expertMetaApply = new ExpertMetaApply(); expertMetaApply.setApplyType(ExpertApplyTypeEnum.EXPERT_INFO_MODIFY.getKey()); @@ -683,7 +681,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { */ private Long createExpertRegionModifyApply(List expertRegionFieldSegmentList , ExpertUserFullInfo originalExpertUserFullInfo, ModifyApplyExtraInfoDTO modifyApplyExtraInfo) { - String compressedModifyJsonStr = GzipUtils.compress(JSONObject.toJSONString(expertRegionFieldSegmentList)); + String compressedModifyJsonStr = GzipUtil.zip(JSONObject.toJSONString(expertRegionFieldSegmentList)); SensitiveModifySegment segment = expertRegionFieldSegmentList.get(0); ExpertRegionInfo apply = (ExpertRegionInfo) segment.getApply(); @@ -730,7 +728,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { ExpertSensitiveInfoModifyDetailRecord record = iExpertSensitiveInfoModifyDetailRecordService.getOne(recordQuery); String modifyJson = record.getModifyJson(); if (StringUtils.isNotEmpty(modifyJson)) { - modifyJson = GzipUtils.uncompress(modifyJson); + modifyJson = GzipUtil.unzip(modifyJson); } List sensitiveModifySegments = JSONUtils.parseArray(modifyJson, SensitiveModifySegment.class); Map collectMap = sensitiveModifySegments diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java index 528fa77..4124452 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java @@ -1,7 +1,5 @@ package com.hz.pm.api.gov.controller; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; import com.hz.pm.api.gov.manage.GovProjectCollectionManage; import com.hz.pm.api.gov.model.dto.GovBizProjectSaveDTO; import com.hz.pm.api.gov.model.dto.GovOperationProjectSaveDTO; @@ -12,6 +10,8 @@ import com.hz.pm.api.gov.model.vo.GovProjectDictionaryVO; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.scheduler.task.SynProjectCollectionTask; import com.hz.pm.api.scheduler.task.SynProvinceOrgTask; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -165,7 +165,7 @@ public class GovProjectCollectionController { @PostMapping("/push-task-single") @ApiOperation("主动调用定时器方法") @WebLog("主动调用定时器方法") - public void pushTaskSingle(@RequestBody List projectCodes) throws UnknownHostException { + public void pushTaskSingle(@RequestBody List projectCodes) { collectionTask.doTaskSingle(projectCodes); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java index dc0f1cd..ebc1c67 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java @@ -11,11 +11,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.file.service.FileService; import com.hz.pm.api.common.constant.BizConst; import com.hz.pm.api.common.constant.RegionConst; import com.hz.pm.api.common.helper.RegionCacheHelper; @@ -48,21 +43,22 @@ import com.hz.pm.api.safety.service.IPersonSafetyInfoService; import com.hz.pm.api.safety.service.ISupplierSafetyQualificationService; import com.hz.pm.api.staging.model.entity.ProjectStaging; import com.hz.pm.api.staging.service.IProjectStagingService; -import com.hz.pm.api.sys.model.entity.Role; -import com.hz.pm.api.user.entity.enumeration.RoleEnum; import com.hz.pm.api.user.security.auth.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; import com.hz.pm.api.wps.manage.WpsConvertManage; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.file.service.FileService; import com.wflow.bean.entity.WflowCcTasks; import com.wflow.service.WflowCcTasksService; -import io.swagger.annotations.ApiModelProperty; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.poi.util.IOUtils; import org.flowable.engine.HistoryService; import org.flowable.engine.RuntimeService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -168,44 +164,45 @@ public class GovProjectCollectionManage { List dictionaries = dictionaryService.list(Wrappers.lambdaQuery(GovProjectDictionary.class) .eq(StringUtils.isNotBlank(type), GovProjectDictionary::getType, type) - .eq(GovProjectDictionary::getDeleted,Boolean.FALSE)); + .eq(GovProjectDictionary::getDeleted, Boolean.FALSE)); - if(CollUtil.isEmpty(dictionaries)){ + if (CollUtil.isEmpty(dictionaries)) { return Collections.emptyList(); } - return dictionaries.stream().map(d -> BeanUtil.copyProperties(d,GovProjectDictionaryVO.class)) + return dictionaries.stream().map(d -> BeanUtil.copyProperties(d, GovProjectDictionaryVO.class)) .collect(Collectors.toList()); } /** * 分页查 项目归集 + * * @param req * @return */ public PageVo list(ProjectListReq req) { Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectBaseinfo::getBaseProjName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()),GovBizProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()),GovBizProjectBaseinfo::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) - .eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectBaseinfo::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) - .gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax()) - .eq(StringUtils.isNotBlank(req.getProjectType()),GovBizProjectBaseinfo::getBaseProjType,req.getProjectType()) - .in(CollUtil.isNotEmpty(req.getProjectCodes()),GovBizProjectBaseinfo::getBaseProjId,req.getProjectCodes()) + .like(StringUtils.isNotBlank(req.getProjectName()), GovBizProjectBaseinfo::getBaseProjName, req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()), GovBizProjectBaseinfo::getBaseBuildDeprt, req.getBuildOrg()) + .eq(StringUtils.isNotBlank(req.getAreaCode()), GovBizProjectBaseinfo::getBaseAreaCode, req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) + .eq(StringUtils.isNotBlank(req.getRegionCode()), GovBizProjectBaseinfo::getBaseAreaCode, req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) + .gt(Objects.nonNull(req.getCreateOnMin()), GovBizProjectBaseinfo::getTongTime, req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()), GovBizProjectBaseinfo::getTongTime, req.getCreateOnMax()) + .eq(StringUtils.isNotBlank(req.getProjectType()), GovBizProjectBaseinfo::getBaseProjType, req.getProjectType()) + .in(CollUtil.isNotEmpty(req.getProjectCodes()), GovBizProjectBaseinfo::getBaseProjId, req.getProjectCodes()) .in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.BUILD.getCode().equals(req.getOldProjectType()), GovBizProjectBaseinfo::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.FIRST_BUILD.getCode(), - ProjectTypeNewEnum.SJ_BUILD.getCode(),ProjectTypeNewEnum.SZ_BUILD.getCode())) + ProjectTypeNewEnum.SJ_BUILD.getCode(), ProjectTypeNewEnum.SZ_BUILD.getCode())) .in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.DEV_OPS.getCode().equals(req.getOldProjectType()), GovBizProjectBaseinfo::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.NEW_OPERA.getCode(), ProjectTypeNewEnum.XU_OPERA.getCode())) - .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) + .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) .orderByDesc(GovBizProjectBaseinfo::getBizTime); // permissions(wrapper); - baseinfoService.page(page,wrapper); + baseinfoService.page(page, wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } @@ -213,12 +210,12 @@ public class GovProjectCollectionManage { .filter(p -> Objects.nonNull(p) && StringUtils.isNotBlank(p.getBaseProjId())) .map(GovBizProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); - Map applyMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projIds)){ + Map applyMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(projIds)) { List applys = projectApplyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,projIds) - .eq(GovBizProjectApply::getDeleted,Boolean.FALSE)); - applyMap = applys.stream().collect(Collectors.toMap(GovBizProjectApply::getBaseProjId,a -> a)); + .in(GovBizProjectApply::getBaseProjId, projIds) + .eq(GovBizProjectApply::getDeleted, Boolean.FALSE)); + applyMap = applys.stream().collect(Collectors.toMap(GovBizProjectApply::getBaseProjId, a -> a)); } Map finalApplyMap = applyMap; @@ -230,7 +227,7 @@ public class GovProjectCollectionManage { vo.setBaseBuildDeprtDing(p.getBaseBuildDeprtDing()); vo.setBaseProjId(p.getBaseProjId()); vo.setBaseProjName(p.getBaseProjName()); - if(finalApplyMap.containsKey(p.getBaseProjId())){ + if (finalApplyMap.containsKey(p.getBaseProjId())) { GovBizProjectApply apply = finalApplyMap.get(p.getBaseProjId()); vo.setBaseProjDeclAmount(apply.getBaseProjDeclAmount()); vo.setBaseProjTotalAmount(apply.getBaseProjTotalAmount()); @@ -239,30 +236,31 @@ public class GovProjectCollectionManage { return vo; }).collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } /** * 运维项目归集列表 + * * @param req * @return */ public PageVo operationList(ProjectListReq req) { Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .like(StringUtils.isNotBlank(req.getProjectName()),GovOperationProjectBaseinfo::getBaseProjName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()),GovOperationProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()),GovOperationProjectBaseinfo::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) - .eq(StringUtils.isNotBlank(req.getRegionCode()),GovOperationProjectBaseinfo::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) - .gt(Objects.nonNull(req.getCreateOnMin()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMax()) - .eq(StringUtils.isNotBlank(req.getProjectType()),GovOperationProjectBaseinfo::getBaseProjType,req.getProjectType()) - .in(CollUtil.isNotEmpty(req.getProjectCodes()),GovOperationProjectBaseinfo::getBaseProjId,req.getProjectCodes()) - .eq(GovOperationProjectBaseinfo::getDeleted,Boolean.FALSE) + .like(StringUtils.isNotBlank(req.getProjectName()), GovOperationProjectBaseinfo::getBaseProjName, req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()), GovOperationProjectBaseinfo::getBaseBuildDeprt, req.getBuildOrg()) + .eq(StringUtils.isNotBlank(req.getAreaCode()), GovOperationProjectBaseinfo::getBaseAreaCode, req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) + .eq(StringUtils.isNotBlank(req.getRegionCode()), GovOperationProjectBaseinfo::getBaseAreaCode, req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) + .gt(Objects.nonNull(req.getCreateOnMin()), GovOperationProjectBaseinfo::getTongTime, req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()), GovOperationProjectBaseinfo::getTongTime, req.getCreateOnMax()) + .eq(StringUtils.isNotBlank(req.getProjectType()), GovOperationProjectBaseinfo::getBaseProjType, req.getProjectType()) + .in(CollUtil.isNotEmpty(req.getProjectCodes()), GovOperationProjectBaseinfo::getBaseProjId, req.getProjectCodes()) + .eq(GovOperationProjectBaseinfo::getDeleted, Boolean.FALSE) .orderByDesc(GovOperationProjectBaseinfo::getBizTime); - operationProjectBaseinfoService.page(page,wrapper); + operationProjectBaseinfoService.page(page, wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } @@ -270,12 +268,12 @@ public class GovProjectCollectionManage { .filter(p -> Objects.nonNull(p) && StringUtils.isNotBlank(p.getBaseProjId())) .map(GovOperationProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); - Map applyMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projIds)){ + Map applyMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(projIds)) { List applys = projectApplyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,projIds) - .eq(GovBizProjectApply::getDeleted,Boolean.FALSE)); - applyMap = applys.stream().collect(Collectors.toMap(GovBizProjectApply::getBaseProjId,a -> a)); + .in(GovBizProjectApply::getBaseProjId, projIds) + .eq(GovBizProjectApply::getDeleted, Boolean.FALSE)); + applyMap = applys.stream().collect(Collectors.toMap(GovBizProjectApply::getBaseProjId, a -> a)); } Map finalApplyMap = applyMap; @@ -287,7 +285,7 @@ public class GovProjectCollectionManage { vo.setBaseBuildDeprtDing(p.getBaseBuildDeprtDing()); vo.setBaseProjId(p.getBaseProjId()); vo.setBaseProjName(p.getBaseProjName()); - if(finalApplyMap.containsKey(p.getBaseProjId())){ + if (finalApplyMap.containsKey(p.getBaseProjId())) { GovBizProjectApply apply = finalApplyMap.get(p.getBaseProjId()); vo.setBaseProjDeclAmount(apply.getBaseProjDeclAmount()); vo.setBaseProjTotalAmount(apply.getBaseProjTotalAmount()); @@ -296,11 +294,12 @@ public class GovProjectCollectionManage { return vo; }).collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } /** * 草稿箱列表 + * * @param req * @return */ @@ -308,25 +307,25 @@ public class GovProjectCollectionManage { UserInfoDetails user = LoginUserUtil.loginUserDetail(); Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectDraft.class) - .like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectDraft::getBaseProjName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()),GovBizProjectDraft::getBaseBuildDeprt,req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()),GovBizProjectDraft::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) - .eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectDraft::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) - .gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectDraft::getTongTime,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectDraft::getTongTime,req.getCreateOnMax()) - .eq(StringUtils.isNotBlank(req.getProjectType()),GovBizProjectDraft::getBaseProjType,req.getProjectType()) + .like(StringUtils.isNotBlank(req.getProjectName()), GovBizProjectDraft::getBaseProjName, req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()), GovBizProjectDraft::getBaseBuildDeprt, req.getBuildOrg()) + .eq(StringUtils.isNotBlank(req.getAreaCode()), GovBizProjectDraft::getBaseAreaCode, req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) + .eq(StringUtils.isNotBlank(req.getRegionCode()), GovBizProjectDraft::getBaseAreaCode, req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) + .gt(Objects.nonNull(req.getCreateOnMin()), GovBizProjectDraft::getTongTime, req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()), GovBizProjectDraft::getTongTime, req.getCreateOnMax()) + .eq(StringUtils.isNotBlank(req.getProjectType()), GovBizProjectDraft::getBaseProjType, req.getProjectType()) .in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.BUILD.getCode().equals(req.getOldProjectType()), GovBizProjectDraft::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.FIRST_BUILD.getCode(), - ProjectTypeNewEnum.SJ_BUILD.getCode(),ProjectTypeNewEnum.SZ_BUILD.getCode())) + ProjectTypeNewEnum.SJ_BUILD.getCode(), ProjectTypeNewEnum.SZ_BUILD.getCode())) .in(Objects.nonNull(req.getOldProjectType()) && ProjectTypeEnum.DEV_OPS.getCode().equals(req.getOldProjectType()), GovBizProjectDraft::getBaseProjType, Lists.newArrayList(ProjectTypeNewEnum.NEW_OPERA.getCode(), ProjectTypeNewEnum.XU_OPERA.getCode())) - .eq(GovBizProjectDraft::getDeleted,Boolean.FALSE) - .eq(GovBizProjectDraft::getCreateId,user.getUserId()) + .eq(GovBizProjectDraft::getDeleted, Boolean.FALSE) + .eq(GovBizProjectDraft::getCreateId, user.getUserId()) .orderByDesc(GovBizProjectDraft::getBizTime); - draftService.page(page,wrapper); + draftService.page(page, wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } @@ -345,26 +344,26 @@ public class GovProjectCollectionManage { return vo; }).collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } public PageVo operationDraftList(ProjectListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectDraft.class) - .like(StringUtils.isNotBlank(req.getProjectName()),GovOperationProjectDraft::getBaseProjName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()),GovOperationProjectDraft::getBaseBuildDeprt,req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()),GovOperationProjectDraft::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) - .eq(StringUtils.isNotBlank(req.getRegionCode()),GovOperationProjectDraft::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) - .gt(Objects.nonNull(req.getCreateOnMin()),GovOperationProjectDraft::getTongTime,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),GovOperationProjectDraft::getTongTime,req.getCreateOnMax()) - .eq(StringUtils.isNotBlank(req.getProjectType()),GovOperationProjectDraft::getBaseProjType,req.getProjectType()) - .eq(GovOperationProjectDraft::getDeleted,Boolean.FALSE) - .eq(GovOperationProjectDraft::getCreateId,user.getUserId()) + .like(StringUtils.isNotBlank(req.getProjectName()), GovOperationProjectDraft::getBaseProjName, req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()), GovOperationProjectDraft::getBaseBuildDeprt, req.getBuildOrg()) + .eq(StringUtils.isNotBlank(req.getAreaCode()), GovOperationProjectDraft::getBaseAreaCode, req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) + .eq(StringUtils.isNotBlank(req.getRegionCode()), GovOperationProjectDraft::getBaseAreaCode, req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) + .gt(Objects.nonNull(req.getCreateOnMin()), GovOperationProjectDraft::getTongTime, req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()), GovOperationProjectDraft::getTongTime, req.getCreateOnMax()) + .eq(StringUtils.isNotBlank(req.getProjectType()), GovOperationProjectDraft::getBaseProjType, req.getProjectType()) + .eq(GovOperationProjectDraft::getDeleted, Boolean.FALSE) + .eq(GovOperationProjectDraft::getCreateId, user.getUserId()) .orderByDesc(GovOperationProjectDraft::getBizTime); - operationProjectDraftService.page(page,wrapper); + operationProjectDraftService.page(page, wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } @@ -383,52 +382,54 @@ public class GovProjectCollectionManage { return vo; }).collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } /** * 数据权限 + * * @param wrapper */ private void permissions(LambdaQueryWrapper wrapper) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); //超管和区域管理员 - if(user.getSuperAdmin() || user.getRegionAdmin()){ + if (user.getSuperAdmin() || user.getRegionAdmin()) { log.info("超管和区管 可以看所有"); return; } - wrapper.eq(GovBizProjectBaseinfo::getBaseBuildDeprtDing,user.getEmpPosUnitCode()); + wrapper.eq(GovBizProjectBaseinfo::getBaseBuildDeprtDing, user.getEmpPosUnitCode()); } public Long count(ProjectListReq req) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectBaseinfo::getBaseProjName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()),GovBizProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()),GovBizProjectBaseinfo::getAreaCode,req.getAreaCode()) - .eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectBaseinfo::getAreaCode,req.getRegionCode()) - .gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax()) - .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) + .like(StringUtils.isNotBlank(req.getProjectName()), GovBizProjectBaseinfo::getBaseProjName, req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()), GovBizProjectBaseinfo::getBaseBuildDeprt, req.getBuildOrg()) + .eq(StringUtils.isNotBlank(req.getAreaCode()), GovBizProjectBaseinfo::getAreaCode, req.getAreaCode()) + .eq(StringUtils.isNotBlank(req.getRegionCode()), GovBizProjectBaseinfo::getAreaCode, req.getRegionCode()) + .gt(Objects.nonNull(req.getCreateOnMin()), GovBizProjectBaseinfo::getTongTime, req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()), GovBizProjectBaseinfo::getTongTime, req.getCreateOnMax()) + .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) .orderByDesc(GovBizProjectBaseinfo::getBizTime); return baseinfoService.count(wrapper); } public Long operationCount(ProjectListReq req) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .like(StringUtils.isNotBlank(req.getProjectName()),GovOperationProjectBaseinfo::getBaseProjName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()),GovOperationProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()),GovOperationProjectBaseinfo::getAreaCode,req.getAreaCode()) - .eq(StringUtils.isNotBlank(req.getRegionCode()),GovOperationProjectBaseinfo::getAreaCode,req.getRegionCode()) - .gt(Objects.nonNull(req.getCreateOnMin()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),GovOperationProjectBaseinfo::getTongTime,req.getCreateOnMax()) - .eq(GovOperationProjectBaseinfo::getDeleted,Boolean.FALSE) + .like(StringUtils.isNotBlank(req.getProjectName()), GovOperationProjectBaseinfo::getBaseProjName, req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()), GovOperationProjectBaseinfo::getBaseBuildDeprt, req.getBuildOrg()) + .eq(StringUtils.isNotBlank(req.getAreaCode()), GovOperationProjectBaseinfo::getAreaCode, req.getAreaCode()) + .eq(StringUtils.isNotBlank(req.getRegionCode()), GovOperationProjectBaseinfo::getAreaCode, req.getRegionCode()) + .gt(Objects.nonNull(req.getCreateOnMin()), GovOperationProjectBaseinfo::getTongTime, req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()), GovOperationProjectBaseinfo::getTongTime, req.getCreateOnMax()) + .eq(GovOperationProjectBaseinfo::getDeleted, Boolean.FALSE) .orderByDesc(GovOperationProjectBaseinfo::getBizTime); return operationProjectBaseinfoService.count(wrapper); } /** * 项目归集详情 + * * @param projId * @return */ @@ -440,7 +441,7 @@ public class GovProjectCollectionManage { .orderByDesc(GovBizProjectBaseinfo::getBizTime) .last(BizConst.LIMIT_1)); - if(Objects.isNull(baseinfo)){ + if (Objects.isNull(baseinfo)) { return res; } res.setBaseProjId(baseinfo.getBaseProjId()); @@ -452,7 +453,7 @@ public class GovProjectCollectionManage { .eq(GovBizProjectApply::getBaseProjId, projId) .orderByDesc(GovBizProjectApply::getBizTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(apply)){ + if (Objects.nonNull(apply)) { res.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyVO.class)); } @@ -461,7 +462,7 @@ public class GovProjectCollectionManage { .eq(GovBizProjectApprove::getBaseProjId, projId) .orderByDesc(GovBizProjectApprove::getBizTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(approve)){ + if (Objects.nonNull(approve)) { res.setApprove(BeanUtil.copyProperties(approve, GovBizProjectApproveVO.class)); } @@ -470,14 +471,14 @@ public class GovProjectCollectionManage { .eq(GovBizProjectCimplement::getBaseProjId, projId) .orderByDesc(GovBizProjectCimplement::getBizTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(cimplement)){ + if (Objects.nonNull(cimplement)) { res.setCimplement(BeanUtil.copyProperties(cimplement, GovBizProjectCimplementVO.class)); } GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) .eq(GovBizProjectMimplement::getBaseProjId, projId) .orderByDesc(GovBizProjectMimplement::getBizTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(mimplement)){ + if (Objects.nonNull(mimplement)) { res.setMimplement(BeanUtil.copyProperties(mimplement, GovBizProjectMimplementVO.class)); } @@ -485,7 +486,7 @@ public class GovProjectCollectionManage { List procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) .eq(GovBizProjectProcure::getBaseProjId, projId) .orderByDesc(GovBizProjectProcure::getBizTime)); - if(CollUtil.isNotEmpty(procures)){ + if (CollUtil.isNotEmpty(procures)) { res.setProcures(procures.stream() .map(p -> BeanUtil.copyProperties(p, GovBizProjectProcureVO.class)) .collect(Collectors.toList())); @@ -502,7 +503,7 @@ public class GovProjectCollectionManage { .orderByDesc(GovOperationProjectBaseinfo::getBizTime) .last(BizConst.LIMIT_1)); - if(Objects.isNull(baseinfo)){ + if (Objects.isNull(baseinfo)) { return res; } res.setBaseProjId(baseinfo.getBaseProjId()); @@ -514,7 +515,7 @@ public class GovProjectCollectionManage { .eq(GovBizProjectApply::getBaseProjId, projId) .orderByDesc(GovBizProjectApply::getBizTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(apply)){ + if (Objects.nonNull(apply)) { res.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyVO.class)); } @@ -523,7 +524,7 @@ public class GovProjectCollectionManage { .eq(GovBizProjectApprove::getBaseProjId, projId) .orderByDesc(GovBizProjectApprove::getBizTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(approve)){ + if (Objects.nonNull(approve)) { res.setApprove(BeanUtil.copyProperties(approve, GovBizProjectApproveVO.class)); } @@ -532,14 +533,14 @@ public class GovProjectCollectionManage { .eq(GovBizProjectCimplement::getBaseProjId, projId) .orderByDesc(GovBizProjectCimplement::getBizTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(cimplement)){ + if (Objects.nonNull(cimplement)) { res.setCimplement(BeanUtil.copyProperties(cimplement, GovBizProjectCimplementVO.class)); } GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) .eq(GovBizProjectMimplement::getBaseProjId, projId) .orderByDesc(GovBizProjectMimplement::getBizTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(mimplement)){ + if (Objects.nonNull(mimplement)) { res.setMimplement(BeanUtil.copyProperties(mimplement, GovBizProjectMimplementVO.class)); } @@ -547,7 +548,7 @@ public class GovProjectCollectionManage { List procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) .eq(GovBizProjectProcure::getBaseProjId, projId) .orderByDesc(GovBizProjectProcure::getBizTime)); - if(CollUtil.isNotEmpty(procures)){ + if (CollUtil.isNotEmpty(procures)) { res.setProcures(procures.stream() .map(p -> BeanUtil.copyProperties(p, GovBizProjectProcureVO.class)) .collect(Collectors.toList())); @@ -558,6 +559,7 @@ public class GovProjectCollectionManage { /** * 草稿箱详情 + * * @param draftId * @return */ @@ -566,7 +568,7 @@ public class GovProjectCollectionManage { //查询草稿表 GovBizProjectDraft draft = draftService.getById(draftId); - if(Objects.isNull(draft)){ + if (Objects.isNull(draft)) { return null; } res.setDraftId(draftId); @@ -609,10 +611,10 @@ public class GovProjectCollectionManage { res.setMimplement(mimplementVo); //5.最后查询采购信息 - if(StringUtils.isNotBlank(draft.getProcure())){ - try{ - res.setProcures(JSON.parseArray(draft.getProcure(),GovBizProjectProcureVO.class)); - }catch (Exception e){ + if (StringUtils.isNotBlank(draft.getProcure())) { + try { + res.setProcures(JSON.parseArray(draft.getProcure(), GovBizProjectProcureVO.class)); + } catch (Exception e) { log.error("草稿箱采购出错:" + e.getMessage()); } } @@ -626,7 +628,7 @@ public class GovProjectCollectionManage { //查询草稿表 GovOperationProjectDraft draft = operationProjectDraftService.getById(draftId); - if(Objects.isNull(draft)){ + if (Objects.isNull(draft)) { return null; } res.setDraftId(draftId); @@ -669,10 +671,10 @@ public class GovProjectCollectionManage { res.setMimplement(mimplementVo); //5.最后查询采购信息 - if(StringUtils.isNotBlank(draft.getProcure())){ - try{ - res.setProcures(JSON.parseArray(draft.getProcure(),GovBizProjectProcureVO.class)); - }catch (Exception e){ + if (StringUtils.isNotBlank(draft.getProcure())) { + try { + res.setProcures(JSON.parseArray(draft.getProcure(), GovBizProjectProcureVO.class)); + } catch (Exception e) { log.error("草稿箱采购出错:" + e.getMessage()); } } @@ -682,12 +684,13 @@ public class GovProjectCollectionManage { /** * 项目归集保存 + * * @param saveDTO * @return */ @Transactional - public String save(GovBizProjectSaveDTO saveDTO,UserInfoDetails user) { - if(Objects.isNull(user)){ + public String save(GovBizProjectSaveDTO saveDTO, UserInfoDetails user) { + if (Objects.isNull(user)) { user = LoginUserUtil.loginUserDetail(); } @@ -707,17 +710,17 @@ public class GovProjectCollectionManage { .last(BizConst.LIMIT_1)); //项目名去重 - checkName(baseProjName,baseProjId); - GovBizProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo,GovBizProjectBaseinfo.class); + checkName(baseProjName, baseProjId); + GovBizProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfo.class); saveBase.setBaseProjName(baseProjName); saveBase.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - if(Objects.nonNull(oldBaseInfo)){ + if (Objects.nonNull(oldBaseInfo)) { saveBase.setId(oldBaseInfo.getId()); saveBase.setBaseAreaCode(null); - }else{ + } else { saveBase.setTongTime(LocalDateTime.now()); saveBase.setBaseAreaCode(baseAreaCode); - saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(),RegionConst.RL_COUNTY)); + saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); } saveBase.setAreaCode(RegionConst.RC_LS); saveBase.setBizTime(LocalDateTime.now()); @@ -725,7 +728,7 @@ public class GovProjectCollectionManage { saveBase.setUpdateOn(LocalDateTime.now()); //如果是新增的话 要生成 项目编号 - if(StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)){ + if (StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)) { baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); saveBase.setBaseProjId(baseProjId); } @@ -734,22 +737,22 @@ public class GovProjectCollectionManage { // 2.保存 申报信息 GovBizProjectApplyDTO apply = saveDTO.getApply(); - if(Objects.nonNull(apply)){ + if (Objects.nonNull(apply)) { apply.setBaseProjId(baseProjId); apply.setBaseProjName(baseProjName); GovBizProjectApply oldApply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) .eq(GovBizProjectApply::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - GovBizProjectApply saveApply = BeanUtil.copyProperties(apply,GovBizProjectApply.class); + GovBizProjectApply saveApply = BeanUtil.copyProperties(apply, GovBizProjectApply.class); saveApply.setBaseProjId(baseProjId); - if(Objects.nonNull(oldApply)){ + if (Objects.nonNull(oldApply)) { saveApply.setId(oldApply.getId()); - }else{ + } else { saveApply.setTongTime(LocalDateTime.now()); } - if(Objects.nonNull(saveApply.getBaseProjStartTime()) && - Objects.nonNull(saveApply.getBaseProjEndTime())){ + if (Objects.nonNull(saveApply.getBaseProjStartTime()) && + Objects.nonNull(saveApply.getBaseProjEndTime())) { saveApply.setBaseProjDuration(convertMonth(saveApply.getBaseProjStartTime(), saveApply.getBaseProjEndTime())); } @@ -757,39 +760,39 @@ public class GovProjectCollectionManage { saveApply.setBizTime(LocalDateTime.now()); saveApply.setUpdateBy(user.getUsername()); saveApply.setUpdateOn(LocalDateTime.now()); - if(projectApplyService.saveOrUpdate(saveApply)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApply(apply,oldApply,saveApply)); + if (projectApplyService.saveOrUpdate(saveApply)) { + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApply(apply, oldApply, saveApply)); } } // 3.保存 审批信息 GovBizProjectApproveDTO approve = saveDTO.getApprove(); - if(Objects.nonNull(approve)){ + if (Objects.nonNull(approve)) { approve.setBaseProjId(baseProjId); approve.setBaseProjName(baseProjName); GovBizProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) .eq(GovBizProjectApprove::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - GovBizProjectApprove saveApprove = BeanUtil.copyProperties(approve,GovBizProjectApprove.class); + GovBizProjectApprove saveApprove = BeanUtil.copyProperties(approve, GovBizProjectApprove.class); saveApprove.setBaseProjId(baseProjId); - if(Objects.nonNull(oldApprove)){ + if (Objects.nonNull(oldApprove)) { saveApprove.setId(oldApprove.getId()); - }else{ + } else { saveApprove.setTongTime(LocalDateTime.now()); } saveApprove.setBizTime(LocalDateTime.now()); saveApprove.setAreaCode(RegionConst.RC_LS); saveApprove.setUpdateBy(user.getUsername()); saveApprove.setUpdateOn(LocalDateTime.now()); - if(approveService.saveOrUpdate(saveApprove)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApprove(approve,oldApprove,saveApprove)); + if (approveService.saveOrUpdate(saveApprove)) { + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApprove(approve, oldApprove, saveApprove)); } } // 4.保存 建设项目 实施信息 GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); - if(Objects.nonNull(cimplement)){ + if (Objects.nonNull(cimplement)) { cimplement.setBaseProjId(baseProjId); cimplement.setBaseProjName(baseProjName); cimplement.setBaseBidCode(baseProjId); @@ -798,27 +801,27 @@ public class GovProjectCollectionManage { .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - GovBizProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,GovBizProjectCimplement.class); + GovBizProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement, GovBizProjectCimplement.class); saveCimplement.setBaseProjId(baseProjId); saveCimplement.setBaseBidCode(baseProjId); saveCimplement.setBaseBidName(baseProjName); - if(Objects.nonNull(oldCimplement)){ + if (Objects.nonNull(oldCimplement)) { saveCimplement.setId(oldCimplement.getId()); - }else{ + } else { saveCimplement.setTongTime(LocalDateTime.now()); } saveCimplement.setAreaCode(RegionConst.RC_LS); saveCimplement.setBizTime(LocalDateTime.now()); saveCimplement.setUpdateBy(user.getUsername()); saveCimplement.setUpdateOn(LocalDateTime.now()); - if(cimplementService.saveOrUpdate(saveCimplement)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement)); + if (cimplementService.saveOrUpdate(saveCimplement)) { + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssCimplement(cimplement, oldCimplement, saveCimplement)); } } // 5.保存 运维项目 实施信息 GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); - if(Objects.nonNull(mimplement)){ + if (Objects.nonNull(mimplement)) { mimplement.setBaseProjId(baseProjId); mimplement.setBaseProjName(baseProjName); mimplement.setBaseBidCode(baseProjId); @@ -827,43 +830,43 @@ public class GovProjectCollectionManage { .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - GovBizProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,GovBizProjectMimplement.class); + GovBizProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement, GovBizProjectMimplement.class); saveMimplement.setBaseProjId(baseProjId); saveMimplement.setBaseBidCode(baseProjId); saveMimplement.setBaseBidName(baseProjName); - if(Objects.nonNull(oldMimplement)){ + if (Objects.nonNull(oldMimplement)) { saveMimplement.setId(oldMimplement.getId()); - }else{ + } else { saveMimplement.setTongTime(LocalDateTime.now()); } - if(Objects.nonNull(saveBase.getAreaCode())){ + if (Objects.nonNull(saveBase.getAreaCode())) { saveMimplement.setAreaCode(saveBase.getAreaCode()); } saveMimplement.setAreaCode(RegionConst.RC_LS); saveMimplement.setBizTime(LocalDateTime.now()); saveMimplement.setUpdateBy(user.getUsername()); saveMimplement.setUpdateOn(LocalDateTime.now()); - if(mimplementService.saveOrUpdate(saveMimplement)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssMimplement(mimplement,oldMimplement,saveMimplement)); + if (mimplementService.saveOrUpdate(saveMimplement)) { + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssMimplement(mimplement, oldMimplement, saveMimplement)); } } // 6.保存 采购信息 List procures = saveDTO.getProcures(); - if(Objects.nonNull(procures)){ + if (Objects.nonNull(procures)) { procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId,baseProjId)); + .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); String finalBaseProjId = baseProjId; UserInfoDetails finalUser = user; Integer index = 1; - for(GovBizProjectProcureDTO procure : procures){ + for (GovBizProjectProcureDTO procure : procures) { procure.setBaseProjId(finalBaseProjId); procure.setBaseProjName(baseProjName); - procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); - GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); + procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); + GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure, GovBizProjectProcure.class); saveProcure.setBaseProjId(finalBaseProjId); saveProcure.setId(null); saveProcure.setAreaCode(RegionConst.RC_LS); @@ -871,8 +874,8 @@ public class GovProjectCollectionManage { saveProcure.setBizTime(LocalDateTime.now()); saveProcure.setUpdateBy(finalUser.getUsername()); saveProcure.setUpdateOn(LocalDateTime.now()); - if(procureService.save(saveProcure)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure,null,saveProcure)); + if (procureService.save(saveProcure)) { + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure, null, saveProcure)); } index++; } @@ -882,7 +885,7 @@ public class GovProjectCollectionManage { //7. 推送数据(改为定时推送了) // pushProject(saveDTO); //如果是草稿箱来的 就要删除 - if(Objects.nonNull(saveDTO.getDraftId())){ + if (Objects.nonNull(saveDTO.getDraftId())) { draftService.removeById(saveDTO.getDraftId()); } @@ -891,12 +894,13 @@ public class GovProjectCollectionManage { /** * 运维项目保存 + * * @param saveDTO * @param user * @return */ public String operationSave(GovOperationProjectSaveDTO saveDTO, UserInfoDetails user) { - if(Objects.isNull(user)){ + if (Objects.isNull(user)) { user = LoginUserUtil.loginUserDetail(); } @@ -916,17 +920,17 @@ public class GovProjectCollectionManage { .last(BizConst.LIMIT_1)); //项目名去重 - checkNameOperation(baseProjName,baseProjId); - GovOperationProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo,GovOperationProjectBaseinfo.class); + checkNameOperation(baseProjName, baseProjId); + GovOperationProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo, GovOperationProjectBaseinfo.class); saveBase.setBaseProjName(baseProjName); saveBase.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - if(Objects.nonNull(oldBaseInfo)){ + if (Objects.nonNull(oldBaseInfo)) { saveBase.setId(oldBaseInfo.getId()); saveBase.setBaseAreaCode(null); - }else{ + } else { saveBase.setBaseAreaCode(baseAreaCode); saveBase.setTongTime(LocalDateTime.now()); - saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(),RegionConst.RL_COUNTY)); + saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); } saveBase.setAreaCode(RegionConst.RC_LS); saveBase.setBizTime(LocalDateTime.now()); @@ -934,7 +938,7 @@ public class GovProjectCollectionManage { saveBase.setUpdateOn(LocalDateTime.now()); //如果是新增的话 要生成 项目编号 - if(StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)){ + if (StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)) { baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); saveBase.setBaseProjId(baseProjId); } @@ -943,22 +947,22 @@ public class GovProjectCollectionManage { // 2.保存 申报信息 GovBizProjectApplyDTO apply = saveDTO.getApply(); - if(Objects.nonNull(apply)){ + if (Objects.nonNull(apply)) { apply.setBaseProjId(baseProjId); apply.setBaseProjName(baseProjName); GovBizProjectApply oldApply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) .eq(GovBizProjectApply::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - GovBizProjectApply saveApply = BeanUtil.copyProperties(apply,GovBizProjectApply.class); + GovBizProjectApply saveApply = BeanUtil.copyProperties(apply, GovBizProjectApply.class); saveApply.setBaseProjId(baseProjId); - if(Objects.nonNull(oldApply)){ + if (Objects.nonNull(oldApply)) { saveApply.setId(oldApply.getId()); - }else{ + } else { saveApply.setTongTime(LocalDateTime.now()); } - if(Objects.nonNull(saveApply.getBaseProjStartTime()) && - Objects.nonNull(saveApply.getBaseProjEndTime())){ + if (Objects.nonNull(saveApply.getBaseProjStartTime()) && + Objects.nonNull(saveApply.getBaseProjEndTime())) { saveApply.setBaseProjDuration(convertMonth(saveApply.getBaseProjStartTime(), saveApply.getBaseProjEndTime())); } @@ -966,39 +970,39 @@ public class GovProjectCollectionManage { saveApply.setBizTime(LocalDateTime.now()); saveApply.setUpdateBy(user.getUsername()); saveApply.setUpdateOn(LocalDateTime.now()); - if(projectApplyService.saveOrUpdate(saveApply)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApply(apply,oldApply,saveApply)); + if (projectApplyService.saveOrUpdate(saveApply)) { + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApply(apply, oldApply, saveApply)); } } // 3.保存 审批信息 GovBizProjectApproveDTO approve = saveDTO.getApprove(); - if(Objects.nonNull(approve)){ + if (Objects.nonNull(approve)) { approve.setBaseProjId(baseProjId); approve.setBaseProjName(baseProjName); GovBizProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) .eq(GovBizProjectApprove::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - GovBizProjectApprove saveApprove = BeanUtil.copyProperties(approve,GovBizProjectApprove.class); + GovBizProjectApprove saveApprove = BeanUtil.copyProperties(approve, GovBizProjectApprove.class); saveApprove.setBaseProjId(baseProjId); - if(Objects.nonNull(oldApprove)){ + if (Objects.nonNull(oldApprove)) { saveApprove.setId(oldApprove.getId()); - }else{ + } else { saveApprove.setTongTime(LocalDateTime.now()); } saveApprove.setBizTime(LocalDateTime.now()); saveApprove.setAreaCode(RegionConst.RC_LS); saveApprove.setUpdateBy(user.getUsername()); saveApprove.setUpdateOn(LocalDateTime.now()); - if(approveService.saveOrUpdate(saveApprove)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApprove(approve,oldApprove,saveApprove)); + if (approveService.saveOrUpdate(saveApprove)) { + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApprove(approve, oldApprove, saveApprove)); } } // 4.保存 建设项目 实施信息 GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); - if(Objects.nonNull(cimplement)){ + if (Objects.nonNull(cimplement)) { cimplement.setBaseProjId(baseProjId); cimplement.setBaseProjName(baseProjName); cimplement.setBaseBidCode(baseProjId); @@ -1007,27 +1011,27 @@ public class GovProjectCollectionManage { .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - GovBizProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,GovBizProjectCimplement.class); + GovBizProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement, GovBizProjectCimplement.class); saveCimplement.setBaseProjId(baseProjId); saveCimplement.setBaseBidCode(baseProjId); saveCimplement.setBaseBidName(baseProjName); - if(Objects.nonNull(oldCimplement)){ + if (Objects.nonNull(oldCimplement)) { saveCimplement.setId(oldCimplement.getId()); - }else{ + } else { saveCimplement.setTongTime(LocalDateTime.now()); } saveCimplement.setAreaCode(RegionConst.RC_LS); saveCimplement.setBizTime(LocalDateTime.now()); saveCimplement.setUpdateBy(user.getUsername()); saveCimplement.setUpdateOn(LocalDateTime.now()); - if(cimplementService.saveOrUpdate(saveCimplement)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement)); + if (cimplementService.saveOrUpdate(saveCimplement)) { + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssCimplement(cimplement, oldCimplement, saveCimplement)); } } // 5.保存 运维项目 实施信息 GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); - if(Objects.nonNull(mimplement)){ + if (Objects.nonNull(mimplement)) { mimplement.setBaseProjId(baseProjId); mimplement.setBaseProjName(baseProjName); mimplement.setBaseBidCode(baseProjId); @@ -1036,43 +1040,43 @@ public class GovProjectCollectionManage { .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - GovBizProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,GovBizProjectMimplement.class); + GovBizProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement, GovBizProjectMimplement.class); saveMimplement.setBaseProjId(baseProjId); saveMimplement.setBaseBidCode(baseProjId); saveMimplement.setBaseBidName(baseProjName); - if(Objects.nonNull(oldMimplement)){ + if (Objects.nonNull(oldMimplement)) { saveMimplement.setId(oldMimplement.getId()); - }else{ + } else { saveMimplement.setTongTime(LocalDateTime.now()); } - if(Objects.nonNull(saveBase.getAreaCode())){ + if (Objects.nonNull(saveBase.getAreaCode())) { saveMimplement.setAreaCode(saveBase.getAreaCode()); } saveMimplement.setAreaCode(RegionConst.RC_LS); saveMimplement.setBizTime(LocalDateTime.now()); saveMimplement.setUpdateBy(user.getUsername()); saveMimplement.setUpdateOn(LocalDateTime.now()); - if(mimplementService.saveOrUpdate(saveMimplement)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssMimplement(mimplement,oldMimplement,saveMimplement)); + if (mimplementService.saveOrUpdate(saveMimplement)) { + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssMimplement(mimplement, oldMimplement, saveMimplement)); } } // 6.保存 采购信息 List procures = saveDTO.getProcures(); - if(Objects.nonNull(procures)){ + if (Objects.nonNull(procures)) { procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId,baseProjId)); + .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); String finalBaseProjId = baseProjId; UserInfoDetails finalUser = user; Integer index = 1; - for(GovBizProjectProcureDTO procure : procures){ + for (GovBizProjectProcureDTO procure : procures) { procure.setBaseProjId(finalBaseProjId); procure.setBaseProjName(baseProjName); - procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); - GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); + procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); + GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure, GovBizProjectProcure.class); saveProcure.setBaseProjId(finalBaseProjId); saveProcure.setId(null); saveProcure.setAreaCode(RegionConst.RC_LS); @@ -1080,8 +1084,8 @@ public class GovProjectCollectionManage { saveProcure.setBizTime(LocalDateTime.now()); saveProcure.setUpdateBy(finalUser.getUsername()); saveProcure.setUpdateOn(LocalDateTime.now()); - if(procureService.save(saveProcure)){ - threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure,null,saveProcure)); + if (procureService.save(saveProcure)) { + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure, null, saveProcure)); } index++; } @@ -1091,7 +1095,7 @@ public class GovProjectCollectionManage { //7. 推送数据(改为定时推送了) // pushProject(saveDTO); //如果是草稿箱来的 就要删除 - if(Objects.nonNull(saveDTO.getDraftId())){ + if (Objects.nonNull(saveDTO.getDraftId())) { operationProjectDraftService.removeById(saveDTO.getDraftId()); } @@ -1100,6 +1104,7 @@ public class GovProjectCollectionManage { /** * 计算2个时间的月份 + * * @param baseProjStartTime * @param baseProjEndTime * @return @@ -1116,12 +1121,13 @@ public class GovProjectCollectionManage { /** * 暂存草稿箱 + * * @param saveDTO * @param user * @return */ public String draft(GovBizProjectSaveDTO saveDTO, UserInfoDetails user) { - if(Objects.isNull(user)){ + if (Objects.isNull(user)) { user = LoginUserUtil.loginUserDetail(); } @@ -1129,11 +1135,11 @@ public class GovProjectCollectionManage { //草稿id Long draftId = saveDTO.getDraftId(); String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; - if(Objects.nonNull(draftId)){ + if (Objects.nonNull(draftId)) { GovBizProjectDraft oldDraft = draftService.getById(draftId); VUtils.isTrue(Objects.isNull(oldDraft)).throwMessage("该草稿不存在!"); draft.setId(draftId); - }else{ + } else { draft.setTongTime(LocalDateTime.now()); draft.setBaseAreaCode(baseAreaCode); draft.setCreateId(user.getUserId()); @@ -1145,7 +1151,7 @@ public class GovProjectCollectionManage { String baseProjId = base.getBaseProjId(); String baseProjName = base.getBaseProjName(); //要生成 草稿的项目编号 - if(StringUtils.isBlank(baseProjId)){ + if (StringUtils.isBlank(baseProjId)) { baseProjId = BizProjectContant.ProjectCollection.DRAFT; } @@ -1161,7 +1167,7 @@ public class GovProjectCollectionManage { // 4.保存 建设项目 实施信息 GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); - if(Objects.nonNull(cimplement)){ + if (Objects.nonNull(cimplement)) { BeanUtil.copyProperties(cimplement, draft, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); draft.setBaseBidCode(baseProjId + "-1"); @@ -1179,7 +1185,7 @@ public class GovProjectCollectionManage { // 5.保存 运维项目 实施信息 GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); - if(Objects.nonNull(mimplement)){ + if (Objects.nonNull(mimplement)) { BeanUtil.copyProperties(mimplement, draft, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); draft.setBaseLogAggregationMimplement(mimplement.getBaseLogAggregation()); @@ -1196,7 +1202,7 @@ public class GovProjectCollectionManage { // 6.保存 采购信息 List procures = saveDTO.getProcures(); - if(Objects.nonNull(procures)){ + if (Objects.nonNull(procures)) { draft.setProcure(JSON.toJSONString(procures)); } @@ -1218,7 +1224,7 @@ public class GovProjectCollectionManage { } public String operationDraft(GovOperationProjectSaveDTO saveDTO, UserInfoDetails user) { - if(Objects.isNull(user)){ + if (Objects.isNull(user)) { user = LoginUserUtil.loginUserDetail(); } @@ -1226,11 +1232,11 @@ public class GovProjectCollectionManage { //草稿id Long draftId = saveDTO.getDraftId(); String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; - if(Objects.nonNull(draftId)){ + if (Objects.nonNull(draftId)) { GovOperationProjectDraft oldDraft = operationProjectDraftService.getById(draftId); VUtils.isTrue(Objects.isNull(oldDraft)).throwMessage("该草稿不存在!"); draft.setId(draftId); - }else{ + } else { draft.setTongTime(LocalDateTime.now()); draft.setBaseAreaCode(baseAreaCode); draft.setCreateId(user.getUserId()); @@ -1242,7 +1248,7 @@ public class GovProjectCollectionManage { String baseProjId = base.getBaseProjId(); String baseProjName = base.getBaseProjName(); //要生成 草稿的项目编号 - if(StringUtils.isBlank(baseProjId)){ + if (StringUtils.isBlank(baseProjId)) { baseProjId = BizProjectContant.ProjectCollection.DRAFT; } @@ -1258,7 +1264,7 @@ public class GovProjectCollectionManage { // 4.保存 建设项目 实施信息 GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); - if(Objects.nonNull(cimplement)){ + if (Objects.nonNull(cimplement)) { BeanUtil.copyProperties(cimplement, draft, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); draft.setBaseBidCode(baseProjId + "-1"); @@ -1276,7 +1282,7 @@ public class GovProjectCollectionManage { // 5.保存 运维项目 实施信息 GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); - if(Objects.nonNull(mimplement)){ + if (Objects.nonNull(mimplement)) { BeanUtil.copyProperties(mimplement, draft, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); draft.setBaseLogAggregationMimplement(mimplement.getBaseLogAggregation()); @@ -1293,7 +1299,7 @@ public class GovProjectCollectionManage { // 6.保存 采购信息 List procures = saveDTO.getProcures(); - if(Objects.nonNull(procures)){ + if (Objects.nonNull(procures)) { draft.setProcure(JSON.toJSONString(procures)); } @@ -1316,6 +1322,7 @@ public class GovProjectCollectionManage { /** * 删除项目归集 + * * @param projId * @return */ @@ -1326,7 +1333,7 @@ public class GovProjectCollectionManage { GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getBaseProjId, projId) .last(BizConst.LIMIT_1)); - + VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("项目不存在!"); //改正逻辑删除 @@ -1335,32 +1342,33 @@ public class GovProjectCollectionManage { baseinfo.setUpdateOn(LocalDateTime.now()); baseinfoService.updateById(baseinfo); projectApplyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId,projId) - .set(GovBizProjectApply::getDeleted,Boolean.TRUE) - .set(GovBizProjectApply::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectApply::getUpdateBy,username)); + .eq(GovBizProjectApply::getBaseProjId, projId) + .set(GovBizProjectApply::getDeleted, Boolean.TRUE) + .set(GovBizProjectApply::getUpdateOn, LocalDateTime.now()) + .set(GovBizProjectApply::getUpdateBy, username)); approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId,projId) - .set(GovBizProjectApprove::getDeleted,Boolean.TRUE) - .set(GovBizProjectApprove::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectApprove::getUpdateBy,username)); + .eq(GovBizProjectApprove::getBaseProjId, projId) + .set(GovBizProjectApprove::getDeleted, Boolean.TRUE) + .set(GovBizProjectApprove::getUpdateOn, LocalDateTime.now()) + .set(GovBizProjectApprove::getUpdateBy, username)); cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId,projId) - .set(GovBizProjectCimplement::getDeleted,Boolean.TRUE) - .set(GovBizProjectCimplement::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectCimplement::getUpdateBy,username)); + .eq(GovBizProjectCimplement::getBaseProjId, projId) + .set(GovBizProjectCimplement::getDeleted, Boolean.TRUE) + .set(GovBizProjectCimplement::getUpdateOn, LocalDateTime.now()) + .set(GovBizProjectCimplement::getUpdateBy, username)); mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId,projId) - .set(GovBizProjectMimplement::getDeleted,Boolean.TRUE) - .set(GovBizProjectMimplement::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectMimplement::getUpdateBy,username)); + .eq(GovBizProjectMimplement::getBaseProjId, projId) + .set(GovBizProjectMimplement::getDeleted, Boolean.TRUE) + .set(GovBizProjectMimplement::getUpdateOn, LocalDateTime.now()) + .set(GovBizProjectMimplement::getUpdateBy, username)); procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId,projId) - .set(GovBizProjectProcure::getDeleted,Boolean.TRUE) - .set(GovBizProjectProcure::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectProcure::getUpdateBy,username)); + .eq(GovBizProjectProcure::getBaseProjId, projId) + .set(GovBizProjectProcure::getDeleted, Boolean.TRUE) + .set(GovBizProjectProcure::getUpdateOn, LocalDateTime.now()) + .set(GovBizProjectProcure::getUpdateBy, username)); return BizConst.OP_SUCCESS; } + public String operationRemove(String projId) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); String username = user.getUsername(); @@ -1378,47 +1386,48 @@ public class GovProjectCollectionManage { operationProjectBaseinfoService.updateById(baseinfo); projectApplyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId,projId) - .set(GovBizProjectApply::getDeleted,Boolean.TRUE) - .set(GovBizProjectApply::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectApply::getUpdateBy,username)); + .eq(GovBizProjectApply::getBaseProjId, projId) + .set(GovBizProjectApply::getDeleted, Boolean.TRUE) + .set(GovBizProjectApply::getUpdateOn, LocalDateTime.now()) + .set(GovBizProjectApply::getUpdateBy, username)); approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId,projId) - .set(GovBizProjectApprove::getDeleted,Boolean.TRUE) - .set(GovBizProjectApprove::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectApprove::getUpdateBy,username)); + .eq(GovBizProjectApprove::getBaseProjId, projId) + .set(GovBizProjectApprove::getDeleted, Boolean.TRUE) + .set(GovBizProjectApprove::getUpdateOn, LocalDateTime.now()) + .set(GovBizProjectApprove::getUpdateBy, username)); cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId,projId) - .set(GovBizProjectCimplement::getDeleted,Boolean.TRUE) - .set(GovBizProjectCimplement::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectCimplement::getUpdateBy,username)); + .eq(GovBizProjectCimplement::getBaseProjId, projId) + .set(GovBizProjectCimplement::getDeleted, Boolean.TRUE) + .set(GovBizProjectCimplement::getUpdateOn, LocalDateTime.now()) + .set(GovBizProjectCimplement::getUpdateBy, username)); mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId,projId) - .set(GovBizProjectMimplement::getDeleted,Boolean.TRUE) - .set(GovBizProjectMimplement::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectMimplement::getUpdateBy,username)); + .eq(GovBizProjectMimplement::getBaseProjId, projId) + .set(GovBizProjectMimplement::getDeleted, Boolean.TRUE) + .set(GovBizProjectMimplement::getUpdateOn, LocalDateTime.now()) + .set(GovBizProjectMimplement::getUpdateBy, username)); procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId,projId) - .set(GovBizProjectProcure::getDeleted,Boolean.TRUE) - .set(GovBizProjectProcure::getUpdateOn,LocalDateTime.now()) - .set(GovBizProjectProcure::getUpdateBy,username)); + .eq(GovBizProjectProcure::getBaseProjId, projId) + .set(GovBizProjectProcure::getDeleted, Boolean.TRUE) + .set(GovBizProjectProcure::getUpdateOn, LocalDateTime.now()) + .set(GovBizProjectProcure::getUpdateBy, username)); return BizConst.OP_SUCCESS; } /** * 项目归集 草稿箱删除 + * * @param draftId * @return */ public String draftRemove(Long draftId) { - if(draftService.removeById(draftId)){ + if (draftService.removeById(draftId)) { return BizConst.OP_SUCCESS; } return BizConst.OP_FAIL; } public String operationDraftRemove(Long draftId) { - if(operationProjectDraftService.removeById(draftId)){ + if (operationProjectDraftService.removeById(draftId)) { return BizConst.OP_SUCCESS; } return BizConst.OP_FAIL; @@ -1426,92 +1435,95 @@ public class GovProjectCollectionManage { private void checkName(String baseProjName, String baseProjId) { VUtils.isTrue(baseinfoService.count(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjName,baseProjName) - .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) - .ne(GovBizProjectBaseinfo::getBaseProjId,baseProjId)) > 0L) + .eq(GovBizProjectBaseinfo::getBaseProjName, baseProjName) + .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) + .ne(GovBizProjectBaseinfo::getBaseProjId, baseProjId)) > 0L) .throwMessage("项目名重复"); } private void checkNameOperation(String baseProjName, String baseProjId) { VUtils.isTrue(operationProjectBaseinfoService.count(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) - .eq(GovOperationProjectBaseinfo::getBaseProjName,baseProjName) - .eq(GovOperationProjectBaseinfo::getDeleted,Boolean.FALSE) - .ne(GovOperationProjectBaseinfo::getBaseProjId,baseProjId)) > 0L) + .eq(GovOperationProjectBaseinfo::getBaseProjName, baseProjName) + .eq(GovOperationProjectBaseinfo::getDeleted, Boolean.FALSE) + .ne(GovOperationProjectBaseinfo::getBaseProjId, baseProjId)) > 0L) .throwMessage("项目名重复"); } /** * 推送项目 + * * @param saveDTO */ public void pushProject(GovBizProjectSaveDTO saveDTO) { String url = pushUrl; ProjectPushReq req = ProjectConvert.convert(saveDTO); - try{ - log.info("推送消息体 {} ,{},{}",saveDTO.getBaseProjId(),url, JSON.toJSONString(req)); + try { + log.info("推送消息体 {} ,{},{}", saveDTO.getBaseProjId(), url, JSON.toJSONString(req)); HttpHeaders headers = new HttpHeaders(); MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); headers.setContentType(type); headers.add("Accept", MediaType.APPLICATION_JSON.toString()); HttpEntity formEntity = new HttpEntity(req, headers); ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); - log.info("推送结果 {} :{}",saveDTO.getBaseProjId(),response); - }catch (Exception e){ - log.info("推送失败,{}",e.getMessage()); + log.info("推送结果 {} :{}", saveDTO.getBaseProjId(), response); + } catch (Exception e) { + log.info("推送失败,{}", e.getMessage()); } } + public void pushProjectVo(GovBizProjectDetailVO vo) { String url = pushUrl; ProjectPushReq req = ProjectConvert.convertWithConvertPdf(vo); - try{ - log.info("推送消息体 {} ,{},{}",vo.getBaseProjId(),url, JSON.toJSONString(req)); + try { + log.info("推送消息体 {} ,{},{}", vo.getBaseProjId(), url, JSON.toJSONString(req)); HttpHeaders headers = new HttpHeaders(); MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); headers.setContentType(type); headers.add("Accept", MediaType.APPLICATION_JSON.toString()); HttpEntity formEntity = new HttpEntity(req, headers); ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); - log.info("推送结果 {} :{}",vo.getBaseProjId(),response); - }catch (Exception e){ - log.info("推送失败,{}",e.getMessage()); + log.info("推送结果 {} :{}", vo.getBaseProjId(), response); + } catch (Exception e) { + log.info("推送失败,{}", e.getMessage()); } } public void pushProjectVo(GovOperationProjectDetailVO vo) { String url = pushUrl; ProjectPushReq req = ProjectConvert.convertWithConvertPdf(vo); - try{ - log.info("推送消息体 {} ,{},{}",vo.getBaseProjId(),url, JSON.toJSONString(req)); + try { + log.info("推送消息体 {} ,{},{}", vo.getBaseProjId(), url, JSON.toJSONString(req)); HttpHeaders headers = new HttpHeaders(); MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); headers.setContentType(type); headers.add("Accept", MediaType.APPLICATION_JSON.toString()); HttpEntity formEntity = new HttpEntity(req, headers); ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); - log.info("推送结果 {} :{}",vo.getBaseProjId(),response); - }catch (Exception e){ - log.info("推送失败,{}",e.getMessage()); + log.info("推送结果 {} :{}", vo.getBaseProjId(), response); + } catch (Exception e) { + log.info("推送失败,{}", e.getMessage()); } } /** * 把项目置为无效 + * * @param baseinfo */ private void notEffectiveProject(GovBizProjectBaseinfoDTO baseinfo) { String url = noEffectiveUrl; - ProjectBaseInfoReq req = ProjectConvert.convertBase(baseinfo,BizProjectContant.NOT_EFFECTIVE_CODE); - try{ - log.info("推送消息体 {},{},{}",baseinfo.getBaseProjId(),url, JSON.toJSONString(req)); + ProjectBaseInfoReq req = ProjectConvert.convertBase(baseinfo, BizProjectContant.NOT_EFFECTIVE_CODE); + try { + log.info("推送消息体 {},{},{}", baseinfo.getBaseProjId(), url, JSON.toJSONString(req)); HttpHeaders headers = new HttpHeaders(); MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); headers.setContentType(type); headers.add("Accept", MediaType.APPLICATION_JSON.toString()); HttpEntity formEntity = new HttpEntity(req, headers); ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); - log.info("推送结果 {} :{}",baseinfo.getBaseProjId(),response); - }catch (Exception e){ - log.info("推送失败,{}",e.getMessage()); + log.info("推送结果 {} :{}", baseinfo.getBaseProjId(), response); + } catch (Exception e) { + log.info("推送失败,{}", e.getMessage()); } } @@ -1533,28 +1545,29 @@ public class GovProjectCollectionManage { /** * 上传项目归集申报的文件到OSS 前提还要先转为PDF + * * @param apply * @param oldApply */ private void uploadFileToProvincialOssApply(GovBizProjectApplyDTO apply, - GovBizProjectApply oldApply,GovBizProjectApply saveApply) { - if(checkFieldNotPdf(apply.getBaseProjBasisFile(),oldApply,"baseProjBasisFile")){ + GovBizProjectApply oldApply, GovBizProjectApply saveApply) { + if (checkFieldNotPdf(apply.getBaseProjBasisFile(), oldApply, "baseProjBasisFile")) { StringJoiner sj = convertAndUpload(apply.getBaseProjBasisFile()); saveApply.setBaseProjBasisFilePdf(sj.toString()); } - if(checkFieldNotPdf(apply.getBaseProjApplyFile(),oldApply,"baseProjApplyFile")){ + if (checkFieldNotPdf(apply.getBaseProjApplyFile(), oldApply, "baseProjApplyFile")) { StringJoiner sj = convertAndUpload(apply.getBaseProjApplyFile()); saveApply.setBaseProjApplyFilePdf(sj.toString()); } - if(checkFieldNotPdf(apply.getBaseOperatMaintenFile(),oldApply,"baseOperatMaintenFile")){ + if (checkFieldNotPdf(apply.getBaseOperatMaintenFile(), oldApply, "baseOperatMaintenFile")) { StringJoiner sj = convertAndUpload(apply.getBaseOperatMaintenFile()); saveApply.setBaseOperatMaintenFilePdf(sj.toString()); } - if(checkFieldNotPdf(apply.getBaseResearchReportFile(),oldApply,"baseResearchReportFile")){ + if (checkFieldNotPdf(apply.getBaseResearchReportFile(), oldApply, "baseResearchReportFile")) { StringJoiner sj = convertAndUpload(apply.getBaseResearchReportFile()); saveApply.setBaseResearchReportFilePdf(sj.toString()); } - if(checkFieldNotPdf(apply.getBaseProjOtherFile(),oldApply,"baseProjOtherFile")){ + if (checkFieldNotPdf(apply.getBaseProjOtherFile(), oldApply, "baseProjOtherFile")) { StringJoiner sj = convertAndUpload(apply.getBaseProjOtherFile()); saveApply.setBaseProjOtherFilePdf(sj.toString()); } @@ -1562,15 +1575,15 @@ public class GovProjectCollectionManage { } private void uploadFileToProvincialOssApprove(GovBizProjectApproveDTO approve, GovBizProjectApprove oldApprove, GovBizProjectApprove saveApprove) { - if(checkFieldNotPdf(approve.getApprovalFile(),oldApprove,"approvalFile")){ + if (checkFieldNotPdf(approve.getApprovalFile(), oldApprove, "approvalFile")) { StringJoiner sj = convertAndUpload(approve.getApprovalFile()); saveApprove.setApprovalFilePdf(sj.toString()); } - if(checkFieldNotPdf(approve.getBaseReviewCommentsFile(),oldApprove,"baseReviewCommentsFile")){ + if (checkFieldNotPdf(approve.getBaseReviewCommentsFile(), oldApprove, "baseReviewCommentsFile")) { StringJoiner sj = convertAndUpload(approve.getBaseReviewCommentsFile()); saveApprove.setBaseReviewCommentsFilePdf(sj.toString()); } - if(checkFieldNotPdf(approve.getPreliminaryDesignFile(),oldApprove,"preliminaryDesignFile")){ + if (checkFieldNotPdf(approve.getPreliminaryDesignFile(), oldApprove, "preliminaryDesignFile")) { StringJoiner sj = convertAndUpload(approve.getPreliminaryDesignFile()); saveApprove.setPreliminaryDesignFilePdf(sj.toString()); } @@ -1579,63 +1592,63 @@ public class GovProjectCollectionManage { private void uploadFileToProvincialOssCimplement(GovBizProjectCimplementDTO cimplement, GovBizProjectCimplement oldCimplement, GovBizProjectCimplement saveCimplement) { - if(checkFieldNotPdf(cimplement.getBaseChanFile(),oldCimplement,"baseChanFile")){ + if (checkFieldNotPdf(cimplement.getBaseChanFile(), oldCimplement, "baseChanFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseChanFile()); saveCimplement.setBaseChanFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseCheckFile(),oldCimplement,"baseCheckFile")){ + if (checkFieldNotPdf(cimplement.getBaseCheckFile(), oldCimplement, "baseCheckFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseCheckFile()); saveCimplement.setBaseCheckFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseInforLevelFile(),oldCimplement,"baseInforLevelFile")){ + if (checkFieldNotPdf(cimplement.getBaseInforLevelFile(), oldCimplement, "baseInforLevelFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseInforLevelFile()); saveCimplement.setBaseInforLevelFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseChangeFormFile(),oldCimplement,"baseChangeFormFile")){ + if (checkFieldNotPdf(cimplement.getBaseChangeFormFile(), oldCimplement, "baseChangeFormFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseChangeFormFile()); saveCimplement.setBaseChangeFormFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseEstaSummFile(),oldCimplement,"baseEstaSummFile")){ + if (checkFieldNotPdf(cimplement.getBaseEstaSummFile(), oldCimplement, "baseEstaSummFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseEstaSummFile()); saveCimplement.setBaseEstaSummFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseEngineerPostpoFile(),oldCimplement,"baseEngineerPostpoFile")){ + if (checkFieldNotPdf(cimplement.getBaseEngineerPostpoFile(), oldCimplement, "baseEngineerPostpoFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseEngineerPostpoFile()); saveCimplement.setBaseEngineerPostpoFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseFinalExpertOpinionFile(),oldCimplement,"baseFinalExpertOpinionFile")){ + if (checkFieldNotPdf(cimplement.getBaseFinalExpertOpinionFile(), oldCimplement, "baseFinalExpertOpinionFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseFinalExpertOpinionFile()); saveCimplement.setBaseFinalExpertOpinionFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseThirdAcceptFile(),oldCimplement,"baseThirdAcceptFile")){ + if (checkFieldNotPdf(cimplement.getBaseThirdAcceptFile(), oldCimplement, "baseThirdAcceptFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseThirdAcceptFile()); saveCimplement.setBaseThirdAcceptFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseUserConsFile(),oldCimplement,"baseUserConsFile")){ + if (checkFieldNotPdf(cimplement.getBaseUserConsFile(), oldCimplement, "baseUserConsFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseUserConsFile()); saveCimplement.setBaseUserConsFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseFinanlAuditFile(),oldCimplement,"baseFinanlAuditFile")){ + if (checkFieldNotPdf(cimplement.getBaseFinanlAuditFile(), oldCimplement, "baseFinanlAuditFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseFinanlAuditFile()); saveCimplement.setBaseFinanlAuditFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseEngineerPostpoFile(),oldCimplement,"baseEngineerPostpoFile")){ + if (checkFieldNotPdf(cimplement.getBaseEngineerPostpoFile(), oldCimplement, "baseEngineerPostpoFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseEngineerPostpoFile()); saveCimplement.setBaseEngineerPostpoFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseInitialOpinionFile(),oldCimplement,"baseInitialOpinionFile")){ + if (checkFieldNotPdf(cimplement.getBaseInitialOpinionFile(), oldCimplement, "baseInitialOpinionFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseInitialOpinionFile()); saveCimplement.setBaseInitialOpinionFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBasePasswAssessFile(),oldCimplement,"basePasswAssessFile")){ + if (checkFieldNotPdf(cimplement.getBasePasswAssessFile(), oldCimplement, "basePasswAssessFile")) { StringJoiner sj = convertAndUpload(cimplement.getBasePasswAssessFile()); saveCimplement.setBasePasswAssessFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseSummReportFile(),oldCimplement,"baseSummReportFile")){ + if (checkFieldNotPdf(cimplement.getBaseSummReportFile(), oldCimplement, "baseSummReportFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseSummReportFile()); saveCimplement.setBaseSummReportFilePdf(sj.toString()); } - if(checkFieldNotPdf(cimplement.getBaseIrsTestRunFile(),oldCimplement,"baseIrsTestRunFile")){ + if (checkFieldNotPdf(cimplement.getBaseIrsTestRunFile(), oldCimplement, "baseIrsTestRunFile")) { StringJoiner sj = convertAndUpload(cimplement.getBaseIrsTestRunFile()); saveCimplement.setBaseIrsTestRunFilePdf(sj.toString()); } @@ -1643,43 +1656,43 @@ public class GovProjectCollectionManage { } private void uploadFileToProvincialOssMimplement(GovBizProjectMimplementDTO mimplement, GovBizProjectMimplement oldMimplement, GovBizProjectMimplement saveMimplement) { - if(checkFieldNotPdf(mimplement.getBaseChanFile(),oldMimplement,"baseChanFile")){ + if (checkFieldNotPdf(mimplement.getBaseChanFile(), oldMimplement, "baseChanFile")) { StringJoiner sj = convertAndUpload(mimplement.getBaseChanFile()); saveMimplement.setBaseChanFilePdf(sj.toString()); } - if(checkFieldNotPdf(mimplement.getBaseInforLevelFile(),oldMimplement,"baseInforLevelFile")){ + if (checkFieldNotPdf(mimplement.getBaseInforLevelFile(), oldMimplement, "baseInforLevelFile")) { StringJoiner sj = convertAndUpload(mimplement.getBaseInforLevelFile()); saveMimplement.setBaseInforLevelFilePdf(sj.toString()); } - if(checkFieldNotPdf(mimplement.getBasePasswAssessFile(),oldMimplement,"basePasswAssessFile")){ + if (checkFieldNotPdf(mimplement.getBasePasswAssessFile(), oldMimplement, "basePasswAssessFile")) { StringJoiner sj = convertAndUpload(mimplement.getBasePasswAssessFile()); saveMimplement.setBasePasswAssessFilePdf(sj.toString()); } - if(checkFieldNotPdf(mimplement.getBaseThirdAcceptFile(),oldMimplement,"baseThirdAcceptFile")){ + if (checkFieldNotPdf(mimplement.getBaseThirdAcceptFile(), oldMimplement, "baseThirdAcceptFile")) { StringJoiner sj = convertAndUpload(mimplement.getBaseThirdAcceptFile()); saveMimplement.setBaseThirdAcceptFilePdf(sj.toString()); } - if(checkFieldNotPdf(mimplement.getBaseEstaSummFile(),oldMimplement,"baseEstaSummFile")){ + if (checkFieldNotPdf(mimplement.getBaseEstaSummFile(), oldMimplement, "baseEstaSummFile")) { StringJoiner sj = convertAndUpload(mimplement.getBaseEstaSummFile()); saveMimplement.setBaseEstaSummFilePdf(sj.toString()); } - if(checkFieldNotPdf(mimplement.getBaseUserConsFile(),oldMimplement,"baseUserConsFile")){ + if (checkFieldNotPdf(mimplement.getBaseUserConsFile(), oldMimplement, "baseUserConsFile")) { StringJoiner sj = convertAndUpload(mimplement.getBaseUserConsFile()); saveMimplement.setBaseUserConsFilePdf(sj.toString()); } - if(checkFieldNotPdf(mimplement.getBaseOperatMaintenSummFile(),oldMimplement,"baseOperatMaintenSummFile")){ + if (checkFieldNotPdf(mimplement.getBaseOperatMaintenSummFile(), oldMimplement, "baseOperatMaintenSummFile")) { StringJoiner sj = convertAndUpload(mimplement.getBaseOperatMaintenSummFile()); saveMimplement.setBaseOperatMaintenSummFilePdf(sj.toString()); } - if(checkFieldNotPdf(mimplement.getBaseFinalExpertOpinionFile(),oldMimplement,"baseFinalExpertOpinionFile")){ + if (checkFieldNotPdf(mimplement.getBaseFinalExpertOpinionFile(), oldMimplement, "baseFinalExpertOpinionFile")) { StringJoiner sj = convertAndUpload(mimplement.getBaseFinalExpertOpinionFile()); saveMimplement.setBaseFinalExpertOpinionFilePdf(sj.toString()); } - if(checkFieldNotPdf(mimplement.getBaseEngineerPostpoFile(),oldMimplement,"baseEngineerPostpoFile")){ + if (checkFieldNotPdf(mimplement.getBaseEngineerPostpoFile(), oldMimplement, "baseEngineerPostpoFile")) { StringJoiner sj = convertAndUpload(mimplement.getBaseEngineerPostpoFile()); saveMimplement.setBaseEngineerPostpoFilePdf(sj.toString()); } - if(checkFieldNotPdf(mimplement.getBaseEngineerAlterFile(),oldMimplement,"baseEngineerAlterFile")){ + if (checkFieldNotPdf(mimplement.getBaseEngineerAlterFile(), oldMimplement, "baseEngineerAlterFile")) { StringJoiner sj = convertAndUpload(mimplement.getBaseEngineerAlterFile()); saveMimplement.setBaseEngineerAlterFilePdf(sj.toString()); } @@ -1688,20 +1701,21 @@ public class GovProjectCollectionManage { /** * 采购文件处理 + * * @param procure * @param o * @param saveProcure */ private void uploadFileToProvincialOssProcure(GovBizProjectProcureDTO procure, Object o, GovBizProjectProcure saveProcure) { - if(checkFieldNotPdf(procure.getPurchaseFile(),o,"purchaseFile")){ + if (checkFieldNotPdf(procure.getPurchaseFile(), o, "purchaseFile")) { StringJoiner sj = convertAndUpload(procure.getPurchaseFile()); saveProcure.setPurchaseFilePdf(sj.toString()); } - if(checkFieldNotPdf(procure.getBiddingFile(),o,"biddingFile")){ + if (checkFieldNotPdf(procure.getBiddingFile(), o, "biddingFile")) { StringJoiner sj = convertAndUpload(procure.getBiddingFile()); saveProcure.setBiddingFilePdf(sj.toString()); } - if(checkFieldNotPdf(procure.getPurchaseContract(), o, "purchaseContract")){ + if (checkFieldNotPdf(procure.getPurchaseContract(), o, "purchaseContract")) { StringJoiner sj = convertAndUpload(procure.getPurchaseContract()); saveProcure.setPurchaseContractPdf(sj.toString()); } @@ -1711,8 +1725,8 @@ public class GovProjectCollectionManage { public StringJoiner convertAndUpload(String baseProjBasisFile) { String[] baseProjBasisFileArr = baseProjBasisFile.split(";"); StringJoiner sj = new StringJoiner(";"); - for(String bpb : baseProjBasisFileArr){ - try{ + for (String bpb : baseProjBasisFileArr) { + try { JSONArray fileArray = JSON.parseArray(bpb); fileArray.forEach(j -> { JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(j)); @@ -1720,29 +1734,29 @@ public class GovProjectCollectionManage { //如果已经是PDF 就不用转换了 byte[] btyes = null; String originalFileName = jsonObject.getString("originalFileName"); - if(StringUtils.isNotBlank(suffix) && suffix.equals("pdf")){ + if (StringUtils.isNotBlank(suffix) && suffix.equals("pdf")) { com.ningdatech.file.entity.File file = fileService.getById(jsonObject.getLong("id")); - if(Objects.isNull(file)){ + if (Objects.isNull(file)) { throw new RuntimeException("转换PDF文件失败:" + originalFileName); } InputStream inputStream = fileService.getFileInputStream(file); try { btyes = IOUtils.toByteArray(inputStream); } catch (IOException e) { - throw new RuntimeException("转换PDF文件失败:" + originalFileName,e); + throw new RuntimeException("转换PDF文件失败:" + originalFileName, e); } - }else{ + } else { btyes = wpsConvertManage.downloadToPdfStream(jsonObject.getLong("id")); } - if(!BizConst.DEV.equals(active)){ + if (!BizConst.DEV.equals(active)) { originalFileName = originalFileName.replace(StrPool.DOT + suffix, ".pdf"); } // upload(btyes,"/temp",originalFileName); String oss = ProvincialManage.uploadToOss(btyes, originalFileName); sj.add(oss); }); - }catch (Exception e){ + } catch (Exception e) { log.error("解析文件出错!" + e); } @@ -1750,13 +1764,13 @@ public class GovProjectCollectionManage { return sj; } - private Boolean checkFieldNotPdf(String field, Object record, String fieldName){ - if(StringUtils.isBlank(field)){ + private Boolean checkFieldNotPdf(String field, Object record, String fieldName) { + if (StringUtils.isBlank(field)) { return Boolean.FALSE; } //如果没有老值 - if(Objects.isNull(record)){ + if (Objects.isNull(record)) { return Boolean.TRUE; } @@ -1773,12 +1787,12 @@ public class GovProjectCollectionManage { log.error("转换PDF文件出错" + e); } - if(StringUtils.isBlank(oldFiled)){ + if (StringUtils.isBlank(oldFiled)) { return Boolean.TRUE; } //如果一模一样 就不用上传了 - if(oldFiled.equals(field)){ + if (oldFiled.equals(field)) { return Boolean.FALSE; } @@ -1786,40 +1800,39 @@ public class GovProjectCollectionManage { } /** - * @param bytes byte数组 + * @param bytes byte数组 * @param fileRoute 文件路径 - * @param fileName 文件名 + * @param fileName 文件名 */ - public static void upload(byte[] bytes,String fileRoute,String fileName) { - try { - File directory=new File(fileRoute); - if (!directory.exists()){ - directory.mkdirs(); - } - File file = new File(directory, fileName); - BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file)); + public static void upload(byte[] bytes, String fileRoute, String fileName) { + File directory = new File(fileRoute); + if (!directory.exists() && directory.mkdirs()) { + log.info("文件夹创建:{}", directory.getAbsolutePath()); + } + File file = new File(directory, fileName); + try (FileOutputStream fos = new FileOutputStream(file); + BufferedOutputStream bos = new BufferedOutputStream(fos)) { bos.write(bytes); - bos.close(); } catch (IOException e) { - e.printStackTrace(); + log.error("文件上传异常", e); } } - public String rebuildProjectCode(List baseProjIds){ - if(CollUtil.isEmpty(baseProjIds)){ + public String rebuildProjectCode(List baseProjIds) { + if (CollUtil.isEmpty(baseProjIds)) { throw new BizException("项目编号不能为空"); } - Integer successNum = 0; - for(String baseProjId : baseProjIds){ + int successNum = 0; + for (String baseProjId : baseProjIds) { //两种情况 //1.项目归集 GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) .orderByDesc(GovBizProjectBaseinfo::getTongTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(baseinfo)){ + if (Objects.nonNull(baseinfo)) { rebuildGuiji(baseProjId); - successNum ++; + successNum++; } //2.运维备案 @@ -1827,9 +1840,9 @@ public class GovProjectCollectionManage { .eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) .orderByDesc(GovOperationProjectBaseinfo::getTongTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(operation)){ + if (Objects.nonNull(operation)) { rebuildOperation(baseProjId); - successNum ++; + successNum++; } } return "运行成功 重新生成" + successNum + "个项目编号"; @@ -1844,8 +1857,8 @@ public class GovProjectCollectionManage { .eq(GovBizProjectApply::getBaseProjId, baseProjId) .orderByDesc(GovBizProjectApply::getTongTime) .last(BizConst.LIMIT_1)); - if(Objects.isNull(baseinfo)){ - System.out.println("项目不存在 直接下一个"); + if (Objects.isNull(baseinfo)) { + log.warn("项目不存在跳过:{}", baseProjId); return; } GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); @@ -1862,7 +1875,7 @@ public class GovProjectCollectionManage { .eq(GovBizProjectApprove::getBaseProjId, baseProjId) .orderByDesc(GovBizProjectApprove::getTongTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(approve)){ + if (Objects.nonNull(approve)) { approve.setBaseProjId(newProjId); approveService.updateById(approve); } @@ -1872,7 +1885,7 @@ public class GovProjectCollectionManage { .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) .orderByDesc(GovBizProjectCimplement::getTongTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(cimplement)){ + if (Objects.nonNull(cimplement)) { cimplement.setBaseProjId(newProjId); cimplement.setBaseBidCode(newProjId); cimplementService.updateById(cimplement); @@ -1882,7 +1895,7 @@ public class GovProjectCollectionManage { .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) .orderByDesc(GovBizProjectMimplement::getTongTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(mimplement)){ + if (Objects.nonNull(mimplement)) { mimplement.setBaseProjId(newProjId); mimplement.setBaseBidCode(newProjId); mimplementService.updateById(mimplement); @@ -1891,7 +1904,7 @@ public class GovProjectCollectionManage { List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); - for(GovBizProjectProcure procure : procures){ + for (GovBizProjectProcure procure : procures) { procure.setBaseProjId(newProjId); procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); procureService.updateById(procure); @@ -1907,8 +1920,8 @@ public class GovProjectCollectionManage { .eq(GovBizProjectApply::getBaseProjId, baseProjId) .orderByDesc(GovBizProjectApply::getTongTime) .last(BizConst.LIMIT_1)); - if(Objects.isNull(operationBase)){ - System.out.println("运维备案项目不存在 直接下一个"); + if (Objects.isNull(operationBase)) { + log.warn("运维备案项目不存在,跳过:{}", baseProjId); return; } GovOperationProjectSaveDTO saveDTO = new GovOperationProjectSaveDTO(); @@ -1925,7 +1938,7 @@ public class GovProjectCollectionManage { .eq(GovBizProjectApprove::getBaseProjId, baseProjId) .orderByDesc(GovBizProjectApprove::getTongTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(approve)){ + if (Objects.nonNull(approve)) { approve.setBaseProjId(newProjId); approveService.updateById(approve); } @@ -1935,7 +1948,7 @@ public class GovProjectCollectionManage { .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) .orderByDesc(GovBizProjectCimplement::getTongTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(cimplement)){ + if (Objects.nonNull(cimplement)) { cimplement.setBaseProjId(newProjId); cimplement.setBaseBidCode(newProjId); cimplementService.updateById(cimplement); @@ -1945,7 +1958,7 @@ public class GovProjectCollectionManage { .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) .orderByDesc(GovBizProjectMimplement::getTongTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(mimplement)){ + if (Objects.nonNull(mimplement)) { mimplement.setBaseProjId(newProjId); mimplement.setBaseBidCode(newProjId); mimplementService.updateById(mimplement); @@ -1954,7 +1967,7 @@ public class GovProjectCollectionManage { List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); - for(GovBizProjectProcure procure : procures){ + for (GovBizProjectProcure procure : procures) { procure.setBaseProjId(newProjId); procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); procureService.updateById(procure); @@ -1962,11 +1975,11 @@ public class GovProjectCollectionManage { } public String removeProject(List projectCodes) { - if(CollUtil.isEmpty(projectCodes)){ + if (CollUtil.isEmpty(projectCodes)) { throw new BizException("项目编号不能为空!"); } - for(String projectCode : projectCodes){ + for (String projectCode : projectCodes) { //项目 List projects = projectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getProjectCode, projectCode)); @@ -1975,64 +1988,64 @@ public class GovProjectCollectionManage { //1.删除应用 applicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode,projectCode)); + .eq(ProjectApplication::getProjectCode, projectCode)); //2.删除相关流程 List projectInsts = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIds)); - for(ProjectInst projectInst : projectInsts){ + for (ProjectInst projectInst : projectInsts) { //实例 - try{ - runtimeService.deleteProcessInstance(projectInst.getInstCode(),"删除"); - }catch (Exception e){ - + try { + runtimeService.deleteProcessInstance(projectInst.getInstCode(), "删除"); + } catch (Exception e) { + log.error("删除流程实例信息失败:{}", projectInst, e); } - try{ + try { historyService.deleteHistoricProcessInstance(projectInst.getInstCode()); - }catch (Exception e){ - + } catch (Exception e) { + log.error("删除历史流程信息失败:{}", projectInst, e); } //抄送 ccTasksService.remove(Wrappers.lambdaQuery(WflowCcTasks.class) - .eq(WflowCcTasks::getInstanceId,projectInst.getInstCode())); + .eq(WflowCcTasks::getInstanceId, projectInst.getInstCode())); } projectInstService.removeByIds(projectInsts.stream().map(ProjectInst::getId).collect(Collectors.toList())); //3.删除实施表 operationService.remove(Wrappers.lambdaQuery(Operation.class) - .eq(Operation::getProjectCode,projectCode)); + .eq(Operation::getProjectCode, projectCode)); //4.删除续建项目资金表 renewalFundDeclarationService.remove(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .eq(ProjectRenewalFundDeclaration::getProjectCode,projectCode)); + .eq(ProjectRenewalFundDeclaration::getProjectCode, projectCode)); //5.暂存表 stagingService.remove(Wrappers.lambdaQuery(ProjectStaging.class) - .in(ProjectStaging::getProjectId,projectIds)); + .in(ProjectStaging::getProjectId, projectIds)); //6.状态变更表 statusChangeService.remove(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId,projectIds)); + .in(ProjectStatusChange::getProjectId, projectIds)); //7.采购表 purchaseService.remove(Wrappers.lambdaQuery(Purchase.class) - .in(Purchase::getProjectId,projectIds)); + .in(Purchase::getProjectId, projectIds)); //8.标签 projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) - .eq(ProjectTag::getProjectCode,projectCode)); + .eq(ProjectTag::getProjectCode, projectCode)); //9.初验人员 preInsAcceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) - .in(PreInsAcceptancePerson::getProjectId,projectIds)); + .in(PreInsAcceptancePerson::getProjectId, projectIds)); //10.供应商安全质量 supplierSafetyQualificationService.remove(Wrappers.lambdaQuery(SupplierSafetyQualification.class) - .eq(SupplierSafetyQualification::getProjectCode,projectCode)); + .eq(SupplierSafetyQualification::getProjectCode, projectCode)); //11.安全人员 personService.remove(Wrappers.lambdaQuery(PersonSafetyInfo.class) - .eq(PersonSafetyInfo::getProjectCode,projectCode)); + .eq(PersonSafetyInfo::getProjectCode, projectCode)); //12.最后删除项目 projectService.remove(Wrappers.lambdaQuery(Project.class) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApplyDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApplyDTO.java index e79975e..6174e25 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApplyDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApplyDTO.java @@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApproveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApproveDTO.java index 9e7cea4..6759de1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApproveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApproveDTO.java @@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectBaseinfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectBaseinfoDTO.java index 4af4932..bc1b712 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectBaseinfoDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectBaseinfoDTO.java @@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.time.LocalDateTime; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectCimplementDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectCimplementDTO.java index 5d3e06d..4d42fef 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectCimplementDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectCimplementDTO.java @@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.time.LocalDateTime; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectMimplementDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectMimplementDTO.java index 2232136..7c8a192 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectMimplementDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectMimplementDTO.java @@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.time.LocalDateTime; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectProcureDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectProcureDTO.java index cae5e17..e6621c6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectProcureDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectProcureDTO.java @@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectSaveDTO.java index 4817c8c..04a7abf 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectSaveDTO.java @@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.util.List; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectBaseinfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectBaseinfo.java index 9acc9d0..ead4c6e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectBaseinfo.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectBaseinfo.java @@ -8,7 +8,6 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; -import java.math.BigDecimal; import java.time.LocalDateTime; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java index e8fe346..9fbbcc5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java @@ -445,7 +445,7 @@ public class ExpertInviteManage { // 处理专家层级 addRegionLimit(query, randomRule); - if (expertIdsIn.size() > 0) { + if (!expertIdsIn.isEmpty()) { if (CollectionUtils.isNotEmpty(avoidRule.getExpertIds())) { expertIdsIn.removeIf(w -> avoidRule.getExpertIds().contains(w)); if (expertIdsIn.isEmpty()) { @@ -472,7 +472,7 @@ public class ExpertInviteManage { BizUtils.notEmpty(expertGroupByStatus.get(AGREED), agreeOrNoticing::addAll); BizUtils.notEmpty(expertGroupByStatus.get(NOTICING), agreeOrNoticing::addAll); List agreeOrNoticingExpertIds = CollUtils.fieldList(agreeOrNoticing, MeetingExpert::getExpertId); - if (agreeOrNoticingExpertIds.size() > 0) { + if (!agreeOrNoticingExpertIds.isEmpty()) { expertIdsNotIn.addAll(agreeOrNoticingExpertIds); List agreeOrNoticingUserInfos = expertUserFullInfoService.listByUserIds(agreeOrNoticingExpertIds); List tmpUniqCompanyCodes = CollUtils.fieldList(agreeOrNoticingUserInfos, ExpertUserFullInfo::getCompanyUniqCode); @@ -510,9 +510,9 @@ public class ExpertInviteManage { } else if (hasExpertIdNotIn) { query.notIn(ExpertUserFullInfo::getUserId, expertIdsNotIn); } - query.notIn(notInCompanyUniqCodeList.size() > 0, ExpertUserFullInfo::getCompanyUniqCode, notInCompanyUniqCodeList); + query.notIn(!notInCompanyUniqCodeList.isEmpty(), ExpertUserFullInfo::getCompanyUniqCode, notInCompanyUniqCodeList); List userFullInfos = expertUserFullInfoService.list(query); - if (userFullInfos.size() == 0) { + if (userFullInfos.isEmpty()) { return result; } Map> userGroupByUnit = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompanyUniqCode); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/ExpertInviteRuleServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/ExpertInviteRuleServiceImpl.java index 56efdb7..543103c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/ExpertInviteRuleServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/ExpertInviteRuleServiceImpl.java @@ -1,7 +1,6 @@ package com.hz.pm.api.meeting.service.impl; import cn.hutool.json.JSONUtil; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java index e6fc232..c060d0d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java @@ -6,8 +6,9 @@ import com.hz.pm.api.meta.constant.DictAllTypeEnum; import com.hz.pm.api.meta.helper.DictionaryCache; import com.hz.pm.api.meta.model.dto.DictionaryDTO; import com.hz.pm.api.meta.service.IMetaDictionaryService; +import com.ningdatech.basic.util.CollUtils; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; import java.util.List; import java.util.Map; @@ -19,10 +20,10 @@ import java.util.stream.Collectors; * @author liuxinxin * @date 2022/12/22 上午11:03 */ +@RequiredArgsConstructor public abstract class AbstractDictionaryCache implements InitializingBean, DictionaryCache { - @Autowired - private IMetaDictionaryService iMetaDictionaryService; + private final IMetaDictionaryService metaDictionaryService; protected Map dictionaryMap = new ConcurrentHashMap<>(); protected LoadingCache> dictionaryCacheHelper; @@ -30,11 +31,11 @@ public abstract class AbstractDictionaryCache implements InitializingBean, Dicti @Override public void afterPropertiesSet() { dictionaryCacheHelper = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) - .refreshAfterWrite(5, TimeUnit.MINUTES).build(key -> { - List dictionaryDTOList = iMetaDictionaryService.queryAll(); - dictionaryMap = buildCateMap(dictionaryDTOList); - Map> dictionaryTypeListMap = dictionaryDTOList.stream().collect(Collectors.groupingBy(DictionaryDTO::getDictionaryType)); - return dictionaryTypeListMap.get(key); + .refreshAfterWrite(30, TimeUnit.MINUTES).build(key -> { + List dicts = metaDictionaryService.queryAll(); + dictionaryMap = buildCateMap(dicts); + Map> dictMapByType = CollUtils.group(dicts, DictionaryDTO::getDictionaryType); + return dictMapByType.get(key); }); warmUp(); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java index 0d56774..469a93f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java @@ -7,10 +7,10 @@ import com.hz.pm.api.meta.helper.TagCache; import com.hz.pm.api.meta.model.dto.TagDTO; import com.hz.pm.api.meta.model.dto.TagTreeDTO; import com.hz.pm.api.meta.service.IMetaTagService; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -22,12 +22,12 @@ import java.util.stream.Collectors; * @date 2022/12/22 上午11:56 */ @Slf4j +@RequiredArgsConstructor public abstract class AbstractTagsCache implements InitializingBean, TagCache { protected static final int MAX_LEVEL = 4; - @Autowired - private IMetaTagService iMetaTagService; + private final IMetaTagService metaTagService; protected LoadingCache> tagsCache; @@ -39,7 +39,7 @@ public abstract class AbstractTagsCache implements InitializingBean, TagCache { .refreshAfterWrite(5, TimeUnit.MINUTES) .build(key -> { // 查询全部 - List tagDTOList = iMetaTagService.queryAll(); + List tagDTOList = metaTagService.queryAll(); if (tagDTOList.isEmpty()) { log.warn("当前层级对应树不存在:{}", key); return Collections.emptyList(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java index 89c4870..0885bd1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java @@ -3,6 +3,7 @@ package com.hz.pm.api.meta.helper.impl; import com.hz.pm.api.meta.constant.DictAllTypeEnum; import com.hz.pm.api.meta.helper.basic.AbstractDictionaryCache; import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.service.IMetaDictionaryService; import org.springframework.stereotype.Component; import java.util.List; @@ -15,6 +16,10 @@ import java.util.Objects; @Component public class DictionaryCacheImpl extends AbstractDictionaryCache { + public DictionaryCacheImpl(IMetaDictionaryService metaDictionaryService) { + super(metaDictionaryService); + } + @Override public List getDictionaryListByDictionaryType(DictAllTypeEnum dictionaryType) { return dictionaryCacheHelper.get(dictionaryType.getKey()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java index 1dd8e26..674c771 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java @@ -1,6 +1,7 @@ package com.hz.pm.api.meta.helper.impl; import cn.hutool.core.bean.BeanUtil; +import com.hz.pm.api.meta.service.IMetaTagService; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.CollUtils; import com.hz.pm.api.meta.helper.basic.AbstractTagsCache; @@ -21,6 +22,10 @@ import java.util.*; @Component public class TagsCacheImpl extends AbstractTagsCache { + public TagsCacheImpl(IMetaTagService metaTagService) { + super(metaTagService); + } + @Override public TagTreeDTO getTagTreeDTO(int level, String rootTagCode) { List tagTreeDtos = tagsCache.get(level + ""); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/GovBusinessStripController.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/GovBusinessStripController.java index 7b4b123..c13d328 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/GovBusinessStripController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/GovBusinessStripController.java @@ -1,7 +1,6 @@ package com.hz.pm.api.organization.controller; -import com.ningdatech.log.annotation.WebLog; import com.hz.pm.api.organization.manage.GovBusinessStripManage; import com.hz.pm.api.organization.model.vo.GovBusinessStripTreeVO; import com.hz.pm.api.organization.model.vo.ProvincialGovBusinessStripVO; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/helper/impl/GovBusinessStripHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/helper/impl/GovBusinessStripHelperImpl.java index 890e749..f6ef07f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/organization/helper/impl/GovBusinessStripHelperImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/helper/impl/GovBusinessStripHelperImpl.java @@ -7,10 +7,7 @@ import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; +import java.util.*; /** * @author liuxinxin @@ -29,11 +26,11 @@ public class GovBusinessStripHelperImpl implements GovBusinessStripHelper { DingOrganization dingOrganization = organizationService.getByOrgCode(organizationCode); if (Objects.isNull(dingOrganization)) { - return null; + return Collections.emptyList(); } String businessStripCodes = dingOrganization.getBusinessStripCodes(); if (StringUtils.isNotBlank(businessStripCodes)) { - String[] businessStripCodeList = businessStripCodes.split("|"); + String[] businessStripCodeList = businessStripCodes.split("\\|"); for (String businessStripCode : businessStripCodeList) { DingOrganization supGovBusinessStrip = getSupGovBusinessStrip(dingOrganization.getOrganizationCode(), businessStripCode); if (Objects.nonNull(supGovBusinessStrip)) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/GovBusinessStripManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/GovBusinessStripManage.java index e8fe06c..00954ad 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/GovBusinessStripManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/GovBusinessStripManage.java @@ -15,7 +15,6 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java index 043c4cc..603ec39 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java @@ -1,45 +1,32 @@ package com.hz.pm.api.performance.manage; -import java.io.IOException; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.CharsetUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.write.builder.ExcelWriterBuilder; -import com.hz.pm.api.common.enumeration.CommonEnum; -import com.hz.pm.api.common.util.ExcelDownUtil; -import com.hz.pm.api.performance.constant.BizConst; -import com.hz.pm.api.performance.model.req.PerformanceAppraisalExportReq; -import com.hz.pm.api.performance.util.*; -import com.hz.pm.api.portrait.model.entity.ProjectTag; -import com.hz.pm.api.portrait.service.IProjectTagService; -import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.performance.constant.BizConst; import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; import com.hz.pm.api.performance.enumration.RectifyStatusEnum; import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; import com.hz.pm.api.performance.model.dto.ProjectAppraisalInfoDTO; import com.hz.pm.api.performance.model.entity.*; +import com.hz.pm.api.performance.model.req.PerformanceAppraisalExportReq; import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; import com.hz.pm.api.performance.service.*; -import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; +import com.hz.pm.api.performance.util.*; +import com.hz.pm.api.portrait.model.entity.ProjectTag; +import com.hz.pm.api.portrait.service.IProjectTagService; +import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.sys.model.entity.Role; @@ -47,22 +34,31 @@ import com.hz.pm.api.sys.service.IRoleService; import com.hz.pm.api.user.entity.enumeration.RoleEnum; import com.hz.pm.api.user.security.auth.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.StrPool; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; /** * VerifyManage - * @return + * * @author CMM * @since 2023/08/10 8:55 */ -@Component @Slf4j +@Component @AllArgsConstructor public class VerifyManage { @@ -75,10 +71,12 @@ public class VerifyManage { private final IPerformanceAppraisalProjectGroupService groupService; private final IProjectTagService projectTagService; private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; + /** * 核查-评价计划列表 - * @param req - * @return + * + * @param req \ + * @return \ */ public PageVo list(PerformanceAppraisalListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); @@ -88,12 +86,12 @@ public class VerifyManage { List roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class) .eq(Role::getName, RoleEnum.EXPERT.getDesc())); - if (Objects.isNull(role)){ + if (Objects.isNull(role)) { throw new BizException("登录用户没有复评员角色!"); } // 登录用户不是专家,不能查看核查计划列表 - if (!roleIdList.contains(role.getId())){ + if (!roleIdList.contains(role.getId())) { return PageVo.empty(); } @@ -102,8 +100,8 @@ public class VerifyManage { List projectGroups = groupService.list(); for (PerformanceAppraisalProjectGroup projectGroup : projectGroups) { String verificationUsers = projectGroup.getVerificationUsers(); - if (verificationUsers.contains(StrPool.COMMA)){ - if (verificationUsers.contains(employeeCode)){ + if (verificationUsers.contains(StrPool.COMMA)) { + if (verificationUsers.contains(employeeCode)) { groups.add(projectGroup); } } else if (verificationUsers.equals(employeeCode)) { @@ -111,7 +109,7 @@ public class VerifyManage { } } // 当前登录专家没有绩效分组信息 - if (CollUtil.isEmpty(groups)){ + if (CollUtil.isEmpty(groups)) { return PageVo.empty(); } @@ -122,9 +120,9 @@ public class VerifyManage { // 获取核查计划列表 Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) - .in(PerformanceAppraisal::getId,appraisalIds) + .in(PerformanceAppraisal::getId, appraisalIds) .orderByDesc(PerformanceAppraisal::getUpdateOn); - performanceAppraisalService.page(page,wrapper); + performanceAppraisalService.page(page, wrapper); List res = page.getRecords().stream().map(p -> { PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class); @@ -135,7 +133,7 @@ public class VerifyManage { } return vo; }).collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } /** @@ -153,10 +151,10 @@ public class VerifyManage { // 如果没有相关的打分信息,说明是当前登录复评用户是首次核查 List scoreInfos = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode()) - .eq(PerformanceAppraisalScoreInfo::getAppraisalId,appraisalId) - .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode) + .eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) + .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) .eq(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode, employeeCode)); - if (CollUtil.isEmpty(scoreInfos)){ + if (CollUtil.isEmpty(scoreInfos)) { return true; } return Boolean.FALSE; @@ -169,7 +167,7 @@ public class VerifyManage { // 获取分组内的项目信息 PerformanceAppraisalProjectGroup projectGroup = groupService.getById(groupId); - if (Objects.isNull(projectGroup)){ + if (Objects.isNull(projectGroup)) { throw new BizException("当前核查用户所在分组不存在!"); } String projectCodes = projectGroup.getProjectCodes(); @@ -182,7 +180,7 @@ public class VerifyManage { .in(PerformanceAppraisalProject::getProjectCode, projectCodeList) .eq(PerformanceAppraisalProject::getIsCompleteReAppraisal, Boolean.TRUE)); // 分组内已完成复评的项目信息不存在 - if (CollUtil.isEmpty(appraisalProjects)){ + if (CollUtil.isEmpty(appraisalProjects)) { return PageVo.empty(); } List proCodeList = appraisalProjects.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); @@ -192,11 +190,11 @@ public class VerifyManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) .in(Project::getProjectCode, proCodeList) .eq(Project::getNewest, Boolean.TRUE) - .like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()); - projectService.page(page,wrapper); + .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); + projectService.page(page, wrapper); // 分组内项目信息不存在 - if (CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } @@ -206,17 +204,17 @@ public class VerifyManage { BeanUtil.copyProperties(appraisalProject, vo); vo.setProjectId(appraisalProject.getProjectId()); vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); - vo.setCanVerify(checkCanVerify(employeeCode,appraisalProject.getProjectCode(),appraisalId)); + vo.setCanVerify(checkCanVerify(employeeCode, appraisalProject.getProjectCode(), appraisalId)); // 如果登录用户是核查组长,该项目可填写整改意见 String verifyLeader = projectGroup.getVerifyLeader(); - if (employeeCode.equals(verifyLeader)){ + if (employeeCode.equals(verifyLeader)) { vo.setCanRectify(Boolean.TRUE); } vo.setGroupId(groupId); return vo; }) .collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } @Transactional(rollbackFor = Exception.class) @@ -234,7 +232,7 @@ public class VerifyManage { // 获取评价项目 PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) - .eq(PerformanceAppraisalProject::getProjectCode,appraisalProjectCode) + .eq(PerformanceAppraisalProject::getProjectCode, appraisalProjectCode) .eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId)); List ids = appraisalInfoList.stream() @@ -243,7 +241,7 @@ public class VerifyManage { // 查出项目模版详情信息 List detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) .in(PerformanceIndicatorProjectTemplateDetail::getId, ids)); - if (CollUtil.isEmpty(detailList)){ + if (CollUtil.isEmpty(detailList)) { throw new BizException("评价指标不存在!"); } Map detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d)); @@ -251,7 +249,7 @@ public class VerifyManage { PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId()); BigDecimal score = a.getScore(); BigDecimal indexScore = templateDetail.getIndexScore(); - if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0) { throw new BizException("核查得分必须大于等于0且小于等于指标分值!"); } // 保存核查分数信息 @@ -272,7 +270,7 @@ public class VerifyManage { return scoreInfo; }).collect(Collectors.toList()); - if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){ + if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)) { // 计算核查总分并保存 BigDecimal verifyTotalScore = appraisalInfoList.stream() .map(ProjectAppraisalInfoDTO::getScore) @@ -280,11 +278,11 @@ public class VerifyManage { .reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal lastVerifyTotalScore; // 判断项目所在分组内其他复评人员是否已经打分 - if (Objects.nonNull(appraisalProject.getVerifyTotalScore())){ + if (Objects.nonNull(appraisalProject.getVerifyTotalScore())) { // 已经进行了核查,计算两个分值的平均分 BigDecimal add = verifyTotalScore.add(appraisalProject.getReAppraisalTotalScore()); lastVerifyTotalScore = add.divide(BigDecimal.valueOf(2)); - }else { + } else { // 还没有进行过复评 lastVerifyTotalScore = verifyTotalScore; } @@ -313,9 +311,9 @@ public class VerifyManage { private void judgeCompleteVerify(PerformanceAppraisalProjectGroup group, PerformanceAppraisalProject appraisalProject) { // 获取该评价计划当前分组对该项目的核查打分信息 List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) - .eq(PerformanceAppraisalScoreInfo::getAppraisalId,group.getAppraisalId()) - .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,appraisalProject.getProjectCode()) - .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())); + .eq(PerformanceAppraisalScoreInfo::getAppraisalId, group.getAppraisalId()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, appraisalProject.getProjectCode()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())); // 判断打分人员是否为分组内的核查人员 if (CollUtil.isNotEmpty(scoreInfoList)) { @@ -355,12 +353,12 @@ public class VerifyManage { String projectTagIds = String.join(StrPool.COMMA, strIdList); Integer amountRange = null; - if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.FIVE_MILLION)) < 0){ + if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.FIVE_MILLION)) < 0) { amountRange = BizConst.AMOUNT_RANGE_ONE; } else if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.FIVE_MILLION)) >= 0 && approvalAmount.compareTo(BigDecimal.valueOf(BizConst.TWENTY_MILLION)) < 0) { amountRange = BizConst.AMOUNT_RANGE_TWO; - }else if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.TWENTY_MILLION)) >= 0){ + } else if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.TWENTY_MILLION)) >= 0) { amountRange = BizConst.AMOUNT_RANGE_THREE; } LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) @@ -368,12 +366,12 @@ public class VerifyManage { .eq(PerformanceIndicatorProjectTemplate::getProjectType, projectType) .eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear) .eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange) - .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds,projectTagIds) + .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTagIds) .eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); List templates = indicatorProjectTemplateService.list(wrapper); VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); - if (templates.size() > 1){ + if (templates.size() > 1) { throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); } PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); @@ -425,26 +423,26 @@ public class VerifyManage { if (Objects.nonNull(secondTemplateDetail)) { // 一级指标名称 Long firstId = secondTemplateDetail.getParentId(); - if (Objects.nonNull(firstId)){ + if (Objects.nonNull(firstId)) { PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = templateDetailMap.get(firstId); if (Objects.nonNull(firstTemplateDetail)) { - scoreMap.put(BizConst.FIRST_INDEX_NAME,firstTemplateDetail.getName()); - scoreMap.put(BizConst.SECOND_INDEX_NAME,secondTemplateDetail.getName()); + scoreMap.put(BizConst.FIRST_INDEX_NAME, firstTemplateDetail.getName()); + scoreMap.put(BizConst.SECOND_INDEX_NAME, secondTemplateDetail.getName()); } } } } - scoreMap.put(BizConst.THIRD_INDEX_NAME,thirdTemplateDetail.getName()); - scoreMap.put(BizConst.INDEX_SCORE,thirdTemplateDetail.getIndexScore()); - scoreMap.put(BizConst.INDEX_DETAIL,thirdTemplateDetail.getIndexDetail()); - scoreMap.put(BizConst.GRADE_DETAIL,thirdTemplateDetail.getGradeDetail()); - scoreMap.put(BizConst.SUPPORT_MATERIAL,thirdTemplateDetail.getSupportMaterial()); + scoreMap.put(BizConst.THIRD_INDEX_NAME, thirdTemplateDetail.getName()); + scoreMap.put(BizConst.INDEX_SCORE, thirdTemplateDetail.getIndexScore()); + scoreMap.put(BizConst.INDEX_DETAIL, thirdTemplateDetail.getIndexDetail()); + scoreMap.put(BizConst.GRADE_DETAIL, thirdTemplateDetail.getGradeDetail()); + scoreMap.put(BizConst.SUPPORT_MATERIAL, thirdTemplateDetail.getSupportMaterial()); PerformanceAppraisalScoreInfo appraisalScoreInfo = scoreInfoMap.get(thirdTemplateDetail.getId()); // 构建自评和复评打分信息 - if (AppraisalTypeEnum.SELF_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())){ - scoreMap.put(BizConst.SELF_APPRAISAL_BASIS,appraisalScoreInfo.getAppraisalBasis()); - scoreMap.put(BizConst.SELF_APPRAISAL_SCORE,appraisalScoreInfo.getAppraisalScore()); + if (AppraisalTypeEnum.SELF_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())) { + scoreMap.put(BizConst.SELF_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); + scoreMap.put(BizConst.SELF_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); } else if (AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())) { scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + BizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); @@ -454,13 +452,13 @@ public class VerifyManage { } if (Boolean.TRUE.equals(thirdTemplateDetail.getIsAdditional())) { - scoreMap.put(BizConst.IS_ADDITIONAL,CommonEnum.YES.getDesc()); + scoreMap.put(BizConst.IS_ADDITIONAL, CommonEnum.YES.getDesc()); } else if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { - scoreMap.put(BizConst.IS_ADDITIONAL,CommonEnum.NO.getDesc()); + scoreMap.put(BizConst.IS_ADDITIONAL, CommonEnum.NO.getDesc()); } if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { exportDataList.add(scoreMap); - }else { + } else { exportAdditionalDataList.add(scoreMap); } } @@ -472,25 +470,25 @@ public class VerifyManage { int mergeRowIndex = 2; List headList = Lists.newArrayList(); - headList.add(new ExcelHead(BizConst.FIRST_INDEX_NAME,BizConst.FIRST_INDEX_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.SECOND_INDEX_NAME,BizConst.SECOND_INDEX_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.THIRD_INDEX_NAME,BizConst.THIRD_INDEX_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.INDEX_SCORE,BizConst.INDEX_SCORE_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.INDEX_DETAIL,BizConst.INDEX_DETAIL_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.GRADE_DETAIL,BizConst.GRADE_DETAIL_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.SUPPORT_MATERIAL,BizConst.SUPPORT_MATERIAL_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.SELF_APPRAISAL_BASIS,BizConst.SELF_APPRAISAL_BASIS_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(BizConst.SELF_APPRAISAL_SCORE,BizConst.SELF_APPRAISAL_SCORE_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.FIRST_INDEX_NAME, BizConst.FIRST_INDEX_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.SECOND_INDEX_NAME, BizConst.SECOND_INDEX_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.THIRD_INDEX_NAME, BizConst.THIRD_INDEX_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.INDEX_SCORE, BizConst.INDEX_SCORE_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.INDEX_DETAIL, BizConst.INDEX_DETAIL_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.GRADE_DETAIL, BizConst.GRADE_DETAIL_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.SUPPORT_MATERIAL, BizConst.SUPPORT_MATERIAL_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.SELF_APPRAISAL_BASIS, BizConst.SELF_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.SELF_APPRAISAL_SCORE, BizConst.SELF_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); for (String reUser : reUserList) { - headList.add(new ExcelHead(reUser + BizConst.RE_APPRAISAL_BASIS,BizConst.RE_APPRAISAL_BASIS_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(reUser + BizConst.RE_APPRAISAL_SCORE,BizConst.RE_APPRAISAL_SCORE_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(reUser + BizConst.RE_APPRAISAL_BASIS, BizConst.RE_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead(reUser + BizConst.RE_APPRAISAL_SCORE, BizConst.RE_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); } for (String verifyUser : verifyUserList) { - headList.add(new ExcelHead(verifyUser + BizConst.VERIFY_BASIS,BizConst.VERIFY_BASIS_TITLE,StrPool.EMPTY)); - headList.add(new ExcelHead(verifyUser + BizConst.VERIFY_SCORE,BizConst.VERIFY_SCORE_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(verifyUser + BizConst.VERIFY_BASIS, BizConst.VERIFY_BASIS_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead(verifyUser + BizConst.VERIFY_SCORE, BizConst.VERIFY_SCORE_TITLE, StrPool.EMPTY)); } - headList.add(new ExcelHead(BizConst.IS_ADDITIONAL,BizConst.IS_ADDITIONAL_TITLE,StrPool.EMPTY)); + headList.add(new ExcelHead(BizConst.IS_ADDITIONAL, BizConst.IS_ADDITIONAL_TITLE, StrPool.EMPTY)); // 数据导出处理函数 try { @@ -500,9 +498,9 @@ public class VerifyManage { writerBuilder.file(response.getOutputStream()); writerBuilder.autoCloseStream(true); writerBuilder.registerWriteHandler(new ExcelSheetVerticalCellStyleStrategy()); - writerBuilder.registerWriteHandler(new MultiColumnMergeStrategy(exportDataList.size(),0,1)); - writerBuilder.registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex,mergeColumnIndex)); - writerBuilder.head(ExcelUtils.getHead(reUserList,verifyUserList)) + writerBuilder.registerWriteHandler(new MultiColumnMergeStrategy(exportDataList.size(), 0, 1)); + writerBuilder.registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex, mergeColumnIndex)); + writerBuilder.head(ExcelUtils.getHead(reUserList, verifyUserList)) .sheet(fileName) .doWrite(ExcelUtils.convertData(headList, exportDataList)); } catch (IOException e) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AddAppraisalObjectDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AddAppraisalObjectDTO.java index d15ef05..cd35fc1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AddAppraisalObjectDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AddAppraisalObjectDTO.java @@ -1,21 +1,15 @@ package com.hz.pm.api.performance.model.dto; -import java.io.Serializable; -import java.util.List; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.hibernate.validator.constraints.Range; - import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.io.Serializable; +import java.util.List; + /** * 评级计划-添加评价对象 - * @return + * * @author CMM * @since 2023/08/02 11:41 */ diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectConst.java new file mode 100644 index 0000000..d071ed3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectConst.java @@ -0,0 +1,79 @@ +package com.hz.pm.api.projectdeclared.contants; + +import com.google.common.collect.Lists; + +import java.util.List; + +/** + *

+ * DeclaredProjectContant + *

+ * + * @author WendyYang + * @since 14:41 2023/12/16 + */ +public interface DeclaredProjectConst { + + class ProcessDef { + + private ProcessDef() { + } + + public static final String PROJECT_STAGE_1 = "单位内部审批流程"; + + public static final String PROJECT_STAGE_2 = "项目预审审批流程"; + + public static final String PROJECT_STAGE_3 = "部门联合审批流程"; + + public static final String PROJECT_STAGE_4 = "建设方案审批流程"; + + public static final String PROJECT_STAGE_5 = "验收申报审批流程"; + } + + class Instance { + + private Instance() { + } + + public static final String PROVINCE_INSTANCE_ID = "PROVINCE_AUDIT"; + } + + class Biz { + + private Biz() { + } + + public static final String CORE_BIZ = "{\"msg\":\"操作成功\",\"code\":0,\"data\":[{\"id\":6366,\"matterOrg\":4,\"matterName\":\"信息化项目年度建设计划申报\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[{\"id\":\"947\",\"uuid\":\"5922bdbb-ae35-4f4d-b6e0-916cf01b9a6a\",\"sysName\":\"丽水市数据中心平台\"}],\"coreMaterials\":[{\"id\":11317,\"comaterialName\":\"次年信息化项目年度计划申请信息(信息化项目年度建设计划申报)\"},{\"id\":66025,\"comaterialName\":\"测试信息\"},{\"id\":70165,\"comaterialName\":\"演示系统信息\"},{\"id\":11318,\"comaterialName\":\"次年信息化项目建议书信息(信息化项目年度建设计划申报)\"},{\"id\":60284,\"comaterialName\":\"测试需求信息\"},{\"id\":60285,\"comaterialName\":\"测试需求的信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6367,\"matterOrg\":4,\"matterName\":\"信息化项目年度建设计划调整申报\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11319,\"comaterialName\":\"次年信息化项目年度计划申请信息(信息化项目年度建设计划调整申报)\"},{\"id\":11320,\"comaterialName\":\"次年信息化项目建议书信息(信息化项目年度建设计划调整申报)\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6368,\"matterOrg\":4,\"matterName\":\"信息化项目立项\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[{\"id\":\"2095\",\"uuid\":\"2b4a5100-708c-4716-b713-79be1860edf9\",\"sysName\":\"丽水市公共数据管理系统\"}],\"coreMaterials\":[{\"id\":69142,\"comaterialName\":\"演示项目信息\"},{\"id\":11321,\"comaterialName\":\"项目定密正式意见信息\"},{\"id\":11322,\"comaterialName\":\"项目数据资源承诺共享开放目录信息\"},{\"id\":11324,\"comaterialName\":\"项目申请立项正式函信息\"},{\"id\":11323,\"comaterialName\":\"项目建设方案信息(信息化项目立项)\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6369,\"matterOrg\":4,\"matterName\":\"信息化项目验收\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[{\"id\":\"1020\",\"uuid\":\"103afdd3-5078-4e8e-9f3e-8890b42d9276\",\"sysName\":\"协同平台\"}],\"coreMaterials\":[{\"id\":11325,\"comaterialName\":\"项目验收申请函信息(电子公文正式件)\"},{\"id\":11329,\"comaterialName\":\"项目初验意见书信息\"},{\"id\":11328,\"comaterialName\":\"第三方测评报告信息(立项批复投资估算>500万)\"},{\"id\":11327,\"comaterialName\":\"项目监理报告信息(立项批复投资估算>200万)\"},{\"id\":11330,\"comaterialName\":\"项目验收完整归档资料信息\"},{\"id\":60411,\"comaterialName\":\"测试数据项数量信息\"},{\"id\":69141,\"comaterialName\":\"演示验收信息\"},{\"id\":11326,\"comaterialName\":\"项目竣工报告信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6370,\"matterOrg\":4,\"matterName\":\"办公助手人员维护\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11331,\"comaterialName\":\"办公助手人员变更表单信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6371,\"matterOrg\":4,\"matterName\":\"办公助手单位新增申请\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11332,\"comaterialName\":\"办公助手单位新增申请信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6372,\"matterOrg\":4,\"matterName\":\"办公助手短信数量申请\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":17570,\"comaterialName\":\"办公助手短信数量申请信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6373,\"matterOrg\":4,\"matterName\":\"办公助手通知公告发布申请\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11335,\"comaterialName\":\"通知公告发布申请信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6374,\"matterOrg\":4,\"matterName\":\"丽水市党政机关公文交换系统单位新增\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11336,\"comaterialName\":\"公文交换系统单位新增信息\"},{\"id\":17572,\"comaterialName\":\"公章替换说明函信息\"},{\"id\":17571,\"comaterialName\":\"机关代字(红头文号)模板信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6375,\"matterOrg\":4,\"matterName\":\"丽水市党政机关协同办公系统人员维护\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11337,\"comaterialName\":\"协同办公系统人员变更信息\"}],\"page\":null,\"limit\":null,\"startRow\":null}],\"total\":10}"; + } + + class Project{ + + private Project() { + } + + public static final Integer YEAR_THREE = 2; + public static final Integer YEAR_FOUR = 4; + + public static final Integer YEAR_DRAW_SURPLUS = 100; + + public static final String FIXED_NUMBER = "0130"; + public static final Long MAX_PROJECT_ID = 999L; + + public static final Long MIN_PROJECT_ID = 1L; + } + + class ReviewChecklist { + + private ReviewChecklist() { + } + + public static final List REVIEW_HUMANS_ZZD = Lists.newArrayList("GE_dce116d65ffe48a3aee6c14c1c5a3031", + "GE_573158a366554bdbb483f8f93d594bf7","GE_fe1cd568b453456ead00f471ecddf6a2","GE_fc1e28e29b5a4cf39c7b7c83278db6f4", + "GE_16580afcdf7d4d379fd3690ba47f3b58","GE_9c901c85eaeb42abbb485b7aa4d4358f","GE_a4c2c56ed3204600805e0f7b7dca9044"); + + public static final List REVIEW_HUMANS_ZYD = Lists.newArrayList("GE_6dc0e5a3513d41f684b6b01aeb94d887", + "GE_39be254f6cb84ad0b30c9bd5bda657d7","GE_051f5e34c0c4467b873cde517a21669b","GE_e68c7af513474eaa959b7ce7141a4d9f", + "GE_c3e4d8e8067b4fce91b28b570cffc67a","GE_809a061236b941d281446df6f14dc8f0","GE_6168943503de45919c42d46e05b24fa1"); + public static final Integer INIT_NUM = 0; + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectContant.java deleted file mode 100644 index cbb40a9..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectContant.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.hz.pm.api.projectdeclared.contants; - -import com.google.common.collect.Lists; -import com.hz.pm.api.user.entity.UserInfo; - -import java.util.List; - -public interface DeclaredProjectContant { - - class ProcessDef { - public static final String PROJECT_STAGE_1 = "单位内部审批流程"; - - public static final String PROJECT_STAGE_2 = "项目预审审批流程"; - - public static final String PROJECT_STAGE_3 = "部门联合审批流程"; - - public static final String PROJECT_STAGE_4 = "建设方案审批流程"; - - public static final String PROJECT_STAGE_5 = "验收申报审批流程"; - } - - class Instance { - public static final String PROVINCE_INSTANCE_ID = "PROVINCE_AUDIT"; - } - - class Biz { - public static final String CORE_BIZ = "{\"msg\":\"操作成功\",\"code\":0,\"data\":[{\"id\":6366,\"matterOrg\":4,\"matterName\":\"信息化项目年度建设计划申报\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[{\"id\":\"947\",\"uuid\":\"5922bdbb-ae35-4f4d-b6e0-916cf01b9a6a\",\"sysName\":\"丽水市数据中心平台\"}],\"coreMaterials\":[{\"id\":11317,\"comaterialName\":\"次年信息化项目年度计划申请信息(信息化项目年度建设计划申报)\"},{\"id\":66025,\"comaterialName\":\"测试信息\"},{\"id\":70165,\"comaterialName\":\"演示系统信息\"},{\"id\":11318,\"comaterialName\":\"次年信息化项目建议书信息(信息化项目年度建设计划申报)\"},{\"id\":60284,\"comaterialName\":\"测试需求信息\"},{\"id\":60285,\"comaterialName\":\"测试需求的信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6367,\"matterOrg\":4,\"matterName\":\"信息化项目年度建设计划调整申报\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11319,\"comaterialName\":\"次年信息化项目年度计划申请信息(信息化项目年度建设计划调整申报)\"},{\"id\":11320,\"comaterialName\":\"次年信息化项目建议书信息(信息化项目年度建设计划调整申报)\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6368,\"matterOrg\":4,\"matterName\":\"信息化项目立项\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[{\"id\":\"2095\",\"uuid\":\"2b4a5100-708c-4716-b713-79be1860edf9\",\"sysName\":\"丽水市公共数据管理系统\"}],\"coreMaterials\":[{\"id\":69142,\"comaterialName\":\"演示项目信息\"},{\"id\":11321,\"comaterialName\":\"项目定密正式意见信息\"},{\"id\":11322,\"comaterialName\":\"项目数据资源承诺共享开放目录信息\"},{\"id\":11324,\"comaterialName\":\"项目申请立项正式函信息\"},{\"id\":11323,\"comaterialName\":\"项目建设方案信息(信息化项目立项)\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6369,\"matterOrg\":4,\"matterName\":\"信息化项目验收\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[{\"id\":\"1020\",\"uuid\":\"103afdd3-5078-4e8e-9f3e-8890b42d9276\",\"sysName\":\"协同平台\"}],\"coreMaterials\":[{\"id\":11325,\"comaterialName\":\"项目验收申请函信息(电子公文正式件)\"},{\"id\":11329,\"comaterialName\":\"项目初验意见书信息\"},{\"id\":11328,\"comaterialName\":\"第三方测评报告信息(立项批复投资估算>500万)\"},{\"id\":11327,\"comaterialName\":\"项目监理报告信息(立项批复投资估算>200万)\"},{\"id\":11330,\"comaterialName\":\"项目验收完整归档资料信息\"},{\"id\":60411,\"comaterialName\":\"测试数据项数量信息\"},{\"id\":69141,\"comaterialName\":\"演示验收信息\"},{\"id\":11326,\"comaterialName\":\"项目竣工报告信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6370,\"matterOrg\":4,\"matterName\":\"办公助手人员维护\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11331,\"comaterialName\":\"办公助手人员变更表单信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6371,\"matterOrg\":4,\"matterName\":\"办公助手单位新增申请\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11332,\"comaterialName\":\"办公助手单位新增申请信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6372,\"matterOrg\":4,\"matterName\":\"办公助手短信数量申请\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":17570,\"comaterialName\":\"办公助手短信数量申请信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6373,\"matterOrg\":4,\"matterName\":\"办公助手通知公告发布申请\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11335,\"comaterialName\":\"通知公告发布申请信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6374,\"matterOrg\":4,\"matterName\":\"丽水市党政机关公文交换系统单位新增\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11336,\"comaterialName\":\"公文交换系统单位新增信息\"},{\"id\":17572,\"comaterialName\":\"公章替换说明函信息\"},{\"id\":17571,\"comaterialName\":\"机关代字(红头文号)模板信息\"}],\"page\":null,\"limit\":null,\"startRow\":null},{\"id\":6375,\"matterOrg\":4,\"matterName\":\"丽水市党政机关协同办公系统人员维护\",\"matterCode\":\"\",\"attribute\":\"1\",\"busiRate\":\"\",\"otherRate\":\"\",\"useState\":\"1\",\"orgName\":\"市大数据局\",\"oid\":\"40285881636932d30163694f7f4e125d\",\"dingCode\":\"GO_6c383c049d95461f9a0df780140ceb32\",\"areaName\":\"丽水市\",\"systems\":[],\"coreMaterials\":[{\"id\":11337,\"comaterialName\":\"协同办公系统人员变更信息\"}],\"page\":null,\"limit\":null,\"startRow\":null}],\"total\":10}"; - } - - class Project{ - public static final Integer YEAR_THREE = 2; - public static final Integer YEAR_FOUR = 4; - - public static final Integer YEAR_DRAW_SURPLUS = 100; - - public static final String FIXED_NUMBER = "0130"; - public static final Long MAX_PROJECT_ID = 999L; - - public static final Long MIN_PROJECT_ID = 1L; - } - - class ReviewChecklist { - public static final List REVIEW_HUMANS_ZZD = Lists.newArrayList("GE_dce116d65ffe48a3aee6c14c1c5a3031", - "GE_573158a366554bdbb483f8f93d594bf7","GE_fe1cd568b453456ead00f471ecddf6a2","GE_fc1e28e29b5a4cf39c7b7c83278db6f4", - "GE_16580afcdf7d4d379fd3690ba47f3b58","GE_9c901c85eaeb42abbb485b7aa4d4358f","GE_a4c2c56ed3204600805e0f7b7dca9044"); - - public static final List REVIEW_HUMANS_ZYD = Lists.newArrayList("GE_6dc0e5a3513d41f684b6b01aeb94d887", - "GE_39be254f6cb84ad0b30c9bd5bda657d7","GE_051f5e34c0c4467b873cde517a21669b","GE_e68c7af513474eaa959b7ce7141a4d9f", - "GE_c3e4d8e8067b4fce91b28b570cffc67a","GE_809a061236b941d281446df6f14dc8f0","GE_6168943503de45919c42d46e05b24fa1"); - public static final Integer INIT_NUM = 0; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java index 43fa3ea..73359c4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java @@ -26,15 +26,12 @@ import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.gov.manage.GovProjectCollectionManage; import com.hz.pm.api.irs.manage.ProjectIrsManage; -import com.hz.pm.api.irs.model.entity.ProjectCoreBiz; -import com.hz.pm.api.irs.service.IProjectCoreBizService; -import com.hz.pm.api.projectdeclared.contants.DeclaredProjectContant; +import com.hz.pm.api.projectdeclared.contants.DeclaredProjectConst; import com.hz.pm.api.projectdeclared.model.dto.*; import com.hz.pm.api.projectdeclared.model.entity.ProjectDraft; import com.hz.pm.api.projectdeclared.model.vo.ProjectDraftVO; import com.hz.pm.api.projectdeclared.service.IProjectDraftService; import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; import com.hz.pm.api.projectlib.helper.ProjectHelper; import com.hz.pm.api.projectlib.manage.ProjectLibManage; @@ -56,7 +53,6 @@ import com.wflow.workflow.bean.dto.OrgInfoDTO; import com.wflow.workflow.bean.vo.ProcessStartParamsVo; import com.wflow.workflow.service.ProcessInstanceService; import com.wflow.workflow.service.ProcessModelService; -import io.swagger.models.auth.In; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -443,7 +439,7 @@ public class DeclaredProjectManage { JSONObject jsonObject = new JSONObject(); UserInfoDetails user = LoginUserUtil.loginUserDetail(); if(BizConst.DEV.equals(active)){ - jsonObject = JSONObject.parseObject(DeclaredProjectContant.Biz.CORE_BIZ); + jsonObject = JSONObject.parseObject(DeclaredProjectConst.Biz.CORE_BIZ); if(CollUtil.isEmpty(jsonObject)){ return jsonObject; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java index af5ea8f..02851d7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java @@ -6,10 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.NdDateUtils; import com.hz.pm.api.common.constant.BizConst; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.helper.UserInfoHelper; @@ -20,7 +16,6 @@ import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; import com.hz.pm.api.projectdeclared.model.vo.FinalAcceptanceVO; import com.hz.pm.api.projectlib.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.enumeration.ProjectTypeEnum; import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; import com.hz.pm.api.projectlib.helper.ProjectHelper; import com.hz.pm.api.projectlib.manage.ProjectLibManage; @@ -34,6 +29,11 @@ import com.hz.pm.api.sys.manage.NoticeManage; import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.NdDateUtils; import com.wflow.bean.entity.WflowModels; import com.wflow.exception.BusinessException; import com.wflow.workflow.bean.dto.OrgInfoDTO; @@ -45,6 +45,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; + import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.time.LocalDateTime; @@ -81,6 +82,7 @@ public class FinalAcceptanceManage { /** * 待采购的-项目列表 + * * @param req * @return */ @@ -90,11 +92,11 @@ public class FinalAcceptanceManage { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); //待终验 并且还未过期 //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.ge(Project::getPlanAcceptanceTime, LocalDateTime.now()); - query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getNewest, Boolean.TRUE); query.isNotNull(Project::getApprovalDate); query.isNotNull(Project::getBuildCycle); query.orderByAsc(Project::getApprovalDate); @@ -135,10 +137,10 @@ public class FinalAcceptanceManage { LambdaQueryWrapper query = ProjectHelper.projectQuery(param); //待终验 //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getNewest, Boolean.TRUE); query.isNotNull(Project::getApprovalDate); query.isNotNull(Project::getBuildCycle); query.orderByAsc(Project::getApprovalDate); @@ -146,7 +148,7 @@ public class FinalAcceptanceManage { AtomicInteger serialNumber = new AtomicInteger(0); List collect = Lists.newArrayList(); - if(CollUtil.isNotEmpty(records)){ + if (CollUtil.isNotEmpty(records)) { collect = records.stream().map(r -> { DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); BeanUtils.copyProperties(r, exportDTO); @@ -162,7 +164,7 @@ public class FinalAcceptanceManage { } String fileName = "待终验申请项目列表"; - ExcelDownUtil.setFileName(fileName,response); + ExcelDownUtil.setFileName(fileName, response); //数据导出处理函数 try { EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) @@ -170,10 +172,8 @@ public class FinalAcceptanceManage { .registerWriteHandler(ExcelExportStyle.formalStyle()) .sheet(fileName) .doWrite(collect); - } catch (IOException e) { - throw new RuntimeException(e); } catch (Exception e) { - throw new RuntimeException(e); + throw new BizException(e); } } @@ -183,7 +183,7 @@ public class FinalAcceptanceManage { Project project = projectService.getById(projectId); vo.setProjectId(projectId); - if(Objects.nonNull(project)){ + if (Objects.nonNull(project)) { vo.setFinalAcceptanceMaterials(project.getFinalAcceptanceMaterials()); // TODO IRS接口获取 应用信息 vo.setApps(Collections.emptyList()); @@ -194,6 +194,7 @@ public class FinalAcceptanceManage { /** * 开启流程 + * * @param dto * @return */ @@ -240,11 +241,11 @@ public class FinalAcceptanceManage { //保存终验项目 //生成新版本 并且进入下一状态 - projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,projectDto, - InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.FALSE); + projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo, instanceId, projectDto, + InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(), Boolean.FALSE); //发送给第一个审批人消息 - noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, + noticeManage.sendFirtUser(projectInfo, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; @@ -252,6 +253,7 @@ public class FinalAcceptanceManage { /** * 重新申报 + * * @param dto * @return */ @@ -290,7 +292,7 @@ public class FinalAcceptanceManage { params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 //把条件值给放入工作流 - declaredProjectManage.buildCondition(params,projectInfo, dto); + declaredProjectManage.buildCondition(params, projectInfo, dto); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 Map orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); @@ -298,11 +300,11 @@ public class FinalAcceptanceManage { //保存终验项目 //生成新版本 并且进入下一状态 - projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,projectDto, - InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.TRUE); + projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo, instanceId, projectDto, + InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(), Boolean.TRUE); //发送给第一个审批人消息 - noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, + noticeManage.sendFirtUser(projectInfo, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java index 240cb6e..72ca44c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java @@ -14,7 +14,7 @@ import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.datascope.model.DataScopeDTO; import com.hz.pm.api.datascope.utils.DataScopeUtil; -import com.hz.pm.api.projectdeclared.contants.DeclaredProjectContant; +import com.hz.pm.api.projectdeclared.contants.DeclaredProjectConst; import com.hz.pm.api.projectdeclared.model.dto.ReviewChecklistApproveDTO; import com.hz.pm.api.projectdeclared.model.entity.ReviewChecklistApprove; import com.hz.pm.api.projectdeclared.service.IReviewChecklistApproveService; @@ -92,9 +92,9 @@ public class ReviewChecklistManage { List reviewHumans; if (BizConst.DEV.equals(active)) { - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; + reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; } else { - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; + reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD; } List users = userInfoHelper.getUserFullInfoByEmployeeCodes(reviewHumans); Set userSet = Sets.newHashSet(); @@ -131,9 +131,9 @@ public class ReviewChecklistManage { Map userMap, UserInfoDetails user) { List reviewHumans; if (BizConst.DEV.equals(active)) { - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; + reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; } else { - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; + reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD; } int maxNums = reviewHumans.size(); @@ -177,9 +177,9 @@ public class ReviewChecklistManage { //如果是七大审查之一 就可以看 List reviewHumans; if (BizConst.DEV.equals(active)) { - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; + reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; } else { - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; + reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD; } if (reviewHumans.contains(employeeCode)) { log.warn("为七大审查人之一 可以查看"); @@ -245,9 +245,9 @@ public class ReviewChecklistManage { List reviewHumans; ; if (BizConst.DEV.equals(active)) { - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; + reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; } else { - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; + reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD; } if (StringUtils.isBlank(employeeCode) || !reviewHumans.contains(employeeCode)) { @@ -330,9 +330,9 @@ public class ReviewChecklistManage { List reviewHumans; if (BizConst.DEV.equals(active)) { - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; + reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; } else { - reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; + reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD; } Set computeHumanSet = new HashSet<>(reviewHumans); for (ReviewChecklistApprove approve : approves) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DeclaredProjectExportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DeclaredProjectExportDTO.java index d289b0b..8972fa2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DeclaredProjectExportDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DeclaredProjectExportDTO.java @@ -1,14 +1,12 @@ package com.hz.pm.api.projectdeclared.model.dto; import com.alibaba.excel.annotation.ExcelProperty; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; + import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java index 27f35f4..f71c8c9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java @@ -15,9 +15,11 @@ import com.hz.pm.api.projectlib.model.dto.ProjectDTO; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectCollection; import com.hz.pm.api.projectlib.service.IProjectService; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; + import java.time.LocalDateTime; import java.util.Objects; @@ -28,25 +30,21 @@ import java.util.Objects; * @since 2023/04/04 14:13 */ @Component +@RequiredArgsConstructor public class GenerateProjectCodeUtil { - @Autowired - private IProjectService projectService; - - @Autowired - private IGovBizProjectBaseinfoService baseinfoService; + private final IProjectService projectService; + private final IGovBizProjectBaseinfoService baseinfoService; + private final IGovOperationProjectBaseinfoService operationProjectBaseinfoService; - @Autowired - private IGovOperationProjectBaseinfoService operationProjectBaseinfoService; - - public String generateProjectCode(ProjectDTO project){ + public String generateProjectCode(ProjectDTO project) { // 获取所属行政区划代码(9位) String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; // 获取建设年度 (10-13) String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear()) : String.valueOf(LocalDateTime.now().getYear()); // 14-15 项目类型 - String projectType = project.getProjectType(); + String projectType = project.getProjectType(); // 16-20 项目序号00001 String currentCode = areaCode + year + projectType; // 16-20 项目序号00001 @@ -56,14 +54,14 @@ public class GenerateProjectCodeUtil { return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); } - public String generateProjectCode(ProjectCollection project){ + public String generateProjectCode(ProjectCollection project) { // 获取所属行政区划代码(9位) String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; // 获取建设年度 (10-13) String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear()) : String.valueOf(LocalDateTime.now().getYear()); // 14-15 项目类型 - String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType(); + String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType(); // 16-20 项目序号00001 String currentCode = areaCode + year + projectType; // 16-20 项目序号00001 @@ -118,30 +116,31 @@ public class GenerateProjectCodeUtil { // 生成20位的项目编号 return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); } + private Long getMaxProjectCode(String currentCode) { - Long max = 0L; + long max = 0L; GovBizProjectBaseinfo baseMax = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .like(GovBizProjectBaseinfo::getBaseProjId, currentCode) .orderByDesc(GovBizProjectBaseinfo::getBaseProjId) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(baseMax) && StringUtils.isNotBlank(baseMax.getBaseProjId())){ - max = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); + if (Objects.nonNull(baseMax) && StringUtils.isNotBlank(baseMax.getBaseProjId())) { + max = Long.parseLong(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5)); } GovOperationProjectBaseinfo operationBaseMax = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) .like(GovOperationProjectBaseinfo::getBaseProjId, currentCode) .orderByDesc(GovOperationProjectBaseinfo::getBaseProjId) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(operationBaseMax) && StringUtils.isNotBlank(operationBaseMax.getBaseProjId())){ - Long operationMax = Long.valueOf(operationBaseMax.getBaseProjId().substring(operationBaseMax.getBaseProjId().length() - 5)); - max = Math.max(max,operationMax); + if (Objects.nonNull(operationBaseMax) && StringUtils.isNotBlank(operationBaseMax.getBaseProjId())) { + long operationMax = Long.parseLong(operationBaseMax.getBaseProjId().substring(operationBaseMax.getBaseProjId().length() - 5)); + max = Math.max(max, operationMax); } Project projectMax = projectService.getOne(Wrappers.lambdaQuery(Project.class) .like(Project::getProjectCode, currentCode) .orderByDesc(Project::getProjectCode) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectMax) && StringUtils.isNotBlank(projectMax.getProjectCode())){ - Long projectMaxCode = Long.valueOf(projectMax.getProjectCode().substring(projectMax.getProjectCode().length() - 5)); - max = Math.max(max,projectMaxCode); + if (Objects.nonNull(projectMax) && StringUtils.isNotBlank(projectMax.getProjectCode())) { + long projectMaxCode = Long.parseLong(projectMax.getProjectCode().substring(projectMax.getProjectCode().length() - 5)); + max = Math.max(max, projectMaxCode); } max = max + 1; return max; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java index 6d958d9..7d5fd08 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java @@ -51,14 +51,14 @@ public class AnnualPlanController { @PostMapping("/projectApproved") @ApiOperation("立项批复") @WebLog("立项批复") - public void projectApproved(@RequestBody @Valid ProjectApprovedReq req) throws Exception { + public void projectApproved(@RequestBody @Valid ProjectApprovedReq req) { annualPlanLibManage.projectApproved(req); } @PostMapping("/suspendAnnualPlan") @ApiOperation("暂缓年度计划") @WebLog("暂缓年度计划") - public void suspendAnnualPlan(@RequestBody @Valid ProjectIdReq req) throws Exception { + public void suspendAnnualPlan(@RequestBody @Valid ProjectIdReq req) { annualPlanLibManage.suspendAnnualPlan(req); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java index 773dfa1..60da7a7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java @@ -1,24 +1,23 @@ package com.hz.pm.api.projectlib.handle; -import java.util.*; -import java.util.stream.Collectors; - -import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.util.CollUtils; import com.hz.pm.api.common.constant.BizConst; +import com.hz.pm.api.common.constant.CommonConst; import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; import com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; import com.hz.pm.api.projectlib.service.IProjectService; +import com.ningdatech.basic.util.CollUtils; import com.wflow.workflow.bean.vo.ProcessDetailVO; import com.wflow.workflow.enums.StepStatusEnum; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; -import com.hz.pm.api.common.constant.CommonConst; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; import static com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum.*; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java index 3be4714..d9e4c43 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java @@ -13,10 +13,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.StrPool; import com.hz.pm.api.common.constant.CommonConst; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.helper.UserInfoHelper; @@ -45,6 +41,10 @@ import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.todocenter.constant.TodoCenterConstant; import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.StrPool; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -53,12 +53,15 @@ import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; + import javax.servlet.http.HttpServletResponse; import java.io.*; import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; + import static com.hz.pm.api.projectlib.enumeration.ProjectStatusEnum.*; /** @@ -85,9 +88,9 @@ public class AnnualPlanLibManage { * 年度计划查询状态 */ private static final List ANNUAL_PLAN_LIST_STATUS = - Arrays.asList(IN_THE_ANNUAL_PLAN, SCHEME_UNDER_REVIEW, SCHEME_REVIEW_FAILED, TO_BE_APPROVED, TO_BE_DECLARED, - PLAN_TO_BE_DECLARED, PENDING_PREQUALIFICATION_CHOICE, PROJECT_APPROVED, TO_BE_PURCHASED, UNDER_CONSTRUCTION, - TO_BE_FINALLY_INSPECTED, FINAL_ACCEPTANCE_IS_UNDER_REVIEW, FINAL_ACCEPTANCE_REVIEW_FAILED, ARCHIVED); + Arrays.asList(IN_THE_ANNUAL_PLAN, SCHEME_UNDER_REVIEW, SCHEME_REVIEW_FAILED, TO_BE_APPROVED, TO_BE_DECLARED, + PLAN_TO_BE_DECLARED, PENDING_PREQUALIFICATION_CHOICE, PROJECT_APPROVED, TO_BE_PURCHASED, UNDER_CONSTRUCTION, + TO_BE_FINALLY_INSPECTED, FINAL_ACCEPTANCE_IS_UNDER_REVIEW, FINAL_ACCEPTANCE_REVIEW_FAILED, ARCHIVED); public PageVo annulPlanLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); @@ -170,8 +173,8 @@ public class AnnualPlanLibManage { project.setVersion(oldProject.getVersion() + 1); project.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); project.setId(null); - if(projectService.save(project)){ - applicationService.saveApplication(project,oldProject,Boolean.TRUE); + if (projectService.save(project)) { + applicationService.saveApplication(project, oldProject, Boolean.TRUE); // 将旧的项目版本置为不是最新 projectService.update(Wrappers.lambdaUpdate(Project.class) .set(Project::getNewest, Boolean.FALSE) @@ -180,9 +183,9 @@ public class AnnualPlanLibManage { } } - public LocalDateTime getPlanAcceptanceTime(ProjectApprovedReq req){ + public LocalDateTime getPlanAcceptanceTime(ProjectApprovedReq req) { if (Objects.nonNull(req.getApprovedDate()) && Objects.nonNull(req.getBuildCycle())) { - return req.getApprovedDate().plusMonths(req.getBuildCycle()); + return req.getApprovedDate().plusMonths(req.getBuildCycle()); } return null; } @@ -290,7 +293,7 @@ public class AnnualPlanLibManage { } // 筛选出导入的新建项目 List newList = - list.stream().filter(d -> CommonConst.NEW_CONSTRUCTION.equals(d.getIsFirst())).collect(Collectors.toList()); + list.stream().filter(d -> CommonConst.NEW_CONSTRUCTION.equals(d.getIsFirst())).collect(Collectors.toList()); List projectList = newList.stream().map(n -> { Project project = new Project(); assemblyProjectInfo(n, project); @@ -311,7 +314,7 @@ public class AnnualPlanLibManage { // 筛选出导入的续建项目 List continuedList = list.stream() - .filter(d -> CommonConst.CONTINUED_CONSTRUCTION.equals(d.getIsFirst())).collect(Collectors.toList()); + .filter(d -> CommonConst.CONTINUED_CONSTRUCTION.equals(d.getIsFirst())).collect(Collectors.toList()); List renewalFundDeclarationList = continuedList.stream().map(c -> { ProjectRenewalFundDeclaration renewalFundDeclaration = new ProjectRenewalFundDeclaration(); BeanUtils.copyProperties(c, renewalFundDeclaration); @@ -330,9 +333,9 @@ public class AnnualPlanLibManage { Long projectId = data.getProjectId(); // 从项目库中先查询出对应的项目ID的项目 Project projectInfo = projectService.getById(projectId); - if (Objects.nonNull(projectInfo)){ - BeanUtils.copyProperties(projectInfo,project); - }else { + if (Objects.nonNull(projectInfo)) { + BeanUtils.copyProperties(projectInfo, project); + } else { // 新增的年度计划库项目 throw new BizException("项目库中不存在项目ID为:" + projectId + "的项目"); } @@ -379,7 +382,7 @@ public class AnnualPlanLibManage { fileName = "丽水市" + year + "年数字化项目年度计划增补库编辑表"; } LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getNewest, Boolean.TRUE); query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); query.orderByDesc(Project::getAnnualPlanAddTime); query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); @@ -403,8 +406,8 @@ public class AnnualPlanLibManage { String buildBasis = p.getBuildBasis(); List fileArray = JSON.parseArray(buildBasis, JSONObject.class); List nameList = CollUtils.fieldList(fileArray, w -> w.getString(CommonConst.TITLE) - + StrPool.LEFT_BRACKET + w.getString(CommonConst.BASIS_FILE_NAME) + StrPool.RIGHT_BRACKET); - String basis = nameList.stream().collect(Collectors.joining(StrPool.COMMA)); + + StrPool.LEFT_BRACKET + w.getString(CommonConst.BASIS_FILE_NAME) + StrPool.RIGHT_BRACKET); + String basis = String.join(StrPool.COMMA, nameList); dto.setBuildBasis(basis); if (CommonEnum.YES.getCode().equals(p.getIsFirst())) { dto.setIsFirst(CommonConst.NEW_CONSTRUCTION); @@ -428,10 +431,10 @@ public class AnnualPlanLibManage { File directory = new File(""); String templateName = "丽水市" + year + "年数字化项目年度计划编辑表"; String templatePath = - directory.getAbsolutePath() + File.separator + "template" + File.separator + templateName + ".xls"; + directory.getAbsolutePath() + File.separator + "template" + File.separator + templateName + ".xls"; TemplateExportParams temp = new TemplateExportParams(templatePath); - temp.setSheetNum(new Integer[] {0, 1}); - temp.setSheetName(new String[] {"实施类(新建)", "实施类(续建)"}); + temp.setSheetNum(new Integer[]{0, 1}); + temp.setSheetName(new String[]{"实施类(新建)", "实施类(续建)"}); Map map = new HashMap<>(4); map.put("mapList", list); map.put("mapList1", Lists.newArrayList()); @@ -440,13 +443,14 @@ public class AnnualPlanLibManage { // 输出空模板 // 获取本地目录的年度计划编辑表空Excel模板 String emptyTemplate = "丽水市" + year + "年数字化项目年度计划编辑表(空)"; - try { - InputStream templateInputStream = - this.getClass().getClassLoader().getResourceAsStream("template" + File.separator + emptyTemplate + ".xls"); - - OutputStream outputStream = response.getOutputStream(); + String emptyTemplatePath = "template" + File.separator + emptyTemplate + ".xls"; + try (InputStream templateInputStream = this.getClass().getClassLoader().getResourceAsStream(emptyTemplatePath); + OutputStream outputStream = response.getOutputStream()) { + if (templateInputStream == null) { + throw new BizException("读取模板失败!"); + } // 设置要下载的文件的名称 - response.setHeader("Content-disposition", "attachment;fileName=" + new String(templateName.getBytes("UTF-8"),"ISO8859-1")); + response.setHeader("Content-disposition", "attachment;fileName=" + new String(templateName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1)); // 设置文件的MIME类型 response.setContentType("application/vnd.ms-excel;charset=UTF-8"); @@ -455,39 +459,36 @@ public class AnnualPlanLibManage { while ((len = templateInputStream.read(b)) != -1) { outputStream.write(b, 0, len); } - templateInputStream.close(); outputStream.flush(); - outputStream.close(); } catch (IOException e) { throw new BizException("读取模板失败!"); } return; } - if (workbook == null){ + if (workbook == null) { throw new BizException("读取编辑表模板失败!"); } // 重置响应对象 response.reset(); try { response.setHeader("Content-disposition", - "attachment;filename*=utf-8''" + URLEncoder.encode(Objects.requireNonNull(fileName), "UTF-8") + ".xls"); + "attachment;filename*=utf-8''" + URLEncoder.encode(Objects.requireNonNull(fileName), "UTF-8") + ".xls"); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + log.error("年度计划导出异常:", e); + throw BizException.wrap("年度计划导出异常"); } response.setContentType(ExcelUtil.XLS_CONTENT_TYPE); response.setHeader("Pragma", "no-cache"); response.setHeader("Cache-Control", "no-cache"); response.setDateHeader("Expires", 0); // 写出数据输出流到页面 - try { - OutputStream output = response.getOutputStream(); - BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output); - workbook.write(bufferedOutPut); - bufferedOutPut.flush(); - bufferedOutPut.close(); - output.close(); + try (OutputStream output = response.getOutputStream(); + BufferedOutputStream bos = new BufferedOutputStream(output)) { + workbook.write(bos); + bos.flush(); } catch (IOException e) { - e.printStackTrace(); + log.error("年度计划导出异常:", e); + throw BizException.wrap("年度计划导出异常"); } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/AnnualLibImportDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/AnnualLibImportDTO.java index 6ecb3f8..a6f669c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/AnnualLibImportDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/AnnualLibImportDTO.java @@ -1,7 +1,6 @@ package com.hz.pm.api.projectlib.model.dto; import cn.afterturn.easypoi.excel.annotation.Excel; -import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; import javax.validation.constraints.NotBlank; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java index 53a3d98..d4cd959 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java @@ -2,15 +2,9 @@ package com.hz.pm.api.projectlib.model.entity; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.event.AnalysisEventListener; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.CollUtils; -import com.hz.pm.api.common.constant.CommonConst; -import com.hz.pm.api.projectlib.service.IProjectService; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.RequiredArgsConstructor; +import lombok.EqualsAndHashCode; import java.util.*; @@ -19,6 +13,7 @@ import java.util.*; * @since 2023/04/17 18:26 */ @Data +@EqualsAndHashCode(callSuper = true) public class AnalysisEventMonitor extends AnalysisEventListener> { private final List records = new ArrayList<>(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/utils/FileUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/utils/FileUtil.java deleted file mode 100644 index 473f519..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/utils/FileUtil.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.hz.pm.api.provincial.utils; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; - -/** - * @Classname FileUtil - * @Description - * @Date 2023/9/6 9:09 - * @Author PoffyZhang - */ -public class FileUtil { - public static byte[] getBytesByFile(File file) { - try { - FileInputStream fis = new FileInputStream(file); - ByteArrayOutputStream bos = new ByteArrayOutputStream(1000); - byte[] b = new byte[1000]; - int n; - while ((n = fis.read(b)) != -1) { - bos.write(b, 0, n); - } - fis.close(); - byte[] data = bos.toByteArray(); - bos.close(); - return data; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/utils/DateUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/utils/DateUtil.java deleted file mode 100644 index 3c013a0..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/utils/DateUtil.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.hz.pm.api.scheduler.utils; - -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.Calendar; -import java.util.Date; -import java.util.Objects; - -/** - * @Classname DateUtil - * @Description - * @Date 2023/8/31 15:36 - * @Author PoffyZhang - */ -public class DateUtil { - - public static Date getTodayTime(int hour){ - // 获取当前日期时间 - Calendar calendar = Calendar.getInstance(); - - // 将时间设置为凌晨 - calendar.set(Calendar.HOUR_OF_DAY, hour); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); - - // 获取凌晨时间 - Date date = calendar.getTime(); - return date; - } - - public static LocalDateTime convertDateToLocal(Date date){ - if(Objects.isNull(date)){ - return null; - } - return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java index 19dcff8..8860cbf 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java @@ -22,6 +22,7 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; + import java.time.LocalDateTime; import java.util.Objects; @@ -50,68 +51,69 @@ public class EarlyWarningManage { /** * 预警通知 + * * @param noticeMethod * @param noticeContent * @param adventTimeout * @param employeeCode * @param project */ - public void doEarlyWarning(String noticeMethod,String noticeContent, Integer adventTimeout,Integer overTimeout, - Integer biz, LocalDateTime startTime,String employeeCode, - Project project,Integer ruleType,Integer noticeType, - String path,String batchEmployees,String nodeId) { + public void doEarlyWarning(String noticeMethod, String noticeContent, Integer adventTimeout, Integer overTimeout, + Integer biz, LocalDateTime startTime, String employeeCode, + Project project, Integer ruleType, Integer noticeType, + String path, String batchEmployees, String nodeId) { //1.存入 预警记录 UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); String content = StringUtils.EMPTY; - switch (WarningRuleTypeEnum.checkByCode(ruleType)){ + switch (WarningRuleTypeEnum.checkByCode(ruleType)) { case PROCESS_WARNING: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),overTimeout); + if (Objects.isNull(noticeType)) { + content = convertContent(noticeContent, project.getProjectName(), + InstTypeEnum.getByCode(biz), overTimeout); + } else if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent, project.getProjectName(), + InstTypeEnum.getByCode(biz), adventTimeout, overTimeout); + } else { + content = convertContent(noticeContent, project.getProjectName(), + InstTypeEnum.getByCode(biz), overTimeout); } records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); break; case DECLARED_WARNING: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),overTimeout); + if (Objects.isNull(noticeType)) { + content = convertContent(noticeContent, project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz), overTimeout); + } else if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent, project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz), adventTimeout, overTimeout); + } else { + content = convertContent(noticeContent, project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz), overTimeout); } records.setRuleType(WarningRuleTypeEnum.DECLARED_WARNING.getCode()); break; case OPERATION_WARNING: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),overTimeout); + if (Objects.isNull(noticeType)) { + content = convertContent(noticeContent, project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz), overTimeout); + } else if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent, project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz), adventTimeout, overTimeout); + } else { + content = convertContent(noticeContent, project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz), overTimeout); } records.setRuleType(WarningRuleTypeEnum.OPERATION_WARNING.getCode()); break; case RENEWAL_FUND: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(),overTimeout); + if (Objects.isNull(noticeType)) { + content = convertContent(noticeContent, project.getProjectName(), overTimeout); + } else if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent, project.getProjectName(), adventTimeout, overTimeout); + } else { + content = convertContent(noticeContent, project.getProjectName(), overTimeout); } records.setRuleType(WarningRuleTypeEnum.RENEWAL_FUND.getCode()); @@ -150,7 +152,7 @@ public class EarlyWarningManage { notifyService.save(notify); //3.发短信 - if(noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode()))){ + if (noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode()))) { SendSmsCmd.SendSmsContext context = new SendSmsCmd.SendSmsContext(); context.setReceiveNumber(user.getMobile()); context.setContent(content); @@ -158,7 +160,7 @@ public class EarlyWarningManage { } //4.浙政钉 - if(noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))){ + if (noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))) { // 获取发送浙政钉工作通知必要信息 WorkNoticeInfo passWorkNoticeInfo = noticeManage.getSendWorkNoticeInfo(employeeCode); passWorkNoticeInfo.setMsg(content); @@ -169,68 +171,69 @@ public class EarlyWarningManage { /** * 催办 + * * @param noticeMethod * @param noticeContent * @param adventTimeout * @param employeeCode * @param project */ - public void urging(String noticeMethod,String noticeContent, Integer adventTimeout,Integer overTimeout, - Integer biz, LocalDateTime startTime,String employeeCode, - Project project,Integer ruleType,Integer noticeType, - String path,String batchEmployees,String nodeId) { + public void urging(String noticeMethod, String noticeContent, Integer adventTimeout, Integer overTimeout, + Integer biz, LocalDateTime startTime, String employeeCode, + Project project, Integer ruleType, Integer noticeType, + String path, String batchEmployees, String nodeId) { //1.存入 预警记录 UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); - String content = StringUtils.EMPTY; + String content; - switch (WarningRuleTypeEnum.checkByCode(ruleType)){ + switch (WarningRuleTypeEnum.checkByCode(ruleType)) { case PROCESS_WARNING: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),overTimeout); + if (Objects.isNull(noticeType)) { + content = convertContent(noticeContent, project.getProjectName(), + InstTypeEnum.getByCode(biz), overTimeout); + } else if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent, project.getProjectName(), + InstTypeEnum.getByCode(biz), adventTimeout, overTimeout); + } else { + content = convertContent(noticeContent, project.getProjectName(), + InstTypeEnum.getByCode(biz), overTimeout); } records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); break; case DECLARED_WARNING: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),overTimeout); + if (Objects.isNull(noticeType)) { + content = convertContent(noticeContent, project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz), overTimeout); + } else if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent, project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz), adventTimeout, overTimeout); + } else { + content = convertContent(noticeContent, project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz), overTimeout); } records.setRuleType(WarningRuleTypeEnum.DECLARED_WARNING.getCode()); break; case OPERATION_WARNING: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),overTimeout); + if (Objects.isNull(noticeType)) { + content = convertContent(noticeContent, project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz), overTimeout); + } else if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent, project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz), adventTimeout, overTimeout); + } else { + content = convertContent(noticeContent, project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz), overTimeout); } records.setRuleType(WarningRuleTypeEnum.OPERATION_WARNING.getCode()); break; case RENEWAL_FUND: - if(Objects.isNull(noticeType)){ - content = convertContent(noticeContent,project.getProjectName(),overTimeout); - }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { - content = convertAdventContent(noticeContent,project.getProjectName(),adventTimeout,overTimeout); - }else{ - content = convertContent(noticeContent,project.getProjectName(),overTimeout); + if (Objects.isNull(noticeType)) { + content = convertContent(noticeContent, project.getProjectName(), overTimeout); + } else if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent, project.getProjectName(), adventTimeout, overTimeout); + } else { + content = convertContent(noticeContent, project.getProjectName(), overTimeout); } records.setRuleType(WarningRuleTypeEnum.RENEWAL_FUND.getCode()); @@ -268,7 +271,7 @@ public class EarlyWarningManage { notifyService.save(notify); //3.发短信 - if(noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode()))){ + if (noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode()))) { SendSmsCmd.SendSmsContext context = new SendSmsCmd.SendSmsContext(); context.setReceiveNumber(user.getMobile()); context.setContent(content); @@ -276,7 +279,7 @@ public class EarlyWarningManage { } //4.浙政钉 - if(noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))){ + if (noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))) { // 获取发送浙政钉工作通知必要信息 WorkNoticeInfo passWorkNoticeInfo = noticeManage.getSendWorkNoticeInfo(employeeCode); passWorkNoticeInfo.setMsg(content); @@ -287,27 +290,30 @@ public class EarlyWarningManage { /** * 续建项目资金 + * * @param noticeContent * @param projectName * @param timeout * @return */ private String convertContent(String noticeContent, String projectName, Integer timeout) { - noticeContent = noticeContent.replace("{projectName}",projectName) - .replace("{time}",String.valueOf(timeout)); - log.info("通知内容 :{}",noticeContent); + noticeContent = noticeContent.replace("{projectName}", projectName) + .replace("{time}", String.valueOf(timeout)); + log.info("通知内容 :{}", noticeContent); return noticeContent; } - private String convertAdventContent(String noticeContent, String projectName, Integer timeout,Integer overTimeOut) { - noticeContent = noticeContent.replace("{projectName}",projectName) - .replace("{time}",String.valueOf(timeout)) - .replace("{time2}",String.valueOf((overTimeOut - timeout))); - log.info("通知内容 :{}",noticeContent); + + private String convertAdventContent(String noticeContent, String projectName, Integer timeout, Integer overTimeOut) { + noticeContent = noticeContent.replace("{projectName}", projectName) + .replace("{time}", String.valueOf(timeout)) + .replace("{time2}", String.valueOf((overTimeOut - timeout))); + log.info("通知内容 :{}", noticeContent); return noticeContent; } /** * 转换出 通知的内容 + * * @param noticeContent * @param projectName * @param instTypeEnum @@ -315,59 +321,59 @@ public class EarlyWarningManage { * @return */ private String convertContent(String noticeContent, String projectName, InstTypeEnum instTypeEnum, Integer timeout) { - noticeContent = noticeContent.replace("{projectName}",projectName) - .replace("{flowType}",Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{flowType}") - .replace("{stepName}",Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{stepName}") - .replace("{time}",String.valueOf(timeout)); - log.info("通知内容 :{}",noticeContent); + noticeContent = noticeContent.replace("{projectName}", projectName) + .replace("{flowType}", Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{flowType}") + .replace("{stepName}", Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{stepName}") + .replace("{time}", String.valueOf(timeout)); + log.info("通知内容 :{}", noticeContent); return noticeContent; } - private String convertAdventContent(String noticeContent, String projectName, InstTypeEnum instTypeEnum, Integer timeout,Integer overTimeOut) { - noticeContent = noticeContent.replace("{projectName}",projectName) - .replace("{flowType}",Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{flowType}") - .replace("{stepName}",Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{stepName}") - .replace("{time}",String.valueOf(timeout)) - .replace("{time2}",String.valueOf((overTimeOut - timeout))); - log.info("通知内容 :{}",noticeContent); + private String convertAdventContent(String noticeContent, String projectName, InstTypeEnum instTypeEnum, Integer timeout, Integer overTimeOut) { + noticeContent = noticeContent.replace("{projectName}", projectName) + .replace("{flowType}", Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{flowType}") + .replace("{stepName}", Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{stepName}") + .replace("{time}", String.valueOf(timeout)) + .replace("{time2}", String.valueOf((overTimeOut - timeout))); + log.info("通知内容 :{}", noticeContent); return noticeContent; } private String convertContent(String noticeContent, String projectName, WarningFlowTypeEnum warningFlowTypeEnum, Integer timeout) { - noticeContent = noticeContent.replace("{projectName}",projectName) - .replace("{flowType}",Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{flowType}") - .replace("{stepName}",Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{stepName}") - .replace("{time}",String.valueOf(timeout)); - log.info("通知内容 :{}",noticeContent); + noticeContent = noticeContent.replace("{projectName}", projectName) + .replace("{flowType}", Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{flowType}") + .replace("{stepName}", Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{stepName}") + .replace("{time}", String.valueOf(timeout)); + log.info("通知内容 :{}", noticeContent); return noticeContent; } - private String convertAdventContent(String noticeContent, String projectName, WarningFlowTypeEnum warningFlowTypeEnum, Integer timeout,Integer overTimeout) { - noticeContent = noticeContent.replace("{projectName}",projectName) - .replace("{flowType}",Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{flowType}") - .replace("{stepName}",Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{stepName}") - .replace("{time}",String.valueOf(timeout)) - .replace("{time2}",String.valueOf((overTimeout - timeout))); - log.info("通知内容 :{}",noticeContent); + private String convertAdventContent(String noticeContent, String projectName, WarningFlowTypeEnum warningFlowTypeEnum, Integer timeout, Integer overTimeout) { + noticeContent = noticeContent.replace("{projectName}", projectName) + .replace("{flowType}", Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{flowType}") + .replace("{stepName}", Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{stepName}") + .replace("{time}", String.valueOf(timeout)) + .replace("{time2}", String.valueOf((overTimeout - timeout))); + log.info("通知内容 :{}", noticeContent); return noticeContent; } private String convertContent(String noticeContent, String projectName, WarningOperationTypeEnum operationTypeEnum, Integer timeout) { - noticeContent = noticeContent.replace("{projectName}",projectName) - .replace("{flowType}",Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{flowType}") - .replace("{stepName}",Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{stepName}") - .replace("{time}",String.valueOf(timeout)); - log.info("通知内容 :{}",noticeContent); + noticeContent = noticeContent.replace("{projectName}", projectName) + .replace("{flowType}", Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{flowType}") + .replace("{stepName}", Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{stepName}") + .replace("{time}", String.valueOf(timeout)); + log.info("通知内容 :{}", noticeContent); return noticeContent; } - private String convertAdventContent(String noticeContent, String projectName, WarningOperationTypeEnum operationTypeEnum, Integer timeout,Integer overTimeout) { - noticeContent = noticeContent.replace("{projectName}",projectName) - .replace("{flowType}",Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{flowType}") - .replace("{stepName}",Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{stepName}") - .replace("{time}",String.valueOf(timeout)) - .replace("{time2}",String.valueOf((overTimeout - timeout))); - log.info("通知内容 :{}",noticeContent); + private String convertAdventContent(String noticeContent, String projectName, WarningOperationTypeEnum operationTypeEnum, Integer timeout, Integer overTimeout) { + noticeContent = noticeContent.replace("{projectName}", projectName) + .replace("{flowType}", Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{flowType}") + .replace("{stepName}", Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{stepName}") + .replace("{time}", String.valueOf(timeout)) + .replace("{time2}", String.valueOf((overTimeout - timeout))); + log.info("通知内容 :{}", noticeContent); return noticeContent; } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java index 9fdeb20..de25a2c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java @@ -1,7 +1,6 @@ package com.hz.pm.api.user.security.auth.agent; import com.hz.pm.api.user.security.auth.AuthProperties; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.SecurityConfigurerAdapter; @@ -14,34 +13,37 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic import org.springframework.stereotype.Component; /** - * 账号密码登陆的认证配置 + *

+ * AgentAuthSecurityConfig + *

+ * + * @author WendyYang + * @since 14:24 2023/12/16 */ @Component -public class AgentAuthSecurityConfig - extends SecurityConfigurerAdapter { - - @Autowired - @Qualifier(value = "defaultLoginSuccessHandler") - protected AuthenticationSuccessHandler defaultLoginSuccessHandler; - - @Autowired - @Qualifier(value = "defaultLoginFailureHandler") - protected AuthenticationFailureHandler defaultLoginFailureHandler; - - @Autowired - @Qualifier(value = "agentLoginUserDetailService") - private UserDetailsService agentLoginUserDetailService; - - @Autowired - private AuthProperties authProperties; - - private AuthenticationManager authenticationManager; +public class AgentAuthSecurityConfig extends SecurityConfigurerAdapter { + + + protected final AuthenticationSuccessHandler defaultLoginSuccessHandler; + protected final AuthenticationFailureHandler defaultLoginFailureHandler; + private final UserDetailsService agentLoginUserDetailService; + private final AuthProperties authProperties; + + public AgentAuthSecurityConfig(@Qualifier(value = "defaultLoginSuccessHandler") AuthenticationSuccessHandler loginSuccessHandler, + @Qualifier(value = "defaultLoginFailureHandler") AuthenticationFailureHandler loginFailureHandler, + @Qualifier(value = "agentLoginUserDetailService") UserDetailsService agentLoginUserDetailService, + AuthProperties authProperties) { + this.defaultLoginSuccessHandler = loginSuccessHandler; + this.defaultLoginFailureHandler = loginFailureHandler; + this.agentLoginUserDetailService = agentLoginUserDetailService; + this.authProperties = authProperties; + } @Override - public void configure(HttpSecurity http) throws Exception { + public void configure(HttpSecurity http) { AgentAuthFilter agentAuthFilter = new AgentAuthFilter(authProperties.getAgentLoginUrl()); - authenticationManager = http.getSharedObject(AuthenticationManager.class); + AuthenticationManager authenticationManager = http.getSharedObject(AuthenticationManager.class); agentAuthFilter.setAuthenticationManager(authenticationManager); agentAuthFilter.setAuthenticationSuccessHandler(defaultLoginSuccessHandler); agentAuthFilter.setAuthenticationFailureHandler(defaultLoginFailureHandler); @@ -49,7 +51,8 @@ public class AgentAuthSecurityConfig AgentAuthProvider authenticationProvider = new AgentAuthProvider(); authenticationProvider.setUserDetailsService(agentLoginUserDetailService); - http.authenticationProvider(authenticationProvider).addFilterAfter(agentAuthFilter, - UsernamePasswordAuthenticationFilter.class); + http.authenticationProvider(authenticationProvider) + .addFilterAfter(agentAuthFilter, UsernamePasswordAuthenticationFilter.class); } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java index 52777b7..e861acf 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java @@ -1,6 +1,5 @@ package com.hz.pm.api.user.security.auth.agent; -import com.hz.pm.api.user.constant.LoginTypeEnum; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.SpringSecurityCoreVersion;