Sfoglia il codice sorgente

commit

tags/24080901
PoffyZhang 1 anno fa
parent
commit
54c3f3fd9e
63 ha cambiato i file con 1329 aggiunte e 580 eliminazioni
  1. +22
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/model/FreemarkerBatchExportDTO.java
  2. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareYHAction.java
  3. +1
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java
  4. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java
  5. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java
  6. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java
  7. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java
  8. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java
  9. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java
  10. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java
  11. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java
  12. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java
  13. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java
  14. +51
    -12
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/FreemarkerWordUtil.java
  15. +41
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java
  16. +7
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java
  17. +4
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java
  18. +80
    -36
      pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java
  19. +43
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExpertJudgeController.java
  20. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExportController.java
  21. +65
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpertJudge.java
  22. +7
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertReviewTableDTO.java
  23. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingAndAttendStatusDTO.java
  24. +49
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertJudgeEnum.java
  25. +77
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingExpertJudgeReq.java
  26. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingByManagerVO.java
  27. +59
    -13
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertExportManage.java
  28. +94
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingExpertJudgeManage.java
  29. +9
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
  30. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.java
  31. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.xml
  32. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml
  33. +34
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertJudgeService.java
  34. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertJudgeServiceImpl.java
  35. +7
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java
  36. +25
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  37. +18
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java
  38. +4
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java
  39. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java
  40. +0
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java
  41. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java
  42. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java
  43. +5
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java
  44. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java
  45. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java
  46. +9
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java
  47. +353
    -393
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  48. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java
  49. +16
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java
  50. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java
  51. +9
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java
  52. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/ProjectStatusFlowUtil.java
  53. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java
  54. +4
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  55. +5
    -0
      pmapi/src/main/resources/application-dev.yml
  56. +5
    -0
      pmapi/src/main/resources/application-pre.yml
  57. +5
    -0
      pmapi/src/main/resources/application-prod.yml
  58. +21
    -66
      pmapi/src/main/resources/template/meeting/专家评审单.ftl
  59. +42
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java
  60. +17
    -10
      pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java
  61. +26
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/password/PasswordTest.java
  62. +5
    -0
      pmapi/src/test/resources/application-dev.yml
  63. +6
    -1
      pmapi/src/test/resources/application-pre.yml

+ 22
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/model/FreemarkerBatchExportDTO.java Vedi File

@@ -0,0 +1,22 @@
package com.ningdatech.pmapi.common.model;

import lombok.Data;

/**
* <p>
* FreemarkerBatchExportDTO
* </p>
*
* @author WendyYang
* @since 2023/8/1
**/
@Data
public class FreemarkerBatchExportDTO {

private String fileName;

private String template;

private Object data;

}

+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareYHAction.java Vedi File

@@ -210,6 +210,7 @@ public class ProjectDeclareYHAction {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}

@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);


+ 1
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java Vedi File

@@ -211,12 +211,11 @@ public class ProjectDeclareStateMachineJNBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施
// 待采购采购备案,从待采购到建设
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java Vedi File

@@ -211,7 +211,7 @@ public class ProjectDeclareStateMachineJYBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施
// 待采购采购备案,从待采购到建设
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java Vedi File

@@ -211,7 +211,7 @@ public class ProjectDeclareStateMachineKFQBuilder implements ProjectDeclareState
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施
// 待采购采购备案,从待采购到建设
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java Vedi File

@@ -211,7 +211,7 @@ public class ProjectDeclareStateMachineLDBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施
// 待采购采购备案,从待采购到建设
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
@@ -221,7 +221,7 @@ public class ProjectDeclareStateMachineLDBuilder implements ProjectDeclareStateM
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java Vedi File

@@ -212,7 +212,7 @@ public class ProjectDeclareStateMachineLQBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施
// 待采购采购备案,从待采购到建设
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
@@ -222,7 +222,7 @@ public class ProjectDeclareStateMachineLQBuilder implements ProjectDeclareStateM
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java Vedi File

@@ -211,7 +211,7 @@ public class ProjectDeclareStateMachineQTBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施
// 待采购采购备案,从待采购到建设
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
@@ -221,7 +221,7 @@ public class ProjectDeclareStateMachineQTBuilder implements ProjectDeclareStateM
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java Vedi File

@@ -211,7 +211,7 @@ public class ProjectDeclareStateMachineQYBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施
// 待采购采购备案,从待采购到建设
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
@@ -221,7 +221,7 @@ public class ProjectDeclareStateMachineQYBuilder implements ProjectDeclareStateM
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java Vedi File

@@ -212,7 +212,7 @@ public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareState
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施
// 待采购采购备案,从待采购到建设
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
@@ -222,7 +222,7 @@ public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareState
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java Vedi File

@@ -221,7 +221,7 @@ public class ProjectDeclareStateMachineSCBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APP_REGISTER)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.REGISTER_APP).and()
// 待采购采购备案,从待采购到实施
// 待采购采购备案,从待采购到建设
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
@@ -231,7 +231,7 @@ public class ProjectDeclareStateMachineSCBuilder implements ProjectDeclareStateM
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java Vedi File

@@ -211,7 +211,7 @@ public class ProjectDeclareStateMachineSYBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施
// 待采购采购备案,从待采购到建设
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
@@ -221,7 +221,7 @@ public class ProjectDeclareStateMachineSYBuilder implements ProjectDeclareStateM
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java Vedi File

@@ -211,7 +211,7 @@ public class ProjectDeclareStateMachineYHBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施
// 待采购采购备案,从待采购到建设
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
@@ -221,7 +221,7 @@ public class ProjectDeclareStateMachineYHBuilder implements ProjectDeclareStateM
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 51
- 12
pmapi/src/main/java/com/ningdatech/pmapi/common/util/FreemarkerWordUtil.java Vedi File

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.common.util;

import cn.hutool.core.io.IoUtil;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.pmapi.common.model.FreemarkerBatchExportDTO;
import com.ningdatech.pmapi.meeting.entity.dto.ExpertFeeExportDTO;
import com.ningdatech.pmapi.meeting.entity.dto.ExpertInfoDTO;
import freemarker.template.Configuration;
@@ -19,6 +20,9 @@ import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

/**
* <p>
@@ -31,6 +35,16 @@ import java.util.ArrayList;
@Slf4j
public class FreemarkerWordUtil {

private static void setDownFileName(HttpServletResponse response, String fileName) {
String fileNameEncoded;
try {
fileNameEncoded = URLEncoder.encode(fileName, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("文件名编码异常");
}
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileNameEncoded);
}

private static final Configuration CONFIGURATION = new Configuration(Configuration.VERSION_2_3_31);

static {
@@ -69,21 +83,46 @@ public class FreemarkerWordUtil {

public static void export(String fileName, Object data, HttpServletResponse response, String templateName) throws TemplateException, IOException {
Template template = CONFIGURATION.getTemplate(templateName);
StringWriter out = new StringWriter();
Writer writer = new BufferedWriter(out, 4096);
template.process(data, writer);
response.setCharacterEncoding(StandardCharsets.UTF_8.displayName());
response.setContentType(ContentType.APPLICATION_JSON.getMimeType());
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + URLEncoder.encode(fileName, "UTF-8"));
try (InputStream is = new ByteArrayResource(out.toString().getBytes(StandardCharsets.UTF_8)).getInputStream();
ServletOutputStream outputStream = response.getOutputStream()) {
// 缓冲区
byte[] buffer = new byte[1024];
int bytesToRead;
// 通过循环将读入的Word文件的内容输出到浏览器中
while ((bytesToRead = is.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesToRead);
setDownFileName(response, fileName);
try (StringWriter out = new StringWriter();
Writer writer = new BufferedWriter(out, 4096)) {
template.process(data, writer);
try (InputStream is = new ByteArrayResource(out.toString().getBytes(StandardCharsets.UTF_8)).getInputStream();
ServletOutputStream outputStream = response.getOutputStream()) {
// 缓冲区
byte[] buffer = new byte[1024];
int bytesToRead;
// 通过循环将读入的Word文件的内容输出到浏览器中
while ((bytesToRead = is.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesToRead);
}
}
}


}

public static void exportBatch(HttpServletResponse response, List<FreemarkerBatchExportDTO> fbeList, String fileName) throws IOException, TemplateException {
response.setCharacterEncoding(StandardCharsets.UTF_8.displayName());
response.setContentType("application/zip");
setDownFileName(response, fileName);
try (ServletOutputStream os = response.getOutputStream();
ZipOutputStream zos = new ZipOutputStream(os)) {
for (FreemarkerBatchExportDTO param : fbeList) {
Template template = CONFIGURATION.getTemplate(param.getTemplate());
StringWriter out = new StringWriter();
try (Writer writer = new BufferedWriter(out, 4096)) {
template.process(param.getData(), writer);
}
ZipEntry zipEntry = new ZipEntry(param.getFileName());
zos.putNextEntry(zipEntry);
zos.write(out.toString().getBytes(StandardCharsets.UTF_8));
zos.closeEntry();
}
} finally {
response.flushBuffer();
}
}



+ 41
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java Vedi File

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.expert.manage;

import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -8,7 +9,9 @@ import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.cache.lock.DistributedLock;
import com.ningdatech.file.entity.vo.result.AttachFileVo;
import com.ningdatech.file.service.FileService;
import com.ningdatech.pmapi.expert.constant.ReviewResultEnum;
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateOptionDTO;
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO;
import com.ningdatech.pmapi.expert.model.entity.ExpertReview;
import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings;
import com.ningdatech.pmapi.expert.model.req.ExpertReviewDetailReq;
@@ -199,4 +202,42 @@ public class ExpertReviewManage {
return detail;
}

public List<ExpertReview> listFinalExpertReviews(Long meetingId) {
LambdaQueryWrapper<ExpertReview> query = Wrappers.lambdaQuery(ExpertReview.class)
.eq(ExpertReview::getIsFinal, Boolean.TRUE)
.eq(ExpertReview::getMeetingId, meetingId);
return expertReviewService.list(query);
}

public Map<Long, String> buildExpertReviewToStr(Long meetingId) {
List<ExpertReview> reviews = listFinalExpertReviews(meetingId);
if (reviews.isEmpty()) {
return Collections.emptyMap();
}
List<Long> templateIds = CollUtils.fieldList(reviews, ExpertReview::getTemplateId);
List<ReviewTemplateSettings> ts = templateSettingsService.listByIds(templateIds);
Map<Long, ReviewTemplateSettings> tsMap = CollUtils.listToMap(ts, ReviewTemplateSettings::getId);
Map<Long, String> resMap = new HashMap<>(8);
for (ExpertReview review : reviews) {
ReviewTemplateSettings settings = tsMap.get(review.getTemplateId());
List<ReviewTemplateSettingsDTO> optionTemplates = JSONUtil.toList(settings.getContent(), ReviewTemplateSettingsDTO.class);
List<ReviewTemplateOptionDTO> options = JSONUtil.toList(review.getContent(), ReviewTemplateOptionDTO.class);
Map<Integer, ReviewTemplateOptionDTO> optionsMap = CollUtils.listToMap(options, ReviewTemplateOptionDTO::getQuestionSerialNo);
StringBuilder str = new StringBuilder();
optionTemplates.forEach(ot -> {
ReviewTemplateOptionDTO rto = optionsMap.get(ot.getSerialNo());
String optionsContent = ot.getOptions().stream()
.filter(w -> rto.getOptionSerialNo().contains(w.getSerialNo()))
.map(ReviewTemplateSettingsDTO.OptionDTO::getOption)
.collect(Collectors.joining("、"));
str.append("<w:br/>").append(ot.getTitle()).append(":").append(optionsContent).append(";");
});
str.append("<w:br/>").append("其他意见或建议").append(":")
.append(StrUtil.blankToDefault(review.getOtherAdvice(), "--")).append(";");
str.append("<w:br/>").append("评审结果").append(":")
.append(ReviewResultEnum.getByCode(review.getReviewResult()).getValue()).append(";");
resMap.put(review.getProjectId(), str.toString());
}
return resMap;
}
}

+ 7
- 3
pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java Vedi File

@@ -1,19 +1,17 @@
package com.ningdatech.pmapi.irs.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.irs.manage.AppIrsManage;
import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO;
import com.ningdatech.pmapi.irs.model.dto.ApiApplySearchResult;
import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.security.NoSuchAlgorithmException;
import java.util.List;

/**
* @Classname ApplicationController
@@ -45,4 +43,10 @@ public class ApplicationController {
public JSONArray searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException {
return appIrsManage.searchApps(apply);
}

@GetMapping("/digitalResourcesIndicators/{appCode}/{pageSize}")
public JSONObject getDigitalResourcesIndicators(@PathVariable String appCode,@PathVariable Integer pageSize) {
return appIrsManage.getDigitalResourceIndicatorsByAppCode(appCode, pageSize);
}

}

+ 4
- 6
pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java Vedi File

@@ -1,9 +1,6 @@
package com.ningdatech.pmapi.irs.controller;

import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.HttpUtil;
import com.ningdatech.pmapi.irs.utils.RefreshTokenUtil;
import com.ningdatech.pmapi.projectdeclared.manage.IrsManage;
import com.ningdatech.pmapi.projectdeclared.model.vo.IrsApplicationVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PiotTasksVO;
@@ -11,10 +8,11 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;


+ 80
- 36
pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java Vedi File

@@ -9,12 +9,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.irs.service.IRefreshTokenService;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.HttpUtil;
import com.ningdatech.pmapi.common.util.RefreshKeyUtil;
import com.ningdatech.pmapi.irs.model.dto.*;
import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO;
import com.ningdatech.pmapi.irs.model.dto.ApiApplySearchResult;
import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO;
import com.ningdatech.pmapi.irs.model.res.ApiResponse;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
@@ -34,7 +35,6 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -93,8 +93,23 @@ public class AppIrsManage {
@Value("${irs.push-project-detail.appSecret}")
private String pushProjectAppSecret;

//=============数字资源指标获取========================================================================================

@Value("${irs.digital-resource-indicators.app-key}")
private String driAppKey;

@Value("${irs.digital-resource-indicators.app-secret}")
private String driAppSecret;

@Value("${irs.digital-resource-indicators.interface-name}")
private String driInterfaceName;

@Value("${irs.digital-resource-indicators.url}")
private String driUrl;

/**
* 推送 项目和应用关系
*
* @param dto
* @return
* @throws NoSuchAlgorithmException
@@ -112,14 +127,14 @@ public class AppIrsManage {
ApiApplyDTO apiApply = new ApiApplyDTO();
apiApply.setAppId(appCode);
JSONObject jsonObject = this.searchApp(apiApply);
ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject),ApiApplySearchResult.class);
ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject), ApiApplySearchResult.class);
VUtils.isTrue(Objects.isNull(apiApplySearchResult)).throwMessage("应用在IRS不存在!");

long timestamp = System.currentTimeMillis();
String areaCode = project.getAreaCode();
String projectName = project.getProjectName();
String requestSecret = RefreshKeyUtil.getRequestSecret(pushAppKey, pushAppScret);
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode,"bcb4fc0f517fc168ee543fcf4d231f3b");
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b");
String capTime = String.valueOf(timestamp);
String sign = CryptUtils.MD5Encode(pushAppKey + requestSecret + timestamp);
String url = pushUrl + "?requestTime=" + timestamp +
@@ -134,14 +149,14 @@ public class AppIrsManage {

ApiResponse body = forEntity.getBody();

if(Objects.isNull(body) || Objects.isNull(body.getCode())
|| 0 != body.getCode()){
if (Objects.isNull(body) || Objects.isNull(body.getCode())
|| 0 != body.getCode()) {
return Boolean.FALSE;
}

//保存关系
app.setAppCode(appCode);
if(applicationService.updateById(app)){
if (applicationService.updateById(app)) {
/**
* 判断下 如果成功的话 那么判断下 这个项目的初次创建的app 是否都已经被注册
* 如果都已经注册 要调用状态机 进入下一个状态
@@ -150,8 +165,8 @@ public class AppIrsManage {
.eq(ProjectApplication::getProjectId, project.getId()));
//筛选出 初次新建的app 但是没有appCode的
apps = apps.stream().filter(a -> {
if(CommonEnum.YES.getCode().equals(a.getIsFirst()) &&
StringUtils.isBlank(app.getAppCode())){
if (CommonEnum.YES.getCode().equals(a.getIsFirst()) &&
StringUtils.isBlank(app.getAppCode())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
@@ -159,7 +174,7 @@ public class AppIrsManage {
.collect(Collectors.toList());

//如果筛选出来的 为空的话 就调用状态机
if(CollUtil.isEmpty(apps)){
if (CollUtil.isEmpty(apps)) {
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());
projectService.updateById(project);
@@ -171,6 +186,7 @@ public class AppIrsManage {

/**
* 查询app
*
* @param apply
* @return
* @throws NoSuchAlgorithmException
@@ -184,27 +200,27 @@ public class AppIrsManage {
"&appKey=" + searchAppKey + "&" +
"pageSize=10&pageNum=1&appCode=" + appCode +
"&areaCode=&deptCode=&name=";
log.info("url : {}",url);
log.info("url : {}", url);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);

log.info("查询应用目录 : {}",JSON.toJSONString(forEntity));
log.info("查询应用目录 : {}", JSON.toJSONString(forEntity));

if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())){
if (Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())) {
JSONObject body = JSON.parseObject(forEntity.getBody());
if(Objects.isNull(body)){
if (Objects.isNull(body)) {
return null;
}
JSONObject datas = body.getJSONObject("datas");
if(Objects.isNull(datas)){
if (Objects.isNull(datas)) {
return null;
}
JSONObject data = datas.getJSONObject("data");
if(Objects.isNull(data)){
if (Objects.isNull(data)) {
return null;
}
JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult");
if(CollUtil.isEmpty(apiApplySearchResult)){
if (CollUtil.isEmpty(apiApplySearchResult)) {
return null;
}
return apiApplySearchResult.getJSONObject(0);
@@ -225,19 +241,19 @@ public class AppIrsManage {
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);

log.info("查询应用目录 : {}",JSON.toJSONString(forEntity));
log.info("查询应用目录 : {}", JSON.toJSONString(forEntity));

if(Objects.nonNull(forEntity.getBody())){
if (Objects.nonNull(forEntity.getBody())) {
JSONObject body = JSON.parseObject(forEntity.getBody());
if(Objects.isNull(body)){
if (Objects.isNull(body)) {
return null;
}
JSONObject datas = body.getJSONObject("datas");
if(Objects.isNull(datas)){
if (Objects.isNull(datas)) {
return null;
}
JSONObject data = datas.getJSONObject("data");
if(Objects.isNull(data)){
if (Objects.isNull(data)) {
return null;
}
JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult");
@@ -252,14 +268,14 @@ public class AppIrsManage {
String appKey = "A331101453557202109017383";
String method = "POST";
String interfaceName = "5crv7i4727abLCv0";
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,interfaceName,method);
log.info("secret :{}",secret);
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method);
log.info("secret :{}", secret);
String sign = MD5.create().digestHex(appKey + secret + timestamp);
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory();
RestTemplate restTemplate;
if(Objects.nonNull(factory)){
if (Objects.nonNull(factory)) {
restTemplate = new RestTemplate(factory);
}else{
} else {
restTemplate = new RestTemplate();
}
String appId = "A330000100000202105005790";
@@ -269,7 +285,7 @@ public class AppIrsManage {
"&sign=" + sign + "&appKey=" + appKey +
"&capCode=" + capCode + "&capTime=" + timestamp +
"&appId=" + appId;
log.info("url :{}",url);
log.info("url :{}", url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());
return forEntity.getBody();
@@ -277,6 +293,7 @@ public class AppIrsManage {

/**
* 推送项目详情
*
* @return
*/
public String pushProjectDetail(ProjectDTO projectDto) {
@@ -285,14 +302,14 @@ public class AppIrsManage {
String appKey = pushProjectAppKey;
String method = HttpMethod.POST.name();
String interfaceName = pushProjectInterfaceName;
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,interfaceName,method);
log.info("secret :{}",secret);
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method);
log.info("secret :{}", secret);
String sign = MD5.create().digestHex(appKey + secret + timestamp);
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory();
RestTemplate restTemplate;
if(Objects.nonNull(factory)){
if (Objects.nonNull(factory)) {
restTemplate = new RestTemplate(factory);
}else{
} else {
restTemplate = new RestTemplate();
}
String baseProjPrincipal = projectDto.getResponsibleMan();//"蒋国海"
@@ -318,13 +335,13 @@ public class AppIrsManage {
String baseProvManDeprtDing = projectDto.getHigherSuperOrgCode();//"GO_6c383c049d95461f9a0df780140ceb32";
String baseBasisEstablish = projectDto.getBuildBasis();//"中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函";
String capCode = null;
try{
try {
capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b");
}catch (Exception e){
} catch (Exception e) {
log.error(e.getMessage());
}

String url = pushProjectUrl+ "?" +
String url = pushProjectUrl + "?" +
"requestTime=" + timestamp + "&sign=" + sign +
"&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" +
"&baseProjSetYear=" + baseProjSetYear + "&baseProjId=" + baseProjId +
@@ -337,9 +354,36 @@ public class AppIrsManage {
"&baseProjConsClass=" + baseProjConsClass + "&capCode=" + capCode + "&baseManDeprtDing=" + baseManDeprtDing +
"&baseProvManDeprtDing=" + baseProvManDeprtDing + "&baseBasisEstablish=" + baseBasisEstablish +
"&baseAreaCode=" + areaCode + "&capTime=" + timestamp + "&baseAreaName=" + baseAreaName;
log.info("url :{}",url);
log.info("url :{}", url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());
return forEntity.getBody();
}

public JSONObject getDigitalResourceIndicatorsByAppCode(String appCode, Integer pageSize) {
long timestamp = System.currentTimeMillis();
String appSecret = driAppSecret;
String appKey = driAppKey;
String method = HttpMethod.POST.name();
String interfaceName = driInterfaceName;
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method);
log.info("secret : {}", secret);
String sign = MD5.create().digestHex(appKey + secret + timestamp);
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory();
RestTemplate restTemplate;
if (Objects.nonNull(factory)) {
restTemplate = new RestTemplate(factory);
} else {
restTemplate = new RestTemplate();
}

String url = driUrl + "?" +
"requestTime=" + timestamp + "&sign=" + sign +
"&appKey=" + appKey + "&appCode=" + appCode + "&pageIndex=1&pageSize=" + pageSize;
log.info("url :{}", url);
ResponseEntity<JSONObject> forEntity = restTemplate.getForEntity(url, JSONObject.class);
log.info(Objects.requireNonNull(forEntity.getBody()).toJSONString());
return forEntity.getBody();
}

}

+ 43
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExpertJudgeController.java Vedi File

@@ -0,0 +1,43 @@
package com.ningdatech.pmapi.meeting.controller;


import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq;
import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq.Basic;
import com.ningdatech.pmapi.meeting.manage.MeetingExpertJudgeManage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* <p>
* 前端控制器
* </p>
*
* @author WendyYang
* @since 2023-07-31
*/
@Api(tags = "履职评价管理")
@AllArgsConstructor
@RestController
@RequestMapping("/api/v1/meeting/expert-judge")
public class MeetingExpertJudgeController {

private final MeetingExpertJudgeManage expertJudgeManage;

@ApiOperation("保存履职评价")
@PostMapping("/submit")
public void saveExpertJudge(@Validated(Basic.class) @RequestBody MeetingExpertJudgeReq req) {
expertJudgeManage.saveExpertJudge(req);
}

@ApiOperation("查看履职评价")
@GetMapping("/detail/{meetingExpertId}")
public MeetingExpertJudgeReq expertJudgeDetail(@PathVariable Long meetingExpertId) {
return expertJudgeManage.expertJudgeDetail(meetingExpertId);
}

}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExportController.java Vedi File

@@ -48,7 +48,7 @@ public class MeetingExportController {
}

@GetMapping("/expertInviteTable/{meetingId}")
@ApiOperation("专家评审单导出")
@ApiOperation("专家抽取表导出")
public void exportExpertInviteTable(@PathVariable Long meetingId, HttpServletResponse response) {
expertExportManage.expertInviteTable(meetingId, response);
}


+ 65
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpertJudge.java Vedi File

@@ -0,0 +1,65 @@
package com.ningdatech.pmapi.meeting.entity.domain;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* <p>
* 会议专家履职评价表
* </p>
*
* @author WendyYang
* @since 2023-07-31
*/
@Data
@TableName("meeting_expert_judge")
@ApiModel(value = "MeetingExpertJudge对象")
public class MeetingExpertJudge implements Serializable {

private static final long serialVersionUID = 1L;

@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("会议ID")
private Long meetingId;

private Long expertId;

@ApiModelProperty("会议专家ID")
private Long meetingExpertId;

@ApiModelProperty("评分(1~10)")
private Integer score;

@ApiModelProperty("是否参加:1 准时、2 迟到、3 缺席")
private Integer attended;

@ApiModelProperty("参与程度:1 积极、2 消极")
private Integer performance;

@ApiModelProperty("是否提出建议:true 是、false 否")
private Boolean advised;

@ApiModelProperty("是否早退:true 早退、false 未早退")
private Boolean leaveEarly;

@ApiModelProperty("是否违规:true 是、false 否")
private Boolean brokeRule;

@ApiModelProperty("违规内容")
private String brokeRuleContent;

@TableField(fill = FieldFill.INSERT)
private Long createBy;

@TableField(fill = FieldFill.INSERT)
private LocalDateTime createOn;

}

+ 7
- 1
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/ExpertReviewTableDTO.java Vedi File

@@ -2,6 +2,8 @@ package com.ningdatech.pmapi.meeting.entity.dto;

import lombok.Data;

import java.io.Serializable;

/**
* <p>
* ExpertReviewTableDTO
@@ -11,7 +13,9 @@ import lombok.Data;
* @since 2023/7/24
**/
@Data
public class ExpertReviewTableDTO {
public class ExpertReviewTableDTO implements Serializable {

private static final long serialVersionUID = 3383159744182234397L;

private String projectName;

@@ -21,4 +25,6 @@ public class ExpertReviewTableDTO {

private String holdOrg;

private String reviewResult;

}

+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingAndAttendStatusDTO.java Vedi File

@@ -15,6 +15,10 @@ public class MeetingAndAttendStatusDTO {

private Long meetingId;

private Long meetingExpertId;

private Long expertId;

private Integer status;

private Boolean attended;


+ 49
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertJudgeEnum.java Vedi File

@@ -0,0 +1,49 @@
package com.ningdatech.pmapi.meeting.entity.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
* <p>
* ExpertJudgeEnum
* </p>
*
* @author WendyYang
* @since 2023/8/3
**/
public class ExpertJudgeEnum {

private ExpertJudgeEnum() {
}

@Getter
@AllArgsConstructor
public enum AttendStatus {
ON_TIME(1, "准时"),
BE_LATE(2, "迟到"),
ABSENT(3, "缺席");

private final Integer code;
private final String value;

public boolean eq(Integer code) {
return this.code.equals(code);
}
}

@Getter
@AllArgsConstructor
public enum Performance {

POSITIVE(1, "积极"),
NEGATIVE(2, "消极");

private final Integer code;
private final String value;

public boolean eq(Integer code) {
return this.code.equals(code);
}
}

}

+ 77
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingExpertJudgeReq.java Vedi File

@@ -0,0 +1,77 @@
package com.ningdatech.pmapi.meeting.entity.req;

import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertJudgeEnum;
import org.hibernate.validator.constraints.Range;

/**
* <p>
* MeetingExpertJudgeReq
* </p>
*
* @author WendyYang
* @since 2023/7/31
**/
@Data
public class MeetingExpertJudgeReq {

private Long id;

@NotNull(message = "会议ID不能为空", groups = Basic.class)
private Long meetingId;

@NotNull(message = "会议专家ID不能为空", groups = Basic.class)
private Long meetingExpertId;

@ApiModelProperty("评分(1~10)")
@NotNull(message = "评分不能为空", groups = Basic.class)
@Range(min = 1, max = 10, message = "评分范围为:1~10")
private Integer score;

/**
* @see ExpertJudgeEnum.AttendStatus
*/
@ApiModelProperty("是否参加:1 准时、2 迟到、3 缺席")
@NotNull(message = "是否参加不能为空", groups = Basic.class)
private Integer attended;

/**
* @see ExpertJudgeEnum.Performance
*/
@ApiModelProperty("参与程度:1 积极、2 消极")
@NotNull(message = "参与度不能为空", groups = Attend.class)
private Integer performance;

@ApiModelProperty("是否提出建议:true 是、false 否")
@NotNull(message = "是否提出建议不能为空", groups = Attend.class)
private Boolean advised;

@ApiModelProperty("是否早退:true 早退、false 未早退")
@NotNull(message = "是否早退不能为空", groups = Attend.class)
private Boolean leaveEarly;

@ApiModelProperty("是否违规:true 是、false 否")
@NotNull(message = "是否违规不能为空", groups = Attend.class)
private Boolean brokeRule;

@ApiModelProperty("违规内容")
private String brokeRuleContent;

@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createOn;

//==================================================================================================================

public interface Attend {
}

public interface Basic {
}

}

+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingByManagerVO.java Vedi File

@@ -29,6 +29,9 @@ public class MeetingByManagerVO {
@ApiModelProperty("会议ID")
private Long meetingId;

@ApiModelProperty("会议专家ID")
private Long meetingExpertId;

@ApiModelProperty("会议开始时间")
@JSONField(format = "yyyy-MM-dd HH:mm")
private LocalDateTime startTime;
@@ -70,4 +73,7 @@ public class MeetingByManagerVO {
@ApiModelProperty("联系方式")
private String contact;

@ApiModelProperty("是否评价")
private Boolean hasJudge;

}

+ 59
- 13
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertExportManage.java Vedi File

@@ -3,16 +3,20 @@ package com.ningdatech.pmapi.meeting.manage;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.model.FreemarkerBatchExportDTO;
import com.ningdatech.pmapi.common.util.FreemarkerWordUtil;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.manage.ExpertReviewManage;
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingInnerProject;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingOuterProject;
import com.ningdatech.pmapi.meeting.entity.dto.*;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
import com.ningdatech.pmapi.meeting.service.IMeetingInnerProjectService;
import com.ningdatech.pmapi.meeting.service.IMeetingOuterProjectService;
@@ -29,11 +33,13 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;

/**
* <p>
@@ -54,6 +60,7 @@ public class ExpertExportManage {
private final IMeetingOuterProjectService meetingOuterProjectService;
private final IExpertUserFullInfoService expertUserInfoService;
private final IProjectService projectService;
private final ExpertReviewManage expertReviewManage;

//==================================================================================================================

@@ -78,6 +85,16 @@ public class ExpertExportManage {

static Supplier<String> wordName = () -> UUID.randomUUID().toString(true) + ".doc";

private List<MeetingExpert> listExpertsByAgreeOrLeave(Long meetingId) {
Page<MeetingExpert> page = Page.of(1, 20);
meetingExpertService.pageExpertByStatusAndMeetingId(page, meetingId, null, null);
if (page.getTotal() == 0) {
return Collections.emptyList();
}
page.getRecords().removeIf(w -> !(ExpertAttendStatusEnum.AGREED.eq(w.getStatus()) || ExpertAttendStatusEnum.ON_LEAVE.eq(w.getStatus())));
return page.getRecords();
}

//==================================================================================================================

public void exportFeeForExpert(Long meetingId, HttpServletResponse response) {
@@ -130,22 +147,43 @@ public class ExpertExportManage {
public void expertReviewTable(Long meetingId, HttpServletResponse response) {
try {
Meeting meeting = meetingService.getById(meetingId);
ExpertReviewTableDTO data = new ExpertReviewTableDTO();
data.setMeetingTime(DateUtil.localDateTimeFormat(meeting.getStartTime(), "yyyy年M月d日"));
data.setMeetingAddress(meeting.getMeetingAddress());
data.setHoldOrg(meeting.getHoldOrg());
List<String> projectNames = new ArrayList<>();
String startTime = DateUtil.localDateTimeFormat(meeting.getStartTime(), "yyyy年M月d日");
List<FreemarkerBatchExportDTO> fbeList;
if (meeting.getIsInnerProject()) {
List<MeetingInnerProject> inners = meetingInnerProjectService.listByMeetingId(meetingId);
Map<Long, String> reviewResultMap = expertReviewManage.buildExpertReviewToStr(meetingId);
List<Long> projectIds = CollUtils.fieldList(inners, MeetingInnerProject::getProjectId);
List<Project> projects = projectService.listByIds(projectIds);
projects.forEach(w -> projectNames.add(w.getProjectName()));
fbeList = projects.stream().map(w -> {
FreemarkerBatchExportDTO fbe = new FreemarkerBatchExportDTO();
ExpertReviewTableDTO currData = new ExpertReviewTableDTO();
currData.setHoldOrg(meeting.getHoldOrg());
currData.setMeetingTime(startTime);
currData.setMeetingAddress(meeting.getMeetingAddress());
currData.setProjectName(w.getProjectName());
currData.setReviewResult(reviewResultMap.get(w.getId()));
fbe.setData(currData);
fbe.setTemplate(EXPERT_REVIEW);
fbe.setFileName(w.getProjectName() + ".doc");
return fbe;
}).collect(Collectors.toList());
} else {
List<MeetingOuterProject> inners = meetingOuterProjectService.listByMeetingId(meetingId);
inners.forEach(w -> projectNames.add(w.getProjectName()));
fbeList = inners.stream().map(w -> {
FreemarkerBatchExportDTO fbe = new FreemarkerBatchExportDTO();
ExpertReviewTableDTO currData = new ExpertReviewTableDTO();
currData.setHoldOrg(meeting.getHoldOrg());
currData.setMeetingTime(startTime);
currData.setMeetingAddress(meeting.getMeetingAddress());
currData.setProjectName(w.getProjectName());
fbe.setData(currData);
fbe.setTemplate(EXPERT_REVIEW);
fbe.setFileName(w.getProjectName() + ".doc");
return fbe;
}).collect(Collectors.toList());
}
data.setProjectName(StrUtil.join("、", projectNames));
FreemarkerWordUtil.export(wordName.get(), data, response, EXPERT_REVIEW);
String exportFileName = meeting.getName() + "专家评审表.zip";
FreemarkerWordUtil.exportBatch(response, fbeList, exportFileName);
} catch (TemplateException | IOException e) {
log.error("专家评审单导出异常:{}", meetingId, e);
throw BizException.wrap("专家评审单导出失败");
@@ -171,13 +209,17 @@ public class ExpertExportManage {
data.setProjectName(StrUtil.join("、", projectNames));
data.setExperts(new ArrayList<>());
// 设置专家信息
List<MeetingExpert> experts = meetingExpertService.listAgreedExperts(meetingId);
List<MeetingExpert> experts = listExpertsByAgreeOrLeave(meetingId);
List<Long> expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId);
List<ExpertUserFullInfo> expertInfos = expertUserInfoService.listByUserId(expertIds);
Map<Long, ExpertUserFullInfo> expertMap = CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId);
experts.forEach(w -> {
ExpertInfoDTO expert = new ExpertInfoDTO();
expert.setName(w.getExpertName());
if (ExpertAttendStatusEnum.ON_LEAVE.eq(w.getStatus())) {
expert.setBank(w.getExpertName() + "(请假)");
} else {
expert.setName(w.getExpertName());
}
ExpertUserFullInfo expertUser = expertMap.get(w.getExpertId());
if (expertUser != null) {
expert.setCompany(expertUser.getCompany());
@@ -217,7 +259,7 @@ public class ExpertExportManage {
}
data.setExperts(new ArrayList<>());
// 设置专家信息
List<MeetingExpert> experts = meetingExpertService.listAgreedExperts(meetingId);
List<MeetingExpert> experts = listExpertsByAgreeOrLeave(meetingId);
List<Long> expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId);
List<ExpertUserFullInfo> expertInfos = expertUserInfoService.listByUserId(expertIds);
Map<Long, ExpertUserFullInfo> expertMap = CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId);
@@ -225,7 +267,11 @@ public class ExpertExportManage {
experts.forEach(w -> {
ExpertInfoDTO expert = new ExpertInfoDTO();
expert.setNo(integer.incrementAndGet());
expert.setName(w.getExpertName());
if (ExpertAttendStatusEnum.ON_LEAVE.eq(w.getStatus())) {
expert.setBank(w.getExpertName() + "(请假)");
} else {
expert.setName(w.getExpertName());
}
expert.setMobile(w.getMobile());
ExpertUserFullInfo expertUser = expertMap.get(w.getExpertId());
if (expertUser != null) {


+ 94
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingExpertJudgeManage.java Vedi File

@@ -0,0 +1,94 @@
package com.ningdatech.pmapi.meeting.manage;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.basic.util.ValidUtil;
import com.ningdatech.cache.lock.DistributedLock;
import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertJudgeEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum;
import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq;
import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq.Attend;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertJudgeService;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
import com.ningdatech.pmapi.meeting.service.IMeetingService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
* <p>
* MeetingExpertJudgeManage
* </p>
*
* @author WendyYang
* @since 2023/7/31
**/
@Component
@AllArgsConstructor
public class MeetingExpertJudgeManage {

private final IMeetingExpertJudgeService expertJudgeService;
private final IMeetingExpertService meetingExpertService;
private final IMeetingService meetingService;
private final DistributedLock distributedLock;

private MeetingExpertJudge getMeetingExpertJudge(Long meetingExpertId) {
LambdaQueryWrapper<MeetingExpertJudge> query = Wrappers.lambdaQuery(MeetingExpertJudge.class)
.eq(MeetingExpertJudge::getMeetingExpertId, meetingExpertId);
return expertJudgeService.getOne(query);
}

public void saveExpertJudge(MeetingExpertJudgeReq req) {
String key = "lock_expert_judge:" + req.getMeetingExpertId();
if (!distributedLock.lock(key, 3)) {
throw BizException.wrap("履职评价失败,请重试");
}
try {
if (!ExpertJudgeEnum.AttendStatus.ABSENT.eq(req.getAttended())) {
Map<String, String> validMap = ValidUtil.valid(req, Attend.class);
if (!validMap.isEmpty()) {
String errMsg = CollUtils.joinByComma(validMap.values());
throw BizException.wrap(errMsg);
}
}
// 会议状态校验
Meeting meeting = meetingService.getById(req.getMeetingId());
if (meeting == null || MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) {
throw BizException.wrap("会议不存在或已取消");
}
// 专家抽取状态校验
MeetingExpert expert = meetingExpertService.getById(req.getMeetingExpertId());
if (expert == null || (ExpertAttendStatusEnum.AGREED.eq(expert.getStatus())
&& ExpertAttendStatusEnum.ON_LEAVE.eq(expert.getStatus()))) {
throw BizException.wrap("未被抽中专家无法进行履职评价");
}
// 智能履职评价一次
MeetingExpertJudge judge = getMeetingExpertJudge(req.getMeetingExpertId());
if (judge != null) {
throw BizException.wrap("履职评价已提交");
}
MeetingExpertJudge entity = BeanUtil.copyProperties(req, MeetingExpertJudge.class);
entity.setExpertId(expert.getExpertId());
expertJudgeService.save(entity);
} finally {
distributedLock.releaseLock(key);
}
}

public MeetingExpertJudgeReq expertJudgeDetail(Long meetingExpertId) {
MeetingExpertJudge judge = getMeetingExpertJudge(meetingExpertId);
if (judge == null) {
throw BizException.wrap("履职评价未提交");
}
return BeanUtil.copyProperties(judge, MeetingExpertJudgeReq.class);
}

}

+ 9
- 1
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java Vedi File

@@ -97,6 +97,7 @@ public class MeetingManage {
private final ExpertInviteHelper expertInviteHelper;
private final MeetingCallOrMsgHelper meetingCallOrMsgHelper;
private final MeetingDataScopeHelper meetingDataScopeHelper;
private final IMeetingExpertJudgeService expertJudgeService;
private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:";

private static final String MEETING_CREATE_KEY = "MEETING_CREATE:";
@@ -324,7 +325,11 @@ public class MeetingManage {
return PageVo.empty();
}
Map<Long, MeetingAndAttendStatusDTO> mapByMeetingId = new HashMap<>(16);
meetings.forEach(w -> mapByMeetingId.put(w.getMeetingId(), w));
List<Long> meetingExpertIds = new ArrayList<>();
meetings.forEach(w -> {
mapByMeetingId.put(w.getMeetingId(), w);
meetingExpertIds.add(w.getMeetingExpertId());
});
LambdaQueryWrapper<Meeting> query = new LambdaQueryWrapper<Meeting>()
.orderByDesc(Meeting::getCreateOn)
.in(Meeting::getId, mapByMeetingId.keySet())
@@ -337,11 +342,14 @@ public class MeetingManage {
if (page.getTotal() == 0) {
return PageVo.empty();
}
List<Long> existsMeIds = expertJudgeService.listExistsMeetingExpertIds(meetingExpertIds);
PageVo<MeetingByManagerVO> result = new PageVo<>(new ArrayList<>(), page.getTotal());
page.getRecords().forEach(meeting -> {
MeetingByManagerVO item = meetingManageHelper.buildByMeeting(meeting);
MeetingAndAttendStatusDTO info = mapByMeetingId.get(meeting.getId());
item.setMeetingExpertId(info.getMeetingExpertId());
item.setExpertStatus(info.getStatus());
item.setHasJudge(existsMeIds.contains(info.getMeetingExpertId()));
result.getRecords().add(item);
});
return result;


+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.java Vedi File

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.meeting.mapper;

import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* Mapper 接口
* </p>
*
* @author CMM
* @since 2023-07-31
*/
public interface MeetingExpertJudgeMapper extends BaseMapper<MeetingExpertJudge> {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.xml Vedi File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.pmapi.meeting.mapper.MeetingExpertJudgeMapper">

</mapper>

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml Vedi File

@@ -4,7 +4,7 @@

<select id="selectByExpertIdAndStatus"
resultType="com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO">
SELECT em.meeting_id meetingId, em.status
SELECT em.meeting_id meetingId, em.status, em.ID meetingExpertId
FROM (SELECT ROW_NUMBER() OVER ( PARTITION BY meeting_id ORDER BY update_on DESC ) rowNumber, ID, expert_id,
status, meeting_id
FROM meeting_expert


+ 34
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertJudgeService.java Vedi File

@@ -0,0 +1,34 @@
package com.ningdatech.pmapi.meeting.service;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
* <p>
* 服务类
* </p>
*
* @author CMM
* @since 2023-07-31
*/
public interface IMeetingExpertJudgeService extends IService<MeetingExpertJudge> {

default List<Long> listExistsMeetingExpertIds(Collection<Long> meetingExpertIds) {
if (CollUtil.isEmpty(meetingExpertIds)) {
return Collections.emptyList();
}
LambdaQueryWrapper<MeetingExpertJudge> query = Wrappers.lambdaQuery(MeetingExpertJudge.class)
.select(MeetingExpertJudge::getMeetingExpertId)
.in(MeetingExpertJudge::getMeetingExpertId, meetingExpertIds);
return CollUtils.fieldList(list(query), MeetingExpertJudge::getMeetingExpertId);
}

}

+ 20
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertJudgeServiceImpl.java Vedi File

@@ -0,0 +1,20 @@
package com.ningdatech.pmapi.meeting.service.impl;

import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge;
import com.ningdatech.pmapi.meeting.mapper.MeetingExpertJudgeMapper;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertJudgeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
* <p>
* 服务实现类
* </p>
*
* @author CMM
* @since 2023-07-31
*/
@Service
public class MeetingExpertJudgeServiceImpl extends ServiceImpl<MeetingExpertJudgeMapper, MeetingExpertJudge> implements IMeetingExpertJudgeService {

}

+ 7
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java Vedi File

@@ -4,7 +4,6 @@ import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.projectdeclared.manage.DelayedApplyManage;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.DelayedApplyDTO;
import com.ningdatech.pmapi.projectdeclared.model.vo.DelayedApplyVO;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
@@ -16,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
* @Classname DelayedProjectController
@@ -39,6 +39,12 @@ public class DelayedApplyController {
return delayedApplyManage.projectLibList(req);
}

@ApiOperation(value = "查看某个项目的延期列表", notes = "查看某个项目的延期列表")
@GetMapping("/delay-list/{projectId}")
public List<DelayedApplyVO> delayList(@PathVariable Long projectId) {
return delayedApplyManage.delayList(projectId);
}

@ApiOperation(value = "延期的内容详情", notes = "延期的内容详情")
@GetMapping("/detail/{projectId}")
public DelayedApplyVO detailByProjectId(@PathVariable Long projectId) {


+ 25
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java Vedi File

@@ -175,7 +175,13 @@ public class ConstructionPlanManage {
log.info("建设方案项目申报成功 【{}】", instanceId);

// 保存建设项目相关
Project buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo,instanceId,employeeCode,oldProject);
Project buildProject = new Project();
if(dto.getRestart()){
//如果是重新提交 不用生成新版本 前面已经生成过了
buildProject = contructionPlanModifyProject(oldProject, instanceId);
}else{
buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo,instanceId,employeeCode,oldProject);
}

//发送给第一个审批人消息
noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId,
@@ -184,6 +190,24 @@ public class ConstructionPlanManage {
return instanceId;
}

private Project contructionPlanModifyProject(Project project, String instanceId) {
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());
project.setInstCode(instanceId);
projectService.updateById(project);

//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
projectInst.setInstCode(instanceId);
projectInst.setCreatOn(LocalDateTime.now());
projectInst.setUpdateOn(LocalDateTime.now());
projectInst.setInstType(ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode());
projectInstService.save(projectInst);

return project;
}

/**
* 驳回 重新提交建设方案
*


+ 18
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java Vedi File

@@ -303,4 +303,22 @@ public class DelayedApplyManage {
}
return BeanUtil.copyProperties(delayApply,DelayedApplyVO.class);
}

/**
* 查看某个项目的 延期列表
* @param projectId
* @return
*/
public List<DelayedApplyVO> delayList(Long projectId) {
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectId);
List<ProjectDelayApply> delays = projectDelayApplyService.list(Wrappers.lambdaQuery(ProjectDelayApply.class)
.in(ProjectDelayApply::getProjectId, allVersionProjectId));

if(CollUtil.isEmpty(delays)){
return Collections.emptyList();
}

return delays.stream().map(d -> BeanUtil.copyProperties(d,DelayedApplyVO.class))
.collect(Collectors.toList());
}
}

+ 4
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java Vedi File

@@ -238,7 +238,8 @@ public class FinalAcceptanceManage {

//保存终验项目
//生成新版本 并且进入下一状态
projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode());
projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,
InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.TRUE);

//发送给第一个审批人消息
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId,
@@ -298,7 +299,8 @@ public class FinalAcceptanceManage {

//保存终验项目
//生成新版本 并且进入下一状态
projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode());
projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,
InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.TRUE);

//发送给第一个审批人消息
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId,


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java Vedi File

@@ -81,6 +81,8 @@ public class OperationManage {
entity.setProjectCode(project.getProjectCode());
entity.setUpdateOn(LocalDateTime.now());
entity.setUpdateBy(user.getUsername());
//强制放入 计划终验时间
entity.setFinalInspectionDate(project.getPlanAcceptanceTime());
if(operationService.saveOrUpdate(entity)){
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());


+ 0
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java Vedi File

@@ -102,9 +102,6 @@ public class ReviewByDeptJointManage {

//保存项目信息
projectInfo = projectLibManage.saveProjectWithVersion(projectInfo,instanceId,ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode());
// if(!modifyProject(projectInfo, instanceId)){
// return Boolean.FALSE;
// }

//发送给第一个审批人消息
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId,


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java Vedi File

@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil;
import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant;
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils;
import com.wflow.workflow.bean.process.ProgressNode;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
@@ -64,6 +65,7 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, allVersionProjectIds)
.eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode())
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE)
.orderByDesc(ProjectInst::getCreatOn)
.last(BizConst.LIMIT_1));
ProcessProgressVo instanceDetail = null;


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java Vedi File

@@ -10,6 +10,7 @@ import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil;
import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant;
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils;
import com.wflow.workflow.bean.process.ProgressNode;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
@@ -66,6 +67,7 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle {
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, allVersionProjectIds)
.eq(ProjectInst::getInstType, InstTypeEnum.DEPT_UNITED_REVIEW.getCode())
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE)
.orderByDesc(ProjectInst::getCreatOn)
.last(BizConst.LIMIT_1));
if (Objects.isNull(projectInst)){


+ 5
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java Vedi File

@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil;
import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant;
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils;
import com.wflow.workflow.bean.process.ProgressNode;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
@@ -60,10 +61,13 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle {
if (Objects.isNull(project)){
throw new BizException("当前项目不存在!");
}
//查出历史版本的 所有项目ID
List<Long> allVersionProjectIds = projectService.getAllVersionProjectId(projectId);
// 根据项目ID查询项目预审流程的流程状态
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getProjectId, projectId)
.in(ProjectInst::getProjectId, allVersionProjectIds)
.eq(ProjectInst::getInstType, InstTypeEnum.PRELIMINARY_PREVIEW.getCode())
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE)
.orderByDesc(ProjectInst::getCreatOn)
.last("limit 1"));
ProcessProgressVo instanceDetail = null;


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java Vedi File

@@ -13,6 +13,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant;
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils;
import com.wflow.workflow.bean.process.ProgressNode;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
@@ -60,6 +61,7 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, allVersionProjectIds)
.eq(ProjectInst::getInstType, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode())
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE)
.orderByDesc(ProjectInst::getCreatOn)
.last(BizConst.LIMIT_1));



+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java Vedi File

@@ -20,6 +20,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil;
import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant;
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.process.ProgressNode;
@@ -67,6 +68,7 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle {
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, allVersionProjectIds)
.eq(ProjectInst::getInstType, InstTypeEnum.UNIT_INNER_AUDIT.getCode())
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE)
.orderByDesc(ProjectInst::getCreatOn)
.last(BizConst.LIMIT_1));
ProcessProgressVo instanceDetail = null;


+ 9
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java Vedi File

@@ -164,12 +164,18 @@ public class AnnualPlanLibManage {
//计划出 计划验收时间
LocalDateTime planAcceptanceTime = getPlanAcceptanceTime(req);
LambdaUpdateWrapper<Project> update =
Wrappers.lambdaUpdate(Project.class).set(Project::getApprovalAmount, req.getApprovedAmount())
.set(Project::getApprovedFile, req.getApprovedFileId()).set(Project::getBuildCycle, req.getBuildCycle())
Wrappers.lambdaUpdate(Project.class)
.set(Project::getApprovalAmount, req.getApprovedAmount())
.set(Project::getApprovedFile, req.getApprovedFileId())
.set(Project::getBuildCycle, req.getBuildCycle())
.set(Project::getOriginBuildCycle,req.getBuildCycle())
.set(Project::getApprovedConstructionPlanFile, req.getBuildPlanFileId())
.set(Project::getApprovalDate, req.getApprovedDate()).set(Project::getStatus, project.getStatus())
.set(Project::getApprovalDate, req.getApprovedDate())
.set(Project::getStatus, project.getStatus())
.set(Project::getStage, project.getStage())
.set(Objects.nonNull(planAcceptanceTime),Project::getPlanAcceptanceTime,planAcceptanceTime)
//记录原始的 计划验收时间
.set(Objects.nonNull(planAcceptanceTime),Project::getOriginPlanAcceptanceTime,planAcceptanceTime)
.eq(Project::getId, req.getProjectId());
projectService.update(update);
}


+ 353
- 393
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java Vedi File

@@ -139,6 +139,9 @@ public class ProjectLibManage {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
item.setProjectName(w.getProjectName());
item.setProjectCode(w.getProjectCode());
item.setArea(w.getArea());
item.setAreaCode(w.getAreaCode());
item.setCreateOn(w.getCreateOn());
item.setDeclaredAmount(w.getDeclareAmount());
item.setStage(w.getStage());
@@ -188,6 +191,9 @@ public class ProjectLibManage {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
item.setProjectName(w.getProjectName());
item.setProjectCode(w.getProjectCode());
item.setArea(w.getArea());
item.setAreaCode(w.getAreaCode());
item.setCreateOn(w.getCreateOn());
item.setDeclaredAmount(w.getDeclareAmount());
item.setStage(w.getStage());
@@ -234,6 +240,238 @@ public class ProjectLibManage {
}

/**
* @param projectId 项目详情
* @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO
* @author ZPF
* @since 2023/02/11 11:15
*/
public ProjectDetailVO getProjectDetail(Long projectId) {
// 查询最新的项目申报信息
Project projectInfo = projectService.getNewProject(projectId);
if (Objects.isNull(projectInfo)) {
return null;
}
ProjectDetailVO vo = new ProjectDetailVO();
BeanUtils.copyProperties(projectInfo, vo);
vo.buildDynamicForm(projectInfo.getDynamicForm());
// 查询应用
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, vo.getProjectCode())
.eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct())
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion()));

Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps,
ProjectHelper::convertVO)
));

List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectInfo);
//查询采购备案
List<Purchase> purchases = purchaseService.listByProjectId(projectId);
vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class));

//查询合同备案
Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class)
.in(Contract::getProjectId, allVersionProjectId)
.last(BizConst.LIMIT_1));
ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class);
vo.setContract(contractVO);
List<PaymentPlan> payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class)
.in(PaymentPlan::getProjectId, allVersionProjectId)
.orderByAsc(PaymentPlan::getPaymentTime));
if (Objects.nonNull(contractVO)) {
contractVO.setPayments(convertPayments(payments,
contractVO.getTotalAmount()));
}

//查询实施信息
Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class)
.in(Operation::getProjectId, allVersionProjectId)
.orderByAsc(Operation::getCreateOn)
.last(BizConst.LIMIT_1));
vo.setOperation(BeanUtil.copyProperties(operation, OperationVO.class));

SafetyMonitorVO safetyVo = new SafetyMonitorVO();
//查询风险监测
List<SupplierSafetyQualification> ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class)
.eq(SupplierSafetyQualification::getProjectCode, projectInfo.getProjectCode()));
if(CollUtil.isNotEmpty(ssq)){
safetyVo.setSupplierSafetyQualification(ssq.stream()
.map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class))
.collect(Collectors.toList()));
}
vo.setSafetyInfo(safetyVo);

List<PersonSafetyInfo> psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class)
.eq(PersonSafetyInfo::getProjectCode, projectInfo.getProjectCode()));
if(CollUtil.isNotEmpty(psi)){
safetyVo.setPersonSafetyInfo(psi.stream()
.map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class))
.collect(Collectors.toList()));
}

//查询初验信息
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class)
.in(PreInsAcceptancePerson::getProjectId, allVersionProjectId)
.orderByAsc(PreInsAcceptancePerson::getCreateOn));
vo.setAcceptancePersons(convertPersons(acceptancePersons));

//查询终验信息
//查询年度投资金额 要是已验收的项目
if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) {
List<AnnualAmountVO> annualAmounts = Lists.newArrayList();
annualAmounts.add(AnnualAmountVO.builder()
.projectId(projectInfo.getId())
.projectYear(projectInfo.getProjectYear())
.annualAmount(projectInfo.getAnnualPlanAmount())
.build());
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId())
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
Optional.ofNullable(renewalDeclarations).ifPresent(declarations ->
declarations.forEach(declaration -> {
annualAmounts.add(AnnualAmountVO.builder()
.projectId(projectInfo.getId())
.projectYear(declaration.getProjectYear())
.annualAmount(declaration.getAnnualPaymentAmount())
.build());
})
);
vo.setAnnualAccumulateAmountList(annualAmounts);
}
// 处理文件名
List<Long> fileIdList = new ArrayList<>();
BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w)));
BizUtils.notBlank(vo.getApprovedConstructionPlanFile(), w -> fileIdList.add(Long.parseLong(w)));
if (!fileIdList.isEmpty()) {
List<File> files = fileService.listByIds(fileIdList);
Map<String, String> fileMap = CollUtils.listToMap(files, w -> w.getId().toString(), File::getOriginalFileName);
vo.setApprovedFileName(fileMap.get(vo.getApprovedFile()));
vo.setApprovedConstructionPlanFileName(fileMap.get(vo.getApprovedConstructionPlanFile()));
}
return vo;
}

/**
* @param projectId 项目详情 不查询最新版本
* @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO
* @author ZPF
* @since 2023/02/11 11:15
*/
public ProjectDetailVO getProjectDetailThisVersion(Long projectId) {
// 查询最新的项目申报信息
Project projectInfo = projectService.getById(projectId);
if (Objects.isNull(projectInfo)) {
return null;
}
ProjectDetailVO vo = new ProjectDetailVO();
BeanUtils.copyProperties(projectInfo, vo);
vo.buildDynamicForm(projectInfo.getDynamicForm());
// 查询应用
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, vo.getProjectCode())
.eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct())
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion()));

Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps,
ProjectHelper::convertVO)
));

//审批信息
ProcessDetailReq req = new ProcessDetailReq();
req.setInstanceId(projectInfo.getInstCode());
req.setProjectId(projectId);
vo.setProcess(todoService.getProcessDetail(req));

List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectInfo);
//查询采购备案
List<Purchase> purchases = purchaseService.listByProjectId(projectId);
vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class));

//查询合同备案
Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class)
.in(Contract::getProjectId, allVersionProjectId)
.last(BizConst.LIMIT_1));
ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class);
vo.setContract(contractVO);
List<PaymentPlan> payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class)
.in(PaymentPlan::getProjectId, allVersionProjectId)
.orderByAsc(PaymentPlan::getPaymentTime));
if (Objects.nonNull(contractVO)) {
contractVO.setPayments(convertPayments(payments,
contractVO.getTotalAmount()));
}

//查询实施信息
Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class)
.in(Operation::getProjectId, allVersionProjectId)
.orderByAsc(Operation::getCreateOn)
.last(BizConst.LIMIT_1));
vo.setOperation(BeanUtil.copyProperties(operation, OperationVO.class));

SafetyMonitorVO safetyVo = new SafetyMonitorVO();
//查询风险监测
List<SupplierSafetyQualification> ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class)
.eq(SupplierSafetyQualification::getProjectCode, projectInfo.getProjectCode()));
if(CollUtil.isNotEmpty(ssq)){
safetyVo.setSupplierSafetyQualification(ssq.stream()
.map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class))
.collect(Collectors.toList()));
}
vo.setSafetyInfo(safetyVo);

List<PersonSafetyInfo> psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class)
.eq(PersonSafetyInfo::getProjectCode, projectInfo.getProjectCode()));
if(CollUtil.isNotEmpty(psi)){
safetyVo.setPersonSafetyInfo(psi.stream()
.map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class))
.collect(Collectors.toList()));
}

//查询初验信息
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class)
.in(PreInsAcceptancePerson::getProjectId, allVersionProjectId)
.orderByAsc(PreInsAcceptancePerson::getCreateOn));
vo.setAcceptancePersons(convertPersons(acceptancePersons));

//查询终验信息
//查询年度投资金额 要是已验收的项目
if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) {
List<AnnualAmountVO> annualAmounts = Lists.newArrayList();
annualAmounts.add(AnnualAmountVO.builder()
.projectId(projectInfo.getId())
.projectYear(projectInfo.getProjectYear())
.annualAmount(projectInfo.getAnnualPlanAmount())
.build());
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId())
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
Optional.ofNullable(renewalDeclarations).ifPresent(declarations ->
declarations.forEach(declaration -> {
annualAmounts.add(AnnualAmountVO.builder()
.projectId(projectInfo.getId())
.projectYear(declaration.getProjectYear())
.annualAmount(declaration.getAnnualPaymentAmount())
.build());
})
);
vo.setAnnualAccumulateAmountList(annualAmounts);
}
// 处理文件名
List<Long> fileIdList = new ArrayList<>();
BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w)));
BizUtils.notBlank(vo.getApprovedConstructionPlanFile(), w -> fileIdList.add(Long.parseLong(w)));
if (!fileIdList.isEmpty()) {
List<File> files = fileService.listByIds(fileIdList);
Map<String, String> fileMap = CollUtils.listToMap(files, w -> w.getId().toString(), File::getOriginalFileName);
vo.setApprovedFileName(fileMap.get(vo.getApprovedFile()));
vo.setApprovedConstructionPlanFileName(fileMap.get(vo.getApprovedConstructionPlanFile()));
}
return vo;
}

/**
* 申报新项目时 保存项目信息和其它相关联的信息
*
* @param projectDto
@@ -310,7 +548,9 @@ public class ProjectLibManage {
project.setSponsor(employeeCode);
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto);
project.setProjectCode(projectCode);
projectService.save(project);
if(projectService.save(project)){
saveApplication(projectDto,project,null);
}
} else {
//否则是重新提交的 新生成一个新版本的项目
project = newProjectWithVersion(projectDto);
@@ -320,30 +560,6 @@ public class ProjectLibManage {
projectService.updateById(project);
}
}

//保存项目应用
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication())
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式
Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1;
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, version));
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
ProjectApplication projectApplication = new ProjectApplication();
BeanUtils.copyProperties(application, projectApplication);
projectApplication.setId(null);
projectApplication.setProjectId(finalProject.getId());
projectApplication.setProjectCode(finalProject.getProjectCode());
projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode());
projectApplication.setBuildOrgName(finalProject.getBuildOrgName());
projectApplication.setProjectVersion(version);
return projectApplication;
}).collect(Collectors.toList());
projectApplicationService.saveOrUpdateBatch(applications);
}
return project;
} catch (Exception e) {
log.error("项目信息入库错误 " + e);
@@ -381,6 +597,7 @@ public class ProjectLibManage {
project.setVersion(oldProject.getVersion() + 1);
// 标记为建设方案申报
project.setIsConstruct(Boolean.TRUE);
project.setIsBackReject(Boolean.FALSE);
// 保存初步方案项目ID
if (Boolean.TRUE.equals(oldProject.getIsConstruct())) {
// 重新提交
@@ -388,13 +605,16 @@ public class ProjectLibManage {
} else {
project.setPrePlanProjectId(oldProject.getId());
}
projectService.save(project);
if(projectService.save(project)){
saveApplication(projectDto,project,null);

// 将旧的项目版本置为不是最新
projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
}

// 将旧的项目版本置为不是最新
projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
} else {
//否则是被驳回,重新提交的 新生成一个新版本的项目
project = newProjectWithVersion(projectDto);
@@ -404,49 +624,6 @@ public class ProjectLibManage {
projectService.updateById(project);
}
}

//保存项目应用
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication())
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息及关联的核心业务
List<ProjectApplication> applications = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, project.getVersion())
.eq(ProjectApplication::getIsConstruct, Boolean.TRUE));
if (CollUtil.isNotEmpty(applications)) {
projectApplicationService.removeBatchByIds(applications);
List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList());
projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.in(ProjectCoreBusinessIndicators::getApplicationId,applicationIds));
}

if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
List<ProjectApplicationDTO> applicationList = projectDto.getApplicationList();
for (ProjectApplicationDTO application : applicationList) {
ProjectApplication projectApplication = new ProjectApplication();
BeanUtils.copyProperties(application, projectApplication);
projectApplication.setId(null);
projectApplication.setProjectId(finalProject.getId());
projectApplication.setProjectCode(finalProject.getProjectCode());
projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode());
projectApplication.setBuildOrgName(finalProject.getBuildOrgName());
projectApplication.setIsConstruct(Boolean.TRUE);
projectApplication.setProjectVersion(finalProject.getVersion());
boolean result = projectApplicationService.save(projectApplication);
// 保存应用关联的核心业务
List<ProjectCoreBusinessDTO> coreBusinessList = application.getCoreBusinessList();
Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE;
if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){
for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) {
ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators();
BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators);
projectCoreBusinessIndicators.setApplicationId(application.getId());
projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators);
}
}
}
}
return project;
} catch (Exception e) {
log.error("项目信息入库错误 " + e);
@@ -464,29 +641,7 @@ public class ProjectLibManage {
public Project reSaveProjectNewVersion(ProjectDTO projectDto) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try {
Project project = newProjectWithVersion(projectDto);

//保存项目应用
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication())
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, project.getVersion()));
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
ProjectApplication projectApplication = new ProjectApplication();
BeanUtils.copyProperties(application, projectApplication);
projectApplication.setId(null);
projectApplication.setProjectId(finalProject.getId());
projectApplication.setProjectCode(finalProject.getProjectCode());
projectApplication.setProjectVersion(finalProject.getVersion());
return projectApplication;
}).collect(Collectors.toList());
projectApplicationService.saveOrUpdateBatch(applications);
}
return project;
return newProjectWithVersion(projectDto);
} catch (Exception e) {
log.error("项目信息入库错误 " + e);
throw new BusinessException("项目信息入库错误 :" + e);
@@ -510,14 +665,20 @@ public class ProjectLibManage {
project.setId(null);
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());
project.setIsBackReject(Boolean.FALSE);
stateMachineUtils.pass(project);
projectService.save(project);

oldProject.setIsBackReject(Boolean.TRUE);
projectService.updateById(oldProject);

projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

saveApplication(projecDto,project,null);

return project;
}

@@ -534,6 +695,8 @@ public class ProjectLibManage {
project.setId(null);
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());
//都是在驳回 重新提交时用的
project.setIsBackReject(Boolean.FALSE);
if (Objects.nonNull(stageCode)) {
project.setStage(stageCode);
}
@@ -541,47 +704,23 @@ public class ProjectLibManage {
project.setStatus(statusCode);
}

oldProject.setIsBackReject(Boolean.TRUE);
projectService.updateById(oldProject);

if (projectService.save(project)) {
projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

//删除当前版本的app 一般情况是没有 保险起见
List<ProjectApplication> applications = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, project.getVersion()));
if (CollUtil.isNotEmpty(applications)) {
projectApplicationService.removeBatchByIds(applications);
List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList());
projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds));
}

//app
List<ProjectApplicationDTO> applicationList = projecDto.getApplicationList();
if (CollUtil.isNotEmpty(applicationList)) {
List<ProjectApplication> apps = applicationList.stream()
.map(a -> {
ProjectApplication app = BeanUtil.copyProperties(a, ProjectApplication.class);
app.setId(null);
app.setProjectId(project.getId());
app.setProjectCode(project.getProjectCode());
app.setBuildOrgName(project.getBuildOrgName());
app.setBuildOrgCode(project.getBuildOrgCode());
app.setIsConstruct(isConstruct);
app.setProjectVersion(project.getVersion());
return app;
})
.collect(Collectors.toList());
projectApplicationService.saveBatch(apps);
}
saveApplication(projecDto,project,isConstruct);
}

return project;
}

public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType) {
public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType,Boolean isConstruct) {
Project oldProject = projectService.getById(projecDto.getId());
Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject))
@@ -612,27 +751,7 @@ public class ProjectLibManage {
.eq(Project::getProjectCode, project.getProjectCode()));

//app
//采取批量删除 批量添加的方式
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, project.getVersion()));

List<ProjectApplicationDTO> applicationList = projecDto.getApplicationList();
if (CollUtil.isNotEmpty(applicationList)) {
List<ProjectApplication> apps = applicationList.stream()
.map(a -> {
ProjectApplication app = BeanUtil.copyProperties(a, ProjectApplication.class);
app.setId(null);
app.setProjectId(project.getId());
app.setProjectCode(project.getProjectCode());
app.setBuildOrgName(project.getBuildOrgName());
app.setBuildOrgCode(project.getBuildOrgCode());
app.setProjectVersion(project.getVersion());
return app;
})
.collect(Collectors.toList());
projectApplicationService.saveBatch(apps);
}
saveApplication(projecDto,project,isConstruct);
}

return project;
@@ -665,23 +784,13 @@ public class ProjectLibManage {
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

List<ProjectApplication> apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId, oldProject.getId()));
if(CollUtil.isNotEmpty(apps)){
apps = apps.stream().map(app -> {
app.setProjectVersion(project.getVersion());
app.setProjectId(project.getId());
app.setId(null);
return app;
}).collect(Collectors.toList());
projectApplicationService.saveBatch(apps);
}
saveApplication(project,oldProject,null);
}

return project;
}

public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId, Integer instType) {
public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId, Integer instType,Boolean isBackReject) {
Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject))
.throwMessage("项目不存在!");
@@ -693,9 +802,13 @@ public class ProjectLibManage {
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());
// 标识保存的项目信息是否为建设方案申报项目
project.setIsConstruct(Boolean.TRUE);
project.setIsConstruct(Boolean.FALSE);
project.setIsBackReject(isBackReject);
stateMachineUtils.pass(project);

oldProject.setIsBackReject(Boolean.TRUE);
projectService.updateById(oldProject);

if (projectService.save(project)) {
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
@@ -710,6 +823,9 @@ public class ProjectLibManage {
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

//APP
saveApplication(project,oldProject,null);
}

return project;
@@ -727,9 +843,12 @@ public class ProjectLibManage {
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());
// 标识保存的项目信息是否为建设方案申报项目
project.setIsConstruct(Boolean.TRUE);
project.setIsConstruct(Boolean.FALSE);
stateMachineUtils.pass(project);

oldProject.setIsBackReject(Boolean.TRUE);
projectService.updateById(oldProject);

if (projectService.save(project)) {
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
@@ -744,241 +863,11 @@ public class ProjectLibManage {
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
}

return project;
}

/**
* @param projectId 项目详情
* @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO
* @author ZPF
* @since 2023/02/11 11:15
*/
public ProjectDetailVO getProjectDetail(Long projectId) {
// 查询最新的项目申报信息
Project projectInfo = projectService.getNewProject(projectId);
if (Objects.isNull(projectInfo)) {
return null;
}
ProjectDetailVO vo = new ProjectDetailVO();
BeanUtils.copyProperties(projectInfo, vo);
vo.buildDynamicForm(projectInfo.getDynamicForm());
// 查询应用
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, vo.getProjectCode())
.eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct())
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion()));

Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps,
ProjectHelper::convertVO)
));

List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectInfo);
//查询采购备案
List<Purchase> purchases = purchaseService.listByProjectId(projectId);
vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class));

//查询合同备案
Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class)
.in(Contract::getProjectId, allVersionProjectId)
.last(BizConst.LIMIT_1));
ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class);
vo.setContract(contractVO);
List<PaymentPlan> payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class)
.in(PaymentPlan::getProjectId, allVersionProjectId)
.orderByAsc(PaymentPlan::getPaymentTime));
if (Objects.nonNull(contractVO)) {
contractVO.setPayments(convertPayments(payments,
contractVO.getTotalAmount()));
}

//查询实施信息
Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class)
.in(Operation::getProjectId, allVersionProjectId)
.orderByAsc(Operation::getCreateOn)
.last(BizConst.LIMIT_1));
vo.setOperation(BeanUtil.copyProperties(operation, OperationVO.class));

SafetyMonitorVO safetyVo = new SafetyMonitorVO();
//查询风险监测
List<SupplierSafetyQualification> ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class)
.eq(SupplierSafetyQualification::getProjectCode, projectInfo.getProjectCode()));
if(CollUtil.isNotEmpty(ssq)){
safetyVo.setSupplierSafetyQualification(ssq.stream()
.map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class))
.collect(Collectors.toList()));
}
vo.setSafetyInfo(safetyVo);

List<PersonSafetyInfo> psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class)
.eq(PersonSafetyInfo::getProjectCode, projectInfo.getProjectCode()));
if(CollUtil.isNotEmpty(psi)){
safetyVo.setPersonSafetyInfo(psi.stream()
.map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class))
.collect(Collectors.toList()));
}

//查询初验信息
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class)
.in(PreInsAcceptancePerson::getProjectId, allVersionProjectId)
.orderByAsc(PreInsAcceptancePerson::getCreateOn));
vo.setAcceptancePersons(convertPersons(acceptancePersons));

//查询终验信息
//查询年度投资金额 要是已验收的项目
if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) {
List<AnnualAmountVO> annualAmounts = Lists.newArrayList();
annualAmounts.add(AnnualAmountVO.builder()
.projectId(projectInfo.getId())
.projectYear(projectInfo.getProjectYear())
.annualAmount(projectInfo.getAnnualPlanAmount())
.build());
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId())
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
Optional.ofNullable(renewalDeclarations).ifPresent(declarations ->
declarations.forEach(declaration -> {
annualAmounts.add(AnnualAmountVO.builder()
.projectId(projectInfo.getId())
.projectYear(declaration.getProjectYear())
.annualAmount(declaration.getAnnualPaymentAmount())
.build());
})
);
vo.setAnnualAccumulateAmountList(annualAmounts);
}
// 处理文件名
List<Long> fileIdList = new ArrayList<>();
BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w)));
BizUtils.notBlank(vo.getApprovedConstructionPlanFile(), w -> fileIdList.add(Long.parseLong(w)));
if (!fileIdList.isEmpty()) {
List<File> files = fileService.listByIds(fileIdList);
Map<String, String> fileMap = CollUtils.listToMap(files, w -> w.getId().toString(), File::getOriginalFileName);
vo.setApprovedFileName(fileMap.get(vo.getApprovedFile()));
vo.setApprovedConstructionPlanFileName(fileMap.get(vo.getApprovedConstructionPlanFile()));
}
return vo;
}

/**
* @param projectId 项目详情 不查询最新版本
* @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO
* @author ZPF
* @since 2023/02/11 11:15
*/
public ProjectDetailVO getProjectDetailThisVersion(Long projectId) {
// 查询最新的项目申报信息
Project projectInfo = projectService.getById(projectId);
if (Objects.isNull(projectInfo)) {
return null;
}
ProjectDetailVO vo = new ProjectDetailVO();
BeanUtils.copyProperties(projectInfo, vo);
vo.buildDynamicForm(projectInfo.getDynamicForm());
// 查询应用
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, vo.getProjectCode())
.eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct())
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion()));

Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps,
ProjectHelper::convertVO)
));

//审批信息
ProcessDetailReq req = new ProcessDetailReq();
req.setInstanceId(projectInfo.getInstCode());
req.setProjectId(projectId);
vo.setProcess(todoService.getProcessDetail(req));

List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectInfo);
//查询采购备案
List<Purchase> purchases = purchaseService.listByProjectId(projectId);
vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class));

//查询合同备案
Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class)
.in(Contract::getProjectId, allVersionProjectId)
.last(BizConst.LIMIT_1));
ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class);
vo.setContract(contractVO);
List<PaymentPlan> payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class)
.in(PaymentPlan::getProjectId, allVersionProjectId)
.orderByAsc(PaymentPlan::getPaymentTime));
if (Objects.nonNull(contractVO)) {
contractVO.setPayments(convertPayments(payments,
contractVO.getTotalAmount()));
saveApplication(project,oldProject,Boolean.TRUE);
}

//查询实施信息
Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class)
.in(Operation::getProjectId, allVersionProjectId)
.orderByAsc(Operation::getCreateOn)
.last(BizConst.LIMIT_1));
vo.setOperation(BeanUtil.copyProperties(operation, OperationVO.class));

SafetyMonitorVO safetyVo = new SafetyMonitorVO();
//查询风险监测
List<SupplierSafetyQualification> ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class)
.eq(SupplierSafetyQualification::getProjectCode, projectInfo.getProjectCode()));
if(CollUtil.isNotEmpty(ssq)){
safetyVo.setSupplierSafetyQualification(ssq.stream()
.map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class))
.collect(Collectors.toList()));
}
vo.setSafetyInfo(safetyVo);

List<PersonSafetyInfo> psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class)
.eq(PersonSafetyInfo::getProjectCode, projectInfo.getProjectCode()));
if(CollUtil.isNotEmpty(psi)){
safetyVo.setPersonSafetyInfo(psi.stream()
.map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class))
.collect(Collectors.toList()));
}

//查询初验信息
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class)
.in(PreInsAcceptancePerson::getProjectId, allVersionProjectId)
.orderByAsc(PreInsAcceptancePerson::getCreateOn));
vo.setAcceptancePersons(convertPersons(acceptancePersons));

//查询终验信息
//查询年度投资金额 要是已验收的项目
if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) {
List<AnnualAmountVO> annualAmounts = Lists.newArrayList();
annualAmounts.add(AnnualAmountVO.builder()
.projectId(projectInfo.getId())
.projectYear(projectInfo.getProjectYear())
.annualAmount(projectInfo.getAnnualPlanAmount())
.build());
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId())
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
Optional.ofNullable(renewalDeclarations).ifPresent(declarations ->
declarations.forEach(declaration -> {
annualAmounts.add(AnnualAmountVO.builder()
.projectId(projectInfo.getId())
.projectYear(declaration.getProjectYear())
.annualAmount(declaration.getAnnualPaymentAmount())
.build());
})
);
vo.setAnnualAccumulateAmountList(annualAmounts);
}
// 处理文件名
List<Long> fileIdList = new ArrayList<>();
BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w)));
BizUtils.notBlank(vo.getApprovedConstructionPlanFile(), w -> fileIdList.add(Long.parseLong(w)));
if (!fileIdList.isEmpty()) {
List<File> files = fileService.listByIds(fileIdList);
Map<String, String> fileMap = CollUtils.listToMap(files, w -> w.getId().toString(), File::getOriginalFileName);
vo.setApprovedFileName(fileMap.get(vo.getApprovedFile()));
vo.setApprovedConstructionPlanFileName(fileMap.get(vo.getApprovedConstructionPlanFile()));
}
return vo;
return project;
}

/**
@@ -1246,8 +1135,11 @@ public class ProjectLibManage {
return res;
}

//只查 当前版本 和历史被驳回|退回的版本
List<Project> historyProjects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, project.getProjectCode())
.and(q1->q1.eq(Project::getNewest, Boolean.TRUE)
.or(q2->q2.eq(Project::getIsBackReject,Boolean.TRUE)))
.orderByDesc(Project::getCreateOn));

if (CollUtil.isEmpty(historyProjects)) {
@@ -1308,4 +1200,72 @@ public class ProjectLibManage {
res.put(ProjectConstant.ProjectLib.PROCESS_KEY, todoService.getProcessDetail(req));
return res;
}

private void saveApplication(Project project,Project oldProject,Boolean isConstruct) {
List<ProjectApplication> apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, oldProject.getProjectCode())
.eq(ProjectApplication::getProjectVersion, oldProject.getVersion()));
if(CollUtil.isNotEmpty(apps)){
apps = apps.stream().map(app -> {
app.setProjectVersion(project.getVersion());
app.setProjectId(project.getId());
app.setId(null);
if(Objects.nonNull(isConstruct)){
app.setIsConstruct(isConstruct);
}
return app;
}).collect(Collectors.toList());
projectApplicationService.saveBatch(apps);
}
}

private void saveApplication(ProjectDTO projectDto,Project project,Boolean isConstruct) {
//保存项目应用
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication())
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式
Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1;
//删除当前版本的app 一般情况是没有 保险起见
List<ProjectApplication> applications = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, version));
if (CollUtil.isNotEmpty(applications)) {
projectApplicationService.removeBatchByIds(applications);
List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList());
projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds));
}

if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
projectDto.getApplicationList().forEach(application -> {
ProjectApplication projectApplication = new ProjectApplication();
BeanUtils.copyProperties(application, projectApplication);
projectApplication.setId(null);
projectApplication.setProjectId(finalProject.getId());
projectApplication.setProjectCode(finalProject.getProjectCode());
projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode());
projectApplication.setBuildOrgName(finalProject.getBuildOrgName());
projectApplication.setProjectVersion(version);
projectApplication.setIsConstruct(isConstruct);

if(StringUtils.isNotBlank(application.getRelatedExistsApplication())){
projectApplication.setApplicationName(null);
}

boolean result = projectApplicationService.save(projectApplication);
// 保存应用关联的核心业务
List<ProjectCoreBusinessDTO> coreBusinessList = application.getCoreBusinessList();
Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE;
if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){
for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) {
ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators();
BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators);
projectCoreBusinessIndicators.setApplicationId(application.getId());
projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators);
}
}
});
}
}
}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java Vedi File

@@ -317,4 +317,7 @@ public class ProjectDTO implements Serializable {

@ApiModelProperty("项目类型 01首次建设;02迭代升级;03结转建设;04新运维;05续运维")
private String baseProjType;

@ApiModelProperty("是否退回|驳回的项目版本")
private Boolean isBackReject = Boolean.FALSE;
}

+ 16
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java Vedi File

@@ -325,6 +325,10 @@ public class Project implements Serializable {
@Compare("建设周期(月)")
private String buildCycle;

@ApiModelProperty("原始建设周期(月)")
@Compare("建设周期(月)")
private Integer originBuildCycle;

@ApiModelProperty("建设方案文件")
@Compare("建设方案文件")
private String constructionPlanFile;
@@ -453,10 +457,17 @@ public class Project implements Serializable {
@Compare("合同总金额")
private BigDecimal contractAmount;

@ApiModelProperty("计划验收时间")
@ApiModelProperty("计划验收时间(有可能是延期后的)")
@Compare("计划验收时间")
private LocalDateTime planAcceptanceTime;

@ApiModelProperty("原本计划验收时间")
@Compare("原本计划验收时间")
private LocalDateTime originPlanAcceptanceTime;

@ApiModelProperty("延期月份数")
private Integer applyDelayMonths;

@ApiModelProperty("申请延期佐证材料")
private String applyDelayFile;

@@ -483,4 +494,8 @@ public class Project implements Serializable {

@ApiModelProperty("区县预审本级主管单位盖章审核日期")
private String countrySealAuditDate;

@ApiModelProperty("是否退回|驳回的项目版本")
private Boolean isBackReject;

}

+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java Vedi File

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.compare.Compare;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.portrait.model.vo.TagVO;
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract;
@@ -405,6 +406,20 @@ public class ProjectDetailVO {
@ApiModelProperty("标签")
private List<TagVO> tags;

@ApiModelProperty("是否退回|驳回的项目版本")
private Boolean isBackReject;

@ApiModelProperty("原本计划验收时间")
@Compare("原本计划验收时间")
private LocalDateTime originPlanAcceptanceTime;

@ApiModelProperty("延期月份数")
private Integer applyDelayMonths;

@ApiModelProperty("原始建设周期(月)")
@Compare("建设周期(月)")
private Integer originBuildCycle;

public String getVersionStr() {
if (Objects.nonNull(this.newest) && this.newest) {
this.versionStr = "当前版本";


+ 9
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java Vedi File

@@ -41,6 +41,15 @@ public class ProjectLibListItemVO {
@ApiModelProperty("项目ID")
private Long id;

@ApiModelProperty("项目编号")
private String projectCode;

@ApiModelProperty("区域")
private String area;

@ApiModelProperty("区域Code")
private String areaCode;

@ApiModelProperty("项目名称")
private String projectName;

@@ -129,9 +138,6 @@ public class ProjectLibListItemVO {
@ApiModelProperty("能否被预审申报")
private Boolean canPreDeclared = Boolean.FALSE;

@ApiModelProperty("21位项目编号")
private String projectCode;

@ApiModelProperty("是否有上级条线主管部门 0没有 1有")
private Integer isHigherSuperOrg;



+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/ProjectStatusFlowUtil.java Vedi File

@@ -31,6 +31,7 @@ public class ProjectStatusFlowUtil {
* value: lambda表达式,最终会获取发起实例的函数
*/
public ProjectStatusFlowUtil(){
intervalTimeMap.put(0,60);
intervalTimeMap.put(1,60 * 2);
intervalTimeMap.put(2,60 * 6);
intervalTimeMap.put(3,60 * 15);


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java Vedi File

@@ -259,6 +259,9 @@ public class HandlerManage {
declaredProject.setInstCode(instanceId);
declaredProject.setApplyDelayFile(delayApply.getDelayApplyFile());
declaredProject.setApplyDelayReason(delayApply.getDelayApplyReason());
//增加总延期的月份
declaredProject.setApplyDelayMonths(Objects.nonNull(declaredProject.getApplyDelayMonths()) ?
declaredProject.getApplyDelayMonths() + delayApply.getDelayTime() : delayApply.getDelayTime());
projectService.updateById(declaredProject);
}



+ 4
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Vedi File

@@ -1097,12 +1097,15 @@ public class TodoCenterManage {
project.setUpdateOn(LocalDateTime.now());
projectService.save(project);

oldProject.setIsBackReject(Boolean.TRUE);
projectService.updateById(oldProject);

ProjectInst oldInst = projectInstService.getOne(Wrappers.lambdaUpdate(ProjectInst.class)
.eq(ProjectInst::getProjectId, oldProject.getId())
.eq(ProjectInst::getInstCode, oldProject.getInstCode()));

String instCode = oldProject.getInstCode();
oldInst.setInstCode("EMPTY");
oldInst.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE);
projectInstService.updateById(oldInst);

ProjectInst newPi = new ProjectInst();


+ 5
- 0
pmapi/src/main/resources/application-dev.yml Vedi File

@@ -206,6 +206,11 @@ provincial:
#天印服务器接口信息
irs:
is-search-app: false
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interface-name: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform:
project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a


+ 5
- 0
pmapi/src/main/resources/application-pre.yml Vedi File

@@ -209,6 +209,11 @@ provincial:
#天印服务器接口信息
irs:
is-search-app: true
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interfaceName: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform:
project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a


+ 5
- 0
pmapi/src/main/resources/application-prod.yml Vedi File

@@ -209,6 +209,11 @@ provincial:
#天印服务器接口信息
irs:
is-search-app: true
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interfaceName: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform:
project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a


+ 21
- 66
pmapi/src/main/resources/template/meeting/专家评审单.ftl Vedi File

@@ -553,21 +553,36 @@
<w:sz w:val="30"/>
<w:sz-cs w:val="30"/>
</w:rPr>
<w:t>${meetingTime},${holdOrg}组织专家在${meetingAddress}对${projectName}进行评审。专家组认真听取了项目业主方、建设方的情况汇报,审阅了项目材料,实地查看了设备及平台演示,专家组织质询、讨论后提出以下意见:
<w:t>${meetingTime},${holdOrg}组织专家在${meetingAddress}对${projectName}
进行评审。专家组认真听取了项目业主方、建设方的情况汇报,审阅了项目材料,实地查看了设备及平台演示,专家组织质询、讨论后提出以下意见:
</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="244" w:line-rule="auto"/>
<w:spacing w:line="257" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="244" w:line-rule="auto"/>
<w:ind w:first-line="500" w:first-line-chars="0"/>
<w:rPr>
<w:rFonts w:ascii="微软雅黑" w:h-ansi="微软雅黑" w:fareast="微软雅黑" w:cs="微软雅黑"
w:hint="fareast"/>
<w:sz w:val="30"/>
<w:sz-cs w:val="30"/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:ascii="微软雅黑" w:h-ansi="微软雅黑" w:fareast="微软雅黑" w:cs="微软雅黑"
w:hint="fareast"/>
<w:sz w:val="30"/>
<w:sz-cs w:val="30"/>
</w:rPr>
<w:t>${(reviewResult)!}</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
@@ -644,73 +659,13 @@
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="245" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="245" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="245" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="245" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="245" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="245" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="245" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="245" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="245" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="245" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="245" w:line-rule="auto"/>
<w:spacing w:line="244" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="a2"/>
<w:spacing w:line="245" w:line-rule="auto"/>
<w:spacing w:line="244" w:line-rule="auto"/>
</w:pPr>
</w:p>
<w:p>


+ 42
- 0
pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java Vedi File

@@ -4,12 +4,14 @@ import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.wflow.workflow.bean.dto.TodoCenterListReqDTO;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.history.HistoricActivityInstance;
@@ -29,6 +31,7 @@ import java.util.stream.Collectors;
* @Date 2023/2/16 14:44
* @Author PoffyZhang
*/
@Slf4j
public class InstanceTest extends AppTests {

@Autowired
@@ -145,4 +148,43 @@ public class InstanceTest extends AppTests {
}
}

@Test
public void test4(){
String nodeId = "node_64d1bc4694fc85e4dd1f1b36";

List<HistoricActivityInstance> hais = historyService.createHistoricActivityInstanceQuery()
.activityId(nodeId)
.unfinished()
.orderByHistoricActivityInstanceStartTime()
.asc()
.list();

log.info("hais :{}",JSON.toJSONString(hais));

if (CollUtil.isEmpty(hais)) {
log.info("没有查到 历史实例");
return;
}

String instanceId = hais.get(0).getProcessInstanceId();
log.info("instanceId :{}",instanceId);

//查询当前未完成的此实例
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(instanceId)
.unfinished()
.singleResult();

log.info("instance :{}",JSON.toJSONString(instance));
if (Objects.isNull(instance)) {
log.info("没有查到实例 或者 实例已经结束");
return;
}

//2.查到 此流程实例的 项目
ProjectInst pi = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getInstCode, instanceId)
.last(BizConst.LIMIT_1));
log.info("pi :{}",JSON.toJSONString(pi));
}
}

+ 17
- 10
pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java Vedi File

@@ -7,6 +7,7 @@ import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.HmacAuthUtil;
import com.ningdatech.pmapi.common.util.RefreshKeyUtil;
import com.ningdatech.pmapi.irs.manage.AppIrsManage;
import com.ningdatech.zwdd.ZwddIntegrationProperties;
import com.ningdatech.zwdd.client.ZwddAuthClient;
import com.ningdatech.zwdd.client.ZwddClient;
@@ -20,12 +21,14 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.Map;
import java.util.Objects;

/**
* @Classname IrsTest
@@ -40,12 +43,14 @@ public class IrsTest extends AppTests {

@Autowired
private ZwddClient zwddClient;
@Autowired
private AppIrsManage appIrsManage;

@Test
public void test1(){
public void test1() {
String method = "GET";
String url = "https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl" +
"?appCode=A331123467587202307014177";
"?appCode=A331101453557202109017383";
String appScret = "BCDSGS_4ab4235d26a9a357170a39f3a13fd68c";
String appKey = "BCDSGA_d874c8e46b541eb4e8aac6510fd3351b";

@@ -53,14 +58,14 @@ public class IrsTest extends AppTests {
//请求头
HttpHeaders headers = new HttpHeaders();

for(Map.Entry<String, String> entry : header.entrySet()){
for (Map.Entry<String, String> entry : header.entrySet()) {
headers.add(entry.getKey(), entry.getValue());
}
//封装请求头
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers);

RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.exchange(url, HttpMethod.GET,formEntity, String.class);
ResponseEntity<String> forEntity = restTemplate.exchange(url, HttpMethod.GET, formEntity, String.class);

System.out.println(JSON.toJSONString(forEntity));
}
@@ -100,7 +105,7 @@ public class IrsTest extends AppTests {
String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp);
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm?requestTime=" + timestamp +
"&sign=" + sign + "&appKey=" + appKey + "&capCode=" + capCode + "&capTime=" + capTime +
"&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId +
"&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId +
"&isEffective=1&baseProjSysCode=" + baseProjSysCode;
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
@@ -116,7 +121,7 @@ public class IrsTest extends AppTests {
}

@Test
public void test4(){
public void test4() {
CloseableHttpResponse response = null;
try {
String api = "/media/download";
@@ -147,7 +152,7 @@ public class IrsTest extends AppTests {
fos.close();
} catch (Exception e) {
System.out.println(e);
}finally {
} finally {
if (response != null) {
try {
//特别提醒:需要调用response的close方法关闭网络连接!!!
@@ -160,7 +165,7 @@ public class IrsTest extends AppTests {
}

@Test
public void test5(){
public void test5() {
CloseableHttpResponse response = null;
try {
String api = "/media/download";
@@ -191,7 +196,7 @@ public class IrsTest extends AppTests {
fos.close();
} catch (Exception e) {
System.out.println(e);
}finally {
} finally {
if (response != null) {
try {
//特别提醒:需要调用response的close方法关闭网络连接!!!
@@ -206,6 +211,7 @@ public class IrsTest extends AppTests {
private static ExecutableClient zwddExecutableClient;
@Autowired
private ZwddIntegrationProperties zwddProperties;

public ExecutableClient getZwddExecutableClient() {
if (Objects.isNull(zwddExecutableClient)) {
synchronized (ZwddAuthClientProvider.class) {
@@ -224,4 +230,5 @@ public class IrsTest extends AppTests {
}
return zwddExecutableClient;
}

}

+ 26
- 0
pmapi/src/test/java/com/ningdatech/pmapi/password/PasswordTest.java Vedi File

@@ -0,0 +1,26 @@
package com.ningdatech.pmapi.password;

import org.junit.Test;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
* @Classname PasswordTest
* @Description
* @Date 2023/8/2 17:39
* @Author PoffyZhang
*/
public class PasswordTest {

@Test
public void password(){
String mingwen = "ELgaCeHteZA8VJK8";

String miwen = "$2a$10$MT82RbInrIkRVL/GRS01Vew8AO6ICngOpbAGbdkWgSnYFhog5n8.q";

String encode = new BCryptPasswordEncoder().encode(mingwen);
boolean matches = new BCryptPasswordEncoder().matches(mingwen, encode);
System.out.println(encode);
System.out.println(matches);
}
}

+ 5
- 0
pmapi/src/test/resources/application-dev.yml Vedi File

@@ -206,6 +206,11 @@ provincial:
#天印服务器接口信息
irs:
is-search-app: false
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interfaceName: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform:
project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a


+ 6
- 1
pmapi/src/test/resources/application-pre.yml Vedi File

@@ -145,7 +145,7 @@ flowable:
async-executor-activate: true
#关闭一些不需要的功能服务
rest-api-enabled: false
# database-schema-update: false
# database-schema-update: false
idm:
enabled: false
common:
@@ -209,6 +209,11 @@ provincial:
#天印服务器接口信息
irs:
is-search-app: true
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interfaceName: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform:
project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a


Loading…
Annulla
Salva