Browse Source

代码优化

master
WendyYang 11 months ago
parent
commit
844b3dd99f
50 changed files with 1019 additions and 1104 deletions
  1. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/common/constant/CommonConst.java
  2. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/common/helper/basic/AbstractRegionCacheHelper.java
  3. +5
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionsCacheHelperImpl.java
  4. +1
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/DataDTO.java
  5. +5
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java
  6. +66
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtil.java
  7. +0
    -89
      hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtils.java
  8. +81
    -92
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/FundStatisticsManage.java
  9. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/EarlyWarningStatisticsVO.java
  10. +8
    -11
      hz-pm-api/src/main/java/com/hz/pm/api/ding/task/GovBusinessStripsTask.java
  11. +8
    -13
      hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java
  12. +10
    -15
      hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java
  13. +4
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java
  14. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java
  15. +397
    -384
      hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java
  16. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApplyDTO.java
  17. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApproveDTO.java
  18. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectBaseinfoDTO.java
  19. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectCimplementDTO.java
  20. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectMimplementDTO.java
  21. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectProcureDTO.java
  22. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectSaveDTO.java
  23. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectBaseinfo.java
  24. +4
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java
  25. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/ExpertInviteRuleServiceImpl.java
  26. +9
    -8
      hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java
  27. +4
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java
  28. +5
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java
  29. +5
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java
  30. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/GovBusinessStripController.java
  31. +3
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/organization/helper/impl/GovBusinessStripHelperImpl.java
  32. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/GovBusinessStripManage.java
  33. +91
    -93
      hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java
  34. +4
    -10
      hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AddAppraisalObjectDTO.java
  35. +29
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectConst.java
  36. +2
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java
  37. +28
    -26
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java
  38. +11
    -11
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java
  39. +1
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DeclaredProjectExportDTO.java
  40. +20
    -21
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java
  41. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java
  42. +6
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java
  43. +42
    -41
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java
  44. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/AnnualLibImportDTO.java
  45. +2
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java
  46. +0
    -32
      hz-pm-api/src/main/java/com/hz/pm/api/provincial/utils/FileUtil.java
  47. +0
    -37
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/utils/DateUtil.java
  48. +131
    -125
      hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java
  49. +28
    -25
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java
  50. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/common/constant/CommonConst.java View File

@@ -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;


+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/common/helper/basic/AbstractRegionCacheHelper.java View File

@@ -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<RegionMapKey, RegionDTO> regionsCache;



+ 5
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionsCacheHelperImpl.java View File

@@ -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)) {


+ 1
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/DataDTO.java View File

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**


+ 5
- 3
hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java View File

@@ -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));


+ 66
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtil.java View File

@@ -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;

/**
* <p>
* gzip压缩工具类
* </p>
*
* @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);
}
}

}

+ 0
- 89
hz-pm-api/src/main/java/com/hz/pm/api/common/util/GzipUtils.java View File

@@ -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;

/**
* <p>
* 压缩为Gzip
* </p>
*
* @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;
}

}

+ 81
- 92
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/FundStatisticsManage.java View File

@@ -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<String> allProjIds = allApplieYears.stream().map(GovBizProjectApply::getBaseProjId)
.collect(Collectors.toList());

List<GovBizProjectBaseinfo> allBaseInfos = Lists.newArrayList();
List<GovBizProjectBaseinfo> allBaseInfos;
List<GovBizProjectApply> allApplies = Lists.newArrayList();
List<GovBizProjectApprove> allApproves = Lists.newArrayList();
List<GovBizProjectProcure> 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<String> 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<Project> projects,
List<GovBizProjectApply> applies, List<GovBizProjectApprove> approves,
List<GovBizProjectApply> applies, List<GovBizProjectApprove> approves,
List<GovBizProjectProcure> procures) {
//首先完成年度计划 并且未注销的项目
List<Project> 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<Project> projects, List<GovBizProjectApply> applies,
List<GovBizProjectApprove> approves) {
List<GovBizProjectApprove> 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<Project> projects,List<GovBizProjectApprove> approves,
BigDecimal approvalAmountApproveTotal){
private FundStatisticsVO.HeJianAmount computeApprovalHeJian(List<Project> projects, List<GovBizProjectApprove> 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<Project> projects,List<GovBizProjectProcure> procures,
BigDecimal approvalAmountApprovalTotal){
private FundStatisticsVO.HeJianAmount computeContractHeJian(List<Project> projects, List<GovBizProjectProcure> 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<GovBizProjectApprove> threeYearsApproves = Lists.newArrayList();
List<GovBizProjectProcure> 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<String> 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<FundStatisticsVO.AmountData> threeYearsDeduction = Lists.newArrayList();
for(Integer year : threeYears){
for (Integer year : threeYears) {
FundStatisticsVO.AmountData amountData = new FundStatisticsVO.AmountData();
//申报项目
List<Project> thisYearsProjects = projectService.list(Wrappers.lambdaQuery(Project.class)
@@ -294,29 +281,29 @@ public class FundStatisticsManage {
.eq(GovBizProjectApply::getBaseProjSetYear, year));
List<String> thisYearProjIds = thisYearApplieYears.stream().map(GovBizProjectApply::getBaseProjId)
.collect(Collectors.toList());
List<GovBizProjectBaseinfo> thisYearBaseInfos = Lists.newArrayList();
List<GovBizProjectBaseinfo> thisYearBaseInfos;
List<GovBizProjectApply> thisYearApplies = Lists.newArrayList();
List<GovBizProjectApprove> thisYearApproves = Lists.newArrayList();
List<GovBizProjectProcure> 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<String> 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<GovBizProjectApply> applies = Lists.newArrayList();
List<GovBizProjectApprove> approves = Lists.newArrayList();
List<GovBizProjectProcure> 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<String> 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<FundStatisticsVO.AmountData> computeTop10(List<Project> projects,List<GovBizProjectBaseinfo> baseInfos,
List<GovBizProjectApply> applies, List<GovBizProjectApprove> approves,
List<GovBizProjectProcure> procures) {
private List<FundStatisticsVO.AmountData> computeTop10(List<Project> projects, List<GovBizProjectBaseinfo> baseInfos,
List<GovBizProjectApply> applies, List<GovBizProjectApprove> approves,
List<GovBizProjectProcure> procures) {
//申报项目颗粒度
Map<String, List<Project>> groupProjectMap = projects.stream()
.filter(p -> StringUtils.isNotBlank(p.getBuildOrgCode()))
.collect(Collectors.groupingBy(Project::getBuildOrgCode));
List<FundStatisticsVO.AmountData> projectAmounts = Lists.newArrayList();
for(Map.Entry<String, List<Project>> entry : groupProjectMap.entrySet()){
for (Map.Entry<String, List<Project>> entry : groupProjectMap.entrySet()) {
FundStatisticsVO.AmountData orgAmount = new FundStatisticsVO.AmountData();
List<Project> 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<FundStatisticsVO.AmountData> govAmounts = Lists.newArrayList();
for(Map.Entry<String, List<GovBizProjectBaseinfo>> entry : groupGovMap.entrySet()){
for (Map.Entry<String, List<GovBizProjectBaseinfo>> entry : groupGovMap.entrySet()) {
FundStatisticsVO.AmountData govAmount = new FundStatisticsVO.AmountData();
List<GovBizProjectBaseinfo> bs = entry.getValue();
List<String> 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<GovBizProjectProcure> 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);
}



+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/EarlyWarningStatisticsVO.java View File

@@ -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


+ 8
- 11
hz-pm-api/src/main/java/com/hz/pm/api/ding/task/GovBusinessStripsTask.java View File

@@ -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;
}



+ 8
- 13
hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java View File

@@ -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) {


+ 10
- 15
hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java View File

@@ -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<DictionaryFieldInfo> recommendedWay, List<FileBasicInfo> recommendProofFile, Long expertUserId) {
private void expertRecommendProofSubmit(List<DictionaryFieldInfo> recommendedWay, List<FileBasicInfo> 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;


+ 4
- 6
hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java View File

@@ -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<SensitiveModifySegment> 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<SensitiveModifySegment> 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<SensitiveModifySegment> sensitiveModifySegments = JSONUtils.parseArray(modifyJson, SensitiveModifySegment.class);
Map<ExpertUserInfoSensitiveFieldEnum, SensitiveModifySegment> collectMap = sensitiveModifySegments


+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java View File

@@ -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<String> projectCodes) throws UnknownHostException {
public void pushTaskSingle(@RequestBody List<String> projectCodes) {
collectionTask.doTaskSingle(projectCodes);
}



+ 397
- 384
hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java
File diff suppressed because it is too large
View File


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApplyDTO.java View File

@@ -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;


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectApproveDTO.java View File

@@ -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;


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectBaseinfoDTO.java View File

@@ -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;



+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectCimplementDTO.java View File

@@ -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;



+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectMimplementDTO.java View File

@@ -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;



+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectProcureDTO.java View File

@@ -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;


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/gov/model/dto/GovBizProjectSaveDTO.java View File

@@ -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;



+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/gov/model/entity/GovBizProjectBaseinfo.java View File

@@ -8,7 +8,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**


+ 4
- 4
hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java View File

@@ -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<Long> agreeOrNoticingExpertIds = CollUtils.fieldList(agreeOrNoticing, MeetingExpert::getExpertId);
if (agreeOrNoticingExpertIds.size() > 0) {
if (!agreeOrNoticingExpertIds.isEmpty()) {
expertIdsNotIn.addAll(agreeOrNoticingExpertIds);
List<ExpertUserFullInfo> agreeOrNoticingUserInfos = expertUserFullInfoService.listByUserIds(agreeOrNoticingExpertIds);
List<String> 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<ExpertUserFullInfo> userFullInfos = expertUserFullInfoService.list(query);
if (userFullInfos.size() == 0) {
if (userFullInfos.isEmpty()) {
return result;
}
Map<String, List<ExpertUserFullInfo>> userGroupByUnit = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompanyUniqCode);


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/ExpertInviteRuleServiceImpl.java View File

@@ -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;


+ 9
- 8
hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java View File

@@ -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<String, DictionaryDTO> dictionaryMap = new ConcurrentHashMap<>();
protected LoadingCache<String, List<DictionaryDTO>> 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<DictionaryDTO> dictionaryDTOList = iMetaDictionaryService.queryAll();
dictionaryMap = buildCateMap(dictionaryDTOList);
Map<String, List<DictionaryDTO>> dictionaryTypeListMap = dictionaryDTOList.stream().collect(Collectors.groupingBy(DictionaryDTO::getDictionaryType));
return dictionaryTypeListMap.get(key);
.refreshAfterWrite(30, TimeUnit.MINUTES).build(key -> {
List<DictionaryDTO> dicts = metaDictionaryService.queryAll();
dictionaryMap = buildCateMap(dicts);
Map<String, List<DictionaryDTO>> dictMapByType = CollUtils.group(dicts, DictionaryDTO::getDictionaryType);
return dictMapByType.get(key);
});
warmUp();
}


+ 4
- 4
hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java View File

@@ -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<String, List<TagTreeDTO>> tagsCache;

@@ -39,7 +39,7 @@ public abstract class AbstractTagsCache implements InitializingBean, TagCache {
.refreshAfterWrite(5, TimeUnit.MINUTES)
.build(key -> {
// 查询全部
List<TagDTO> tagDTOList = iMetaTagService.queryAll();
List<TagDTO> tagDTOList = metaTagService.queryAll();
if (tagDTOList.isEmpty()) {
log.warn("当前层级对应树不存在:{}", key);
return Collections.emptyList();


+ 5
- 0
hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java View File

@@ -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<DictionaryDTO> getDictionaryListByDictionaryType(DictAllTypeEnum dictionaryType) {
return dictionaryCacheHelper.get(dictionaryType.getKey());


+ 5
- 0
hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java View File

@@ -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<TagTreeDTO> tagTreeDtos = tagsCache.get(level + "");


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/GovBusinessStripController.java View File

@@ -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;


+ 3
- 6
hz-pm-api/src/main/java/com/hz/pm/api/organization/helper/impl/GovBusinessStripHelperImpl.java View File

@@ -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)) {


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/GovBusinessStripManage.java View File

@@ -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;


+ 91
- 93
hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java View File

@@ -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<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
@@ -88,12 +86,12 @@ public class VerifyManage {
List<Long> 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<PerformanceAppraisalProjectGroup> 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<PerformanceAppraisal> page = req.page();
LambdaQueryWrapper<PerformanceAppraisal> 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<PerformanceAppraisalVO> 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<PerformanceAppraisalScoreInfo> 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<String> proCodeList = appraisalProjects.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList());
@@ -192,11 +190,11 @@ public class VerifyManage {
LambdaQueryWrapper<Project> 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<Long> ids = appraisalInfoList.stream()
@@ -243,7 +241,7 @@ public class VerifyManage {
// 查出项目模版详情信息
List<PerformanceIndicatorProjectTemplateDetail> detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.in(PerformanceIndicatorProjectTemplateDetail::getId, ids));
if (CollUtil.isEmpty(detailList)){
if (CollUtil.isEmpty(detailList)) {
throw new BizException("评价指标不存在!");
}
Map<Long, PerformanceIndicatorProjectTemplateDetail> 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<PerformanceAppraisalScoreInfo> 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<PerformanceIndicatorProjectTemplate> 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<PerformanceIndicatorProjectTemplate> 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<ExcelHead> 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) {


+ 4
- 10
hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/AddAppraisalObjectDTO.java View File

@@ -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
*/


hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/contants/DeclaredProjectConst.java
File diff suppressed because it is too large
View File


+ 2
- 6
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java View File

@@ -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;
}


+ 28
- 26
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java View File

@@ -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<Project> 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<Project> 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<DeclaredProjectExportDTO> 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<String, OrgInfoDTO> 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;


+ 11
- 11
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java View File

@@ -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<String> 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<UserFullInfoDTO> users = userInfoHelper.getUserFullInfoByEmployeeCodes(reviewHumans);
Set<String> userSet = Sets.newHashSet();
@@ -131,9 +131,9 @@ public class ReviewChecklistManage {
Map<String, String> userMap, UserInfoDetails user) {
List<String> 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<String> 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<String> 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<String> 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<String> computeHumanSet = new HashSet<>(reviewHumans);
for (ReviewChecklistApprove approve : approves) {


+ 1
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DeclaredProjectExportDTO.java View File

@@ -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;


/**


+ 20
- 21
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java View File

@@ -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;


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java View File

@@ -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);
}



+ 6
- 7
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java View File

@@ -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.*;



+ 42
- 41
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java View File

@@ -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<ProjectStatusEnum> 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<AnnualPlanListItemVO> annulPlanLibList(ProjectListReq req) {
LambdaQueryWrapper<Project> 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<AnnualLibImportDTO> 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<Project> projectList = newList.stream().map(n -> {
Project project = new Project();
assemblyProjectInfo(n, project);
@@ -311,7 +314,7 @@ public class AnnualPlanLibManage {

// 筛选出导入的续建项目
List<AnnualLibImportDTO> 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<ProjectRenewalFundDeclaration> 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<Project> 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<JSONObject> fileArray = JSON.parseArray(buildBasis, JSONObject.class);
List<String> 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<String, Object> 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("年度计划导出异常");
}
}
}

+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/AnnualLibImportDTO.java View File

@@ -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;


+ 2
- 7
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java View File

@@ -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<Map<Integer, String>> {

private final List<Project> records = new ArrayList<>();


+ 0
- 32
hz-pm-api/src/main/java/com/hz/pm/api/provincial/utils/FileUtil.java View File

@@ -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;
}
}

+ 0
- 37
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/utils/DateUtil.java View File

@@ -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();
}
}

+ 131
- 125
hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java View File

@@ -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;
}
}

+ 28
- 25
hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java View File

@@ -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;

/**
* 账号密码登陆的认证配置
* <p>
* AgentAuthSecurityConfig
* </p>
*
* @author WendyYang
* @since 14:24 2023/12/16
*/
@Component
public class AgentAuthSecurityConfig
extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {

@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<DefaultSecurityFilterChain, HttpSecurity> {


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);
}

}

+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java View File

@@ -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;


Loading…
Cancel
Save