Browse Source

Merge branch '20230814_ls2_wps' of http://git.ningdatech.com/liushuai/project-management

tags/24080901
PoffyZhang 1 year ago
parent
commit
4bc8039379
53 changed files with 2170 additions and 53 deletions
  1. +1
    -1
      ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java
  2. BIN
      pmapi/lib/commons-compress-1.19.jar
  3. BIN
      pmapi/lib/commons-io-2.5.jar
  4. BIN
      pmapi/lib/commons-lang-2.6.jar
  5. BIN
      pmapi/lib/commons-lang3-3.8.1.jar
  6. BIN
      pmapi/lib/commons-logging-1.1.1.jar
  7. BIN
      pmapi/lib/ofd-simple-tool-1.0.23.0324.jar
  8. BIN
      pmapi/lib/slf4j-simple-1.7.26.jar
  9. BIN
      pmapi/lib/suwell-bank-extend-1.8.28.0627-sgcc.jar
  10. BIN
      pmapi/lib/suwell-core-base-1.7.220623-lite.jar
  11. BIN
      pmapi/lib/suwell-extend-1.0.22.0804.jar
  12. +110
    -0
      pmapi/pom.xml
  13. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java
  14. +38
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/constant/BizConst.java
  15. +18
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java
  16. +51
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/ReAppraisalController.java
  17. +50
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/VerifyController.java
  18. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java
  19. +42
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppraisalTypeEnum.java
  20. +22
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/TemplateDetailBuildHelper.java
  21. +130
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/impl/TemplateDetailBuildHelperImpl.java
  22. +38
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java
  23. +208
    -22
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java
  24. +59
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java
  25. +333
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/ReAppraisalManage.java
  26. +332
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/VerifyManage.java
  27. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalScoreInfoMapper.java
  28. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalScoreInfoMapper.xml
  29. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java
  30. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java
  31. +42
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalDTO.java
  32. +37
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalInfoDTO.java
  33. +37
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java
  34. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java
  35. +73
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalScoreInfo.java
  36. +3
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java
  37. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectGroupVO.java
  38. +38
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java
  39. +13
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java
  40. +52
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectAppraisalIndexDetailVO.java
  41. +3
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java
  42. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java
  43. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalScoreInfoService.java
  44. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalScoreInfoServiceImpl.java
  45. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/wps/contants/WpsContant.java
  46. +82
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/wps/controller/WpsConvertController.java
  47. +159
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/wps/manage/WpsConvertManage.java
  48. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/wps/service/IConvertService.java
  49. +19
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/wps/service/impl/ConvertService.java
  50. +2
    -0
      pmapi/src/main/resources/security/auth-dev.yml
  51. +2
    -0
      pmapi/src/main/resources/security/auth-pre.yml
  52. +2
    -0
      pmapi/src/main/resources/security/auth-prod.yml
  53. +60
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest4.java

+ 1
- 1
ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java View File

@@ -57,7 +57,7 @@ public class GeneratorCodeKingbaseConfig {


public static void main(String[] args) { public static void main(String[] args) {
//generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); //generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip");
generate("CMM", "test", PATH_CMM, "nd_performance_appraisal_app_indicator");
generate("CMM", "test", PATH_CMM, "nd_performance_appraisal_score_info");
} }


} }

BIN
pmapi/lib/commons-compress-1.19.jar View File


BIN
pmapi/lib/commons-io-2.5.jar View File


BIN
pmapi/lib/commons-lang-2.6.jar View File


BIN
pmapi/lib/commons-lang3-3.8.1.jar View File


BIN
pmapi/lib/commons-logging-1.1.1.jar View File


BIN
pmapi/lib/ofd-simple-tool-1.0.23.0324.jar View File


BIN
pmapi/lib/slf4j-simple-1.7.26.jar View File


BIN
pmapi/lib/suwell-bank-extend-1.8.28.0627-sgcc.jar View File


BIN
pmapi/lib/suwell-core-base-1.7.220623-lite.jar View File


BIN
pmapi/lib/suwell-extend-1.0.22.0804.jar View File


+ 110
- 0
pmapi/pom.xml View File

@@ -265,7 +265,117 @@
<groupId>cn.afterturn</groupId> <groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId> <artifactId>easypoi-base</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.agent</groupId>
<artifactId>agent-boot</artifactId>
<version>1.3.22</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/agent-boot-1.3.22.0215.jar</systemPath>
</dependency>

<dependency>
<groupId>com.agent</groupId>
<artifactId>agent-boot</artifactId>
<version>1.3.22</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/agent-boot-1.3.22.0215.jar</systemPath>
</dependency>

<dependency>
<groupId>com.suwell</groupId>
<artifactId>suwell-agent-http</artifactId>
<version>1.7</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/suwell-agent-http-1.7.220630.jar</systemPath>
</dependency>

<dependency>
<groupId>com.suwell</groupId>
<artifactId>suwell-agent-wrapper</artifactId>
<version>1.6</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/suwell-agent-wrapper-1.6.221208.jar</systemPath>
</dependency>

<dependency>
<groupId>com.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.29</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/slf4j-api-1.7.29.jar</systemPath>
</dependency>

<dependency>
<groupId>com.httpclient</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/httpclient-4.5.13.jar</systemPath>
</dependency>

<dependency>
<groupId>com.httpcore</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.13</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/httpcore-4.4.13.jar</systemPath>
</dependency>


<dependency>
<groupId>com.httpmime</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.13</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/httpmime-4.5.13.jar</systemPath>
</dependency>

<dependency>
<groupId>com.jbArchivesTools</groupId>
<artifactId>jbArchivesTools</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/jbArchivesTools-1.0-SNAPSHOT.jar</systemPath>
</dependency>

<dependency>
<groupId>com.suwell</groupId>
<artifactId>suwell-convert-base</artifactId>
<version>1.5.19</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/suwell-convert-base-1.5.19.0408.jar</systemPath>
</dependency>

<dependency>
<groupId>com.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/gson-2.8.0.jar</systemPath>
</dependency>

<dependency>
<groupId>com.suwell</groupId>
<artifactId>suwell-rpc-manager-client</artifactId>
<version>2.7</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/suwell-rpc-manager-client-2.7.211125.jar</systemPath>
</dependency>

<dependency>
<groupId>com.suwell</groupId>
<artifactId>suwell-packet-wrapper</artifactId>
<version>1.21</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/suwell-packet-wrapper-1.21.230306.jar</systemPath>
</dependency>

<dependency>
<groupId>com.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.0.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/dom4j-2.0.2.jar</systemPath>
</dependency>


</dependencies> </dependencies>
<!-- 打包 --> <!-- 打包 -->


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java View File

@@ -34,7 +34,8 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
"com.ningdatech.pmapi.safety.controller", "com.ningdatech.pmapi.safety.controller",
"com.ningdatech.pmapi.portrait.controller", "com.ningdatech.pmapi.portrait.controller",
"com.ningdatech.pmapi.irs.controller", "com.ningdatech.pmapi.irs.controller",
"com.ningdatech.pmapi.dashboard.controller"
"com.ningdatech.pmapi.dashboard.controller",
"com.ningdatech.pmapi.wps.controller"
}) })
public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { public class GlobalResponseHandler implements ResponseBodyAdvice<Object> {




+ 38
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/constant/BizConst.java View File

@@ -0,0 +1,38 @@
package com.ningdatech.pmapi.performance.constant;

/**
* 常量
* @return
* @author CMM
* @since 2023/08/08 17:53
*/
public interface BizConst {

/**
* 500万元
*/
Integer FIVE_MILLION = 500;
/**
* 2000万元
*/
Integer TWENTY_MILLION = 2000;

/**
* 立项批复金额在500万以下
*/
Integer AMOUNT_RANGE_ONE = 1;

/**
* 立项批复金额在500万-2000万之间
*/
Integer AMOUNT_RANGE_TWO = 2;

/**
* 立项批复金额大于2000万
*/
Integer AMOUNT_RANGE_THREE = 3;
/**
* 复评员
*/
String REAPPRAISAL_ROLE = "复评员";
}

+ 18
- 1
pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java View File

@@ -2,14 +2,18 @@ package com.ningdatech.pmapi.performance.controller;


import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.performance.manage.OrgSelfAppraisalManage; import com.ningdatech.pmapi.performance.manage.OrgSelfAppraisalManage;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;
import com.ningdatech.pmapi.performance.model.vo.ProjectAppraisalIndexDetailVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import javax.validation.Valid;

/** /**
* @Classname OrgSelfAppraisalController * @Classname OrgSelfAppraisalController
* @Description * @Description
@@ -39,6 +43,19 @@ public class OrgSelfAppraisalController {
@GetMapping("/appraisaled-list/{planId}") @GetMapping("/appraisaled-list/{planId}")
@ApiOperation("当前绩效评价已自评列表") @ApiOperation("当前绩效评价已自评列表")
public PageVo<PerformanceAppraisalProjectVO> appraisaledList(@PathVariable Long planId,PerformanceAppraisalListReq req) { public PageVo<PerformanceAppraisalProjectVO> appraisaledList(@PathVariable Long planId,PerformanceAppraisalListReq req) {
return selfAppraisalManage.appraisaledList(planId);
return selfAppraisalManage.appraisaledList(planId,req);
}

@GetMapping("/get-appraisal-template-detail/{projectCode}")
@ApiOperation("获取自评模版详情")
public ProjectAppraisalIndexDetailVO getAppraisalTemplateDetail(@PathVariable String projectCode){
return selfAppraisalManage.getAppraisalTemplateDetail(projectCode);
} }

@PostMapping("/submit-self-appraisal")
@ApiOperation("提交自评")
public String submitSelfAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){
return selfAppraisalManage.submitSelfAppraisal(param);
}

} }

+ 51
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/ReAppraisalController.java View File

@@ -0,0 +1,51 @@
package com.ningdatech.pmapi.performance.controller;

import javax.validation.Valid;

import com.ningdatech.pmapi.performance.manage.ReAppraisalManage;
import org.springframework.web.bind.annotation.*;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;
import com.ningdatech.pmapi.performance.model.vo.ProjectAppraisalIndexDetailVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;

/**
* ReAppraisalController
* @return
* @author CMM
* @since 2023/08/10 8:54
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "绩效评价-人工复评")
@RequestMapping("/api/v1/re-appraisal")
public class ReAppraisalController {

private final ReAppraisalManage reAppraisalManage;

@GetMapping("/list")
@ApiOperation("当前复评用户的绩效评价计划列表")
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) {
return reAppraisalManage.list(req);
}

@GetMapping("/group-project-list/{groupId}")
@ApiOperation("当前复评用户所在分组复评项目列表")
public PageVo<PerformanceAppraisalProjectVO> groupProjectList(@PathVariable Long groupId, PerformanceAppraisalListReq req) {
return reAppraisalManage.groupProjectList(groupId,req);
}

@PostMapping("/submit-reAppraisal")
@ApiOperation("提交复评")
public String submitReAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){
return reAppraisalManage.submitReAppraisal(param);
}

}

+ 50
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/VerifyController.java View File

@@ -0,0 +1,50 @@
package com.ningdatech.pmapi.performance.controller;

import javax.validation.Valid;

import com.ningdatech.pmapi.performance.manage.VerifyManage;
import org.springframework.web.bind.annotation.*;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;

/**
* VerifyController
* @return
* @author CMM
* @since 2023/08/10 8:54
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "绩效评价-专家核查")
@RequestMapping("/api/v1/verify")
public class VerifyController {

private final VerifyManage verifyManage;

@GetMapping("/list")
@ApiOperation("当前核查用户的绩效评价计划列表")
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) {
return verifyManage.list(req);
}

@GetMapping("/group-project-list/{groupId}")
@ApiOperation("当前核查用户所在分组核查项目列表")
public PageVo<PerformanceAppraisalProjectVO> groupProjectList(@PathVariable Long groupId, PerformanceAppraisalListReq req) {
return verifyManage.groupProjectList(groupId,req);
}

@PostMapping("/submit-verify")
@ApiOperation("提交核查")
public String submitVerify(@Valid @RequestBody ProjectAppraisalDTO param){
return verifyManage.submitVerify(param);
}

}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java View File

@@ -34,7 +34,7 @@ public class PerformanceAppraisalConveter {
PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO();
vo.setIsReAppraisal(p.getIsReAppraisal()); vo.setIsReAppraisal(p.getIsReAppraisal());
vo.setCanSelfAppraisal(checkCanSelfAppraisal(p)); vo.setCanSelfAppraisal(checkCanSelfAppraisal(p));
vo.setId(p.getProjectId());
vo.setProjectId(p.getProjectId());
if(map.containsKey(p.getProjectCode())){ if(map.containsKey(p.getProjectCode())){
Project project = map.get(p.getProjectCode()); Project project = map.get(p.getProjectCode());
vo.setProjectCode(project.getProjectCode()); vo.setProjectCode(project.getProjectCode());


+ 42
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppraisalTypeEnum.java View File

@@ -0,0 +1,42 @@
package com.ningdatech.pmapi.performance.enumration;

import java.util.Objects;

import org.apache.commons.lang3.StringUtils;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
* AppraisalTypeEnum
* @return
* @author CMM
* @since 2023/07/26 16:44
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum AppraisalTypeEnum {
/**
* 评价类型
*/
SELF_APPRAISAL(1, "单位自评"),
RE_APPRAISAL(2, "人工复评"),
EXPERT_VERIFY(3, "专家核查");

private Integer code;
private String desc;

public static String getDesc(Integer code) {
if (Objects.isNull(code)) {
return StringUtils.EMPTY;
}
for (AppraisalTypeEnum t : AppraisalTypeEnum.values()) {
if (code.equals(t.getCode())) {
return t.desc;
}
}
return StringUtils.EMPTY;
}
}

+ 22
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/TemplateDetailBuildHelper.java View File

@@ -0,0 +1,22 @@
package com.ningdatech.pmapi.performance.helper;

import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail;
import com.ningdatech.pmapi.performance.model.vo.ProjectAppraisalIndexDetailVO;
import com.ningdatech.pmapi.performance.model.vo.ProjectTemplateDetailVO;

import java.util.List;

/**
* 模板详情构建helper
* @return
* @author CMM
* @since 2023/08/09 22:28
*/
public interface TemplateDetailBuildHelper {
/**
* 构建评价模板详情信息
* @param templateDetails
* @return
*/
List<ProjectTemplateDetailVO> buildTemplateDetail(List<PerformanceIndicatorProjectTemplateDetail> templateDetails, ProjectAppraisalIndexDetailVO vo);
}

+ 130
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/impl/TemplateDetailBuildHelperImpl.java View File

@@ -0,0 +1,130 @@
package com.ningdatech.pmapi.performance.helper.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum;
import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum;
import com.ningdatech.pmapi.performance.helper.TemplateDetailBuildHelper;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo;
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail;
import com.ningdatech.pmapi.performance.model.vo.ProjectAppraisalIndexDetailVO;
import com.ningdatech.pmapi.performance.model.vo.ProjectTemplateDetailVO;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalScoreInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @author CMM
* @since 2023/08/09 22:31
*/
@Component
@RequiredArgsConstructor
public class TemplateDetailBuildHelperImpl implements TemplateDetailBuildHelper {

private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService;

@Override
public List<ProjectTemplateDetailVO> buildTemplateDetail(List<PerformanceIndicatorProjectTemplateDetail> templateDetails, ProjectAppraisalIndexDetailVO vo) {
List<ProjectTemplateDetailVO> res = Lists.newArrayList();
//第一层是 一级的
for (PerformanceIndicatorProjectTemplateDetail templateDetailFirst : templateDetails) {
if (PerformanceTemplateTypeEnum.FIRST_INDEX.getCode().equals(templateDetailFirst.getType())) {
ProjectTemplateDetailVO detailFirstVo = BeanUtil.copyProperties(templateDetailFirst, ProjectTemplateDetailVO.class);
List<ProjectTemplateDetailVO> firstList = Lists.newArrayList();
// 该层循环筛选出第二 指标
for (PerformanceIndicatorProjectTemplateDetail templateDetailSecond : templateDetails) {
if (Objects.nonNull(templateDetailSecond.getParentId()) &&
templateDetailSecond.getParentId().equals(templateDetailFirst.getId())) {
ProjectTemplateDetailVO detailSecondVo = BeanUtil.copyProperties(templateDetailSecond, ProjectTemplateDetailVO.class);
List<ProjectTemplateDetailVO> secondList = Lists.newArrayList();
// 该层循环筛选出第三 指标
for (PerformanceIndicatorProjectTemplateDetail templateDetailThird : templateDetails) {
if (Objects.nonNull(templateDetailThird.getParentId()) &&
templateDetailThird.getParentId().equals(templateDetailSecond.getId())) {
ProjectTemplateDetailVO detailThirdVo = BeanUtil.copyProperties(templateDetailThird, ProjectTemplateDetailVO.class);
// 如果有单位自评、复评、核查分数信息,各自装配信息
// 获取自评分数信息
List<PerformanceAppraisalScoreInfo> selfAppraisalScoreInfo = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class)
.eq(PerformanceAppraisalScoreInfo::getTemplateDetailId, templateDetailThird.getId())
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode()));
if (CollUtil.isNotEmpty(selfAppraisalScoreInfo)) {
detailThirdVo.setSelfAppraisalScoreInfo(selfAppraisalScoreInfo);
BigDecimal score = selfAppraisalScoreInfo.stream().map(PerformanceAppraisalScoreInfo::getAppraisalScore)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
if (Objects.nonNull(vo)) {
vo.setSelfAppraisalTotalScore(score);
}
}
// 按照复评人员分组 获取复评分数信息
List<PerformanceAppraisalScoreInfo> reAppraisalScoreInfo = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class)
.eq(PerformanceAppraisalScoreInfo::getTemplateDetailId, templateDetailThird.getId())
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode()));
if (CollUtil.isNotEmpty(reAppraisalScoreInfo)) {
Map<String, List<PerformanceAppraisalScoreInfo>> reAppScoreInfoMap = reAppraisalScoreInfo.stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName));
HashMap<String, BigDecimal> scoreMap = MapUtil.newHashMap();
for (String name : reAppScoreInfoMap.keySet()) {
List<PerformanceAppraisalScoreInfo> scoreInfos = reAppScoreInfoMap.get(name);
BigDecimal totalScore = scoreInfos.stream().map(PerformanceAppraisalScoreInfo::getAppraisalScore)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
scoreMap.put(name, totalScore);
}
detailThirdVo.setReAppraisalTotalScoreInfo(scoreMap);
detailThirdVo.setReAppraisalScoreInfo(reAppScoreInfoMap);
if (Objects.nonNull(vo)){
BigDecimal sum = scoreMap.values().stream()
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setVerifyTotalScore(sum);
}
}
// 按照核查人员分组 获取核查分数信息
List<PerformanceAppraisalScoreInfo> verifyScoreInfo = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class)
.eq(PerformanceAppraisalScoreInfo::getTemplateDetailId, templateDetailThird.getId())
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode()));
if (CollUtil.isNotEmpty(verifyScoreInfo)) {
Map<String, List<PerformanceAppraisalScoreInfo>> verifyScoreInfoMap = verifyScoreInfo.stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName));
HashMap<String, BigDecimal> scoreMap = MapUtil.newHashMap();
for (String name : verifyScoreInfoMap.keySet()) {
List<PerformanceAppraisalScoreInfo> scoreInfos = verifyScoreInfoMap.get(name);
BigDecimal totalScore = scoreInfos.stream().map(PerformanceAppraisalScoreInfo::getAppraisalScore)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
scoreMap.put(name, totalScore);
}
detailThirdVo.setVerifyTotalScoreInfo(scoreMap);
detailThirdVo.setVerifyScoreInfo(verifyScoreInfoMap);
if (Objects.nonNull(vo)){
BigDecimal sum = scoreMap.values().stream()
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setVerifyTotalScore(sum);
}
}
secondList.add(detailThirdVo);
}
}
detailSecondVo.setChildren(secondList);
firstList.add(detailSecondVo);
}
}
detailFirstVo.setChildren(firstList);
res.add(detailFirstVo);

}
}
return res;
}
}

+ 38
- 5
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java View File

@@ -9,10 +9,12 @@ import com.google.common.collect.Lists;
import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.common.enumeration.CommonEnum; import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum; import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum;
import com.ningdatech.pmapi.performance.helper.TemplateDetailBuildHelper;
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorAppIndexSaveDTO; import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorAppIndexSaveDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectIndexSaveDTO; import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectIndexSaveDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO;
@@ -42,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional;


import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -60,6 +63,7 @@ public class IndicatorConfigManage {
private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService;
private final IPerformanceAppraisalProjectIndicatorService projectIndicatorService; private final IPerformanceAppraisalProjectIndicatorService projectIndicatorService;
private final IPerformanceAppraisalAppIndicatorService appIndicatorService; private final IPerformanceAppraisalAppIndicatorService appIndicatorService;
private final TemplateDetailBuildHelper templateDetailBuildHelper;


/** /**
* 模板列表 * 模板列表
@@ -97,19 +101,27 @@ public class IndicatorConfigManage {
} }
ProjectIndexTemplateVO vo = BeanUtil.copyProperties(template, ProjectIndexTemplateVO vo = BeanUtil.copyProperties(template,
ProjectIndexTemplateVO.class); ProjectIndexTemplateVO.class);
String projectTagIds = template.getProjectTagIds();
if (StringUtils.isNotBlank(projectTagIds)){
List<Long> proTagIdList = Arrays.stream(projectTagIds.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList());
vo.setProjectTagIds(proTagIdList);
}
// 获取模版绩效指标详情 // 获取模版绩效指标详情
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id));
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE));
// 获取模版附加绩效指标详情 // 获取模版附加绩效指标详情
List<PerformanceIndicatorProjectTemplateDetail> additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) List<PerformanceIndicatorProjectTemplateDetail> additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE));
if(CollUtil.isNotEmpty(templateDetails)){ if(CollUtil.isNotEmpty(templateDetails)){
vo.setTemplateDetails(buildTemplateDetail(templateDetails));
List<ProjectTemplateDetailVO> templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails,null);
vo.setTemplateDetails(templateDetailVos);
} }


if (CollUtil.isNotEmpty(additionalTemplateDetails)){ if (CollUtil.isNotEmpty(additionalTemplateDetails)){
vo.setAdditionalIndexDetails(buildTemplateDetail(additionalTemplateDetails));
List<ProjectTemplateDetailVO> additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails,null);
vo.setAdditionalIndexDetails(additionalTemplateDetailVos);
} }
return vo; return vo;
} }
@@ -123,6 +135,13 @@ public class IndicatorConfigManage {
public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) { public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) {
UserInfoDetails user = LoginUserUtil.loginUserDetail(); UserInfoDetails user = LoginUserUtil.loginUserDetail();
PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class); PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class);
List<Long> projectTagIds = dto.getProjectTagIds();
List<String> tagIdList = projectTagIds.stream().map(String::valueOf).collect(Collectors.toList());
template.setProjectTagIds(String.join(StrPool.COMMA, tagIdList));
if (Objects.isNull(dto.getStatus())){
// 默认模版禁用
template.setStatus(0);
}
if(Objects.nonNull(dto.getId())){ if(Objects.nonNull(dto.getId())){
PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId()); PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!"); VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!");
@@ -139,10 +158,13 @@ public class IndicatorConfigManage {
if(CollUtil.isNotEmpty(dto.getTemplateDetails())){ if(CollUtil.isNotEmpty(dto.getTemplateDetails())){
//先删除 //先删除
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId()));
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId())
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE));
analysisTemplateDetails(dto.getTemplateDetails(),template.getId());
//校检 所有3级指标(不包括附加指标) 总分是不是100 //校检 所有3级指标(不包括附加指标) 总分是不是100
List<PerformanceIndicatorProjectTemplateDetail> indexList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) List<PerformanceIndicatorProjectTemplateDetail> indexList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, template.getId()) .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, template.getId())
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE)
.eq(PerformanceIndicatorProjectTemplateDetail::getType,PerformanceTemplateTypeEnum.THIRD_INDEX.getCode())); .eq(PerformanceIndicatorProjectTemplateDetail::getType,PerformanceTemplateTypeEnum.THIRD_INDEX.getCode()));
if(CollUtil.isNotEmpty(indexList)){ if(CollUtil.isNotEmpty(indexList)){
BigDecimal sum = indexList.stream() BigDecimal sum = indexList.stream()
@@ -152,7 +174,6 @@ public class IndicatorConfigManage {
boolean score = (BigDecimal.valueOf(100)).equals(sum); boolean score = (BigDecimal.valueOf(100)).equals(sum);
VUtils.isTrue(Boolean.FALSE.equals(score)).throwMessage("总分不是100 操作失败!"); VUtils.isTrue(Boolean.FALSE.equals(score)).throwMessage("总分不是100 操作失败!");
} }
analysisTemplateDetails(dto.getTemplateDetails(),template.getId());
} }
// 保存 模版附加指标详情 // 保存 模版附加指标详情
if (CollUtil.isNotEmpty(dto.getAdditionalIndexDetails())){ if (CollUtil.isNotEmpty(dto.getAdditionalIndexDetails())){
@@ -208,6 +229,7 @@ public class IndicatorConfigManage {
templateDetail.setTemplateId(templateId); templateDetail.setTemplateId(templateId);
// 一级指标的父ID为null // 一级指标的父ID为null
templateDetail.setParentId(parentId); templateDetail.setParentId(parentId);
templateDetail.setIsAdditional(Boolean.FALSE);


indicatorProjectTemplateDetailService.save(templateDetail); indicatorProjectTemplateDetailService.save(templateDetail);


@@ -316,6 +338,17 @@ public class IndicatorConfigManage {
public Boolean enOrDisProjectIndexTemplate(Long templateId, boolean active) { public Boolean enOrDisProjectIndexTemplate(Long templateId, boolean active) {
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId); PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId);
if (Boolean.TRUE.equals(active)){ if (Boolean.TRUE.equals(active)){
// 根据创建模板时选择的项目类型、预算年度、项目金额、项目标签
// 判断模板是否可以启用(同一套组合只能启用一套模板)
PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getOne(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class)
.eq(PerformanceIndicatorProjectTemplate::getProjectType, projectTemplate.getProjectType())
.eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectTemplate.getProjectYear())
.eq(PerformanceIndicatorProjectTemplate::getAmountRange, projectTemplate.getAmountRange())
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTemplate.getProjectTagIds())
.eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode()));
if (Objects.nonNull(template)){
throw new BizException("相同配置的模板已存在,当前模板无法启用!");
}
projectTemplate.setStatus(CommonEnum.YES.getCode()); projectTemplate.setStatus(CommonEnum.YES.getCode());
}else { }else {
projectTemplate.setStatus(CommonEnum.NO.getCode()); projectTemplate.setStatus(CommonEnum.NO.getCode());


+ 208
- 22
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java View File

@@ -8,14 +8,18 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.performance.constant.BizConst;
import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum;
import com.ningdatech.pmapi.performance.helper.TemplateDetailBuildHelper;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO;
import com.ningdatech.pmapi.performance.model.entity.*;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalApplicationService;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService;
import com.ningdatech.pmapi.performance.model.vo.*;
import com.ningdatech.pmapi.performance.service.*;
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag;
import com.ningdatech.pmapi.portrait.service.IProjectTagService;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.Project;
@@ -30,7 +34,9 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -47,16 +53,14 @@ import java.util.stream.Collectors;
public class OrgSelfAppraisalManage { public class OrgSelfAppraisalManage {


private final IPerformanceAppraisalService performanceAppraisalService; private final IPerformanceAppraisalService performanceAppraisalService;

private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; private final IPerformanceAppraisalProjectService performanceAppraisalProjectService;

private final IPerformanceAppraisalApplicationService performanceAppraisalApplicationService;

private final IProjectService projectService; private final IProjectService projectService;

private final IProjectApplicationService applicationService;
private final IRoleService roleService; private final IRoleService roleService;

private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService;
private final TemplateDetailBuildHelper templateDetailBuildHelper;
private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService;
private final IProjectTagService projectTagService;
private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService;
/** /**
* 绩效列表 * 绩效列表
* @param req * @param req
@@ -73,7 +77,7 @@ public class OrgSelfAppraisalManage {
Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class) Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class)
.eq(Role::getName, RoleEnum.COMPANY_MANAGER.getDesc())); .eq(Role::getName, RoleEnum.COMPANY_MANAGER.getDesc()));
if (Objects.isNull(role)){ if (Objects.isNull(role)){
throw new BizException("系统没有单位管理员角色!");
throw new BizException("登录用户没有单位管理员角色!");
} }


// 登录用户不是单位管理员,不能查看本单位的自评计划列表 // 登录用户不是单位管理员,不能查看本单位的自评计划列表
@@ -121,7 +125,8 @@ public class OrgSelfAppraisalManage {


// 获取评价计划内已添加的待评价项目信息 // 获取评价计划内已添加的待评价项目信息
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()));
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream()
.filter(p -> Objects.isNull(p.getSelfAppraisalScoreTime())).collect(Collectors.toList());
Map<Long, PerformanceAppraisalProject> papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); Map<Long, PerformanceAppraisalProject> papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p));


if(CollUtil.isEmpty(paps)){ if(CollUtil.isEmpty(paps)){
@@ -146,11 +151,11 @@ public class OrgSelfAppraisalManage {
.map(p -> { .map(p -> {
PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class);
PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId());
BeanUtil.copyProperties(appraisalProject,vo);
vo.setProjectId(appraisalProject.getProjectId());
vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType()));
vo.setIsReAppraisal(appraisalProject.getIsReAppraisal());
vo.setSelfAppraisalStart(appraisalProject.getSelfAppraisalStart());
vo.setSelfAppraisalEnd(appraisalProject.getSelfAppraisalEnd());
vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject));
vo.setAppraisalId(planId);
return vo; return vo;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -160,12 +165,54 @@ public class OrgSelfAppraisalManage {


/** /**
* 已经自评表 * 已经自评表
*
* @param planId * @param planId
* @param req
* @return * @return
*/ */
public PageVo<PerformanceAppraisalProjectVO> appraisaledList(Long planId) {
public PageVo<PerformanceAppraisalProjectVO> appraisaledList(Long planId, PerformanceAppraisalListReq req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();

PerformanceAppraisal plan = performanceAppraisalService.getById(planId);
VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!");

// 获取评价计划内已添加的已评价项目信息
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream()
.filter(p -> Objects.nonNull(p.getSelfAppraisalScoreTime())).collect(Collectors.toList());
Map<Long, PerformanceAppraisalProject> papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p));

if(CollUtil.isEmpty(paps)){
return PageVo.empty();
}


return PageVo.empty();
// 获取本单位在当前评价计划内的项目
Set<String> projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet());
Page<Project> page = req.page();
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class)
.in(Project::getProjectCode, projectCodes)
.eq(Project::getNewest, Boolean.TRUE)
.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode())
.like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName());
projectService.page(page,wrapper);

if(0L == page.getTotal()){
return PageVo.empty();
}
List<PerformanceAppraisalProjectVO> res = page.getRecords().stream()
.map(p -> {
PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class);
PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId());
BeanUtil.copyProperties(appraisalProject,vo);
vo.setProjectId(appraisalProject.getProjectId());
vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType()));
vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject));
vo.setAppraisalId(planId);
return vo;
})
.collect(Collectors.toList());

return PageVo.of(res,page.getTotal());
} }


/** /**
@@ -174,10 +221,149 @@ public class OrgSelfAppraisalManage {
* @return * @return
*/ */
private Boolean checkCanSelfAppraisal(PerformanceAppraisalProject appraisalProject) { private Boolean checkCanSelfAppraisal(PerformanceAppraisalProject appraisalProject) {
// 在自评时间段内,且是首次自评(打分时间为空)
if(LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalStart()) > 0 && if(LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalStart()) > 0 &&
LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalEnd()) < 0){
LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalEnd()) < 0 &&
Objects.isNull(appraisalProject.getSelfAppraisalScoreTime())){
return Boolean.TRUE; return Boolean.TRUE;
} }
return Boolean.FALSE; return Boolean.FALSE;
} }

public ProjectAppraisalIndexDetailVO getAppraisalTemplateDetail(String projectCode) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
String regionCode = user.getRegionCode();

ProjectAppraisalIndexDetailVO vo = new ProjectAppraisalIndexDetailVO();

// 根据项目编码获取最新版本的项目信息
Project project = projectService.getProjectByCode(projectCode);
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!");
// 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版
Integer projectType = project.getProjectType();
Integer projectYear = project.getProjectYear();
BigDecimal approvalAmount = project.getApprovalAmount();
VUtils.isTrue(Objects.isNull(approvalAmount)).throwMessage("未获取到该项目的立项批复金额");
// 根据项目code获取项目标签ID列表
List<Long> tagIdList = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class)
.eq(ProjectTag::getProjectCode, projectCode)).stream()
.map(ProjectTag::getTagId).collect(Collectors.toList());
VUtils.isTrue(CollUtil.isEmpty(tagIdList)).throwMessage("当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!");

List<String> strIdList = tagIdList.stream().map(String::valueOf).collect(Collectors.toList());
String projectTagIds = String.join(StrPool.COMMA, strIdList);

Integer amountRange = null;
if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.FIVE_MILLION)) < 0){
amountRange = BizConst.AMOUNT_RANGE_ONE;
} else if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.FIVE_MILLION)) >= 0 &&
approvalAmount.compareTo(BigDecimal.valueOf(BizConst.TWENTY_MILLION)) < 0) {
amountRange = BizConst.AMOUNT_RANGE_TWO;
}else if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.TWENTY_MILLION)) >= 0){
amountRange = BizConst.AMOUNT_RANGE_THREE;
}
LambdaQueryWrapper<PerformanceIndicatorProjectTemplate> wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class)
.eq(PerformanceIndicatorProjectTemplate::getRegionCode, regionCode)
.eq(PerformanceIndicatorProjectTemplate::getProjectType, projectType)
.eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear)
.eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange)
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds,projectTagIds)
.orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn);
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getOne(wrapper);

if (Objects.isNull(projectTemplate)){
throw new BizException("该项目匹配不到指标模板,请返回上一页或者刷新重试。");
}
// 装配项目指标详情及分数信息
// 获取模版绩效指标详情
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()));
// 获取模版附加绩效指标详情
List<PerformanceIndicatorProjectTemplateDetail> additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE));
List<ProjectTemplateDetailVO> templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails,vo);
List<ProjectTemplateDetailVO> additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails,vo);
vo.setProjectName(project.getProjectName());
vo.setBuildOrgName(project.getBuildOrgName());
vo.setProjectStatus(project.getStatus());
vo.setProjectYear(projectYear);
vo.setApprovalAmount(approvalAmount);
vo.setTemplateDetails(templateDetailVos);
vo.setAdditionalIndexDetails(additionalTemplateDetailVos);
return vo;
}

@Transactional(rollbackFor = Exception.class)
public String submitSelfAppraisal(ProjectAppraisalDTO param) {
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
String employeeCode = userDetail.getEmployeeCode();
String username = userDetail.getUsername();
Long appraisalId = param.getAppraisalId();
Long appraisalProjectId = param.getAppraisalProjectId();
String appraisalProjectCode = param.getAppraisalProjectCode();
List<ProjectAppraisalInfoDTO> appraisalInfoList = param.getAppraisalInfoList();
// 判断该项目是否还存在于计划或分组中
PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId, appraisalId)
.eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId)
.eq(PerformanceAppraisalProject::getProjectCode,appraisalProjectCode));
if (Objects.isNull(appraisalProject)){
throw new BizException("该项目已被移除评价计划,请返回上一页或者刷新重试!");
}
// 根据项目模板详情ID保存自评得分、打分时间
if (CollUtil.isEmpty(appraisalInfoList)){
throw new BizException("填写所有自评得分后才能提交!");
}
List<Long> ids = appraisalInfoList.stream()
.map(ProjectAppraisalInfoDTO::getProjectTemplateDetailId)
.collect(Collectors.toList());
// 查出项目模版详情信息
List<PerformanceIndicatorProjectTemplateDetail> detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.in(PerformanceIndicatorProjectTemplateDetail::getId, ids));
if (CollUtil.isEmpty(detailList)){
throw new BizException("评价指标不存在!");
}
Map<Long, PerformanceIndicatorProjectTemplateDetail> detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d));
List<PerformanceAppraisalScoreInfo> scoreInfos = appraisalInfoList.stream().map(a -> {
PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId());
BigDecimal score = a.getScore();
BigDecimal indexScore = templateDetail.getIndexScore();
if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){
throw new BizException("自评得分必须大于等于0且小于等于指标分值!");
}
// 保存自评分数信息
PerformanceAppraisalScoreInfo scoreInfo = new PerformanceAppraisalScoreInfo();
scoreInfo.setAppraisalBasis(a.getAppraisalBasis());
scoreInfo.setAppraisalScore(a.getScore());
scoreInfo.setAppraisalBasisAppendix(a.getAppraisalBasisAppendix());
scoreInfo.setAppraisalType(AppraisalTypeEnum.SELF_APPRAISAL.getCode());
scoreInfo.setTemplateDetailId(templateDetail.getId());
scoreInfo.setTemplateId(templateDetail.getTemplateId());
scoreInfo.setAppraisalEmployeeCode(employeeCode);
scoreInfo.setAppraisalEmployeeName(username);
scoreInfo.setAppraisalId(appraisalId);
scoreInfo.setAppraisalProjectId(appraisalProjectId);
scoreInfo.setAppraisalProjectCode(appraisalProjectCode);
scoreInfo.setCreateOn(LocalDateTime.now());
scoreInfo.setCreateBy(username);
return scoreInfo;
}).collect(Collectors.toList());

if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){
// 计算自评总分并保存
BigDecimal selfAppraisalTotalScore = appraisalInfoList.stream()
.map(ProjectAppraisalInfoDTO::getScore)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
appraisalProject.setSelfAppraisalTotalScore(selfAppraisalTotalScore);
appraisalProject.setSelfAppraisalScoreTime(LocalDateTime.now());
appraisalProject.setIsCompleteSelfAppraisal(Boolean.TRUE);
appraisalProject.setUpdateOn(LocalDateTime.now());
appraisalProject.setUpdateBy(username);
performanceAppraisalProjectService.updateById(appraisalProject);
return "提交成功";
}
return "提交失败";
}
} }

+ 59
- 6
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java View File

@@ -224,6 +224,10 @@ public class PerformanceAppraisalPlanManage {
List<UserFullInfoDTO> verificationUsers = Arrays.stream(verificationUsersStr.split(StrPool.COMMA)) List<UserFullInfoDTO> verificationUsers = Arrays.stream(verificationUsersStr.split(StrPool.COMMA))
.map(userInfoHelper::getUserFullInfoByEmployeeCode).collect(Collectors.toList()); .map(userInfoHelper::getUserFullInfoByEmployeeCode).collect(Collectors.toList());
groupVo.setVerificationUsers(verificationUsers); groupVo.setVerificationUsers(verificationUsers);
if (StringUtils.isNotBlank(g.getVerifyLeader())){
UserFullInfoDTO dto = userInfoHelper.getUserFullInfoByEmployeeCode(g.getVerifyLeader());
groupVo.setVerifyLeader(dto);
}
groupVo.setCreateOn(g.getCreateOn()); groupVo.setCreateOn(g.getCreateOn());
return groupVo; return groupVo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@@ -478,6 +482,9 @@ public class PerformanceAppraisalPlanManage {
List<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) List<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class)
.eq(PerformanceAppraisalApplication::getAppraisalId, id)); .eq(PerformanceAppraisalApplication::getAppraisalId, id));
performanceAppraisalApplicationService.removeBatchByIds(paas); performanceAppraisalApplicationService.removeBatchByIds(paas);
// 删除评级计划关联的分组信息
groupService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class)
.eq(PerformanceAppraisalProjectGroup::getAppraisalId,id));
return "删除成功"; return "删除成功";
} }
return "删除失败"; return "删除失败";
@@ -504,7 +511,11 @@ public class PerformanceAppraisalPlanManage {
}); });


if(CollUtil.isNotEmpty(allEmployeeCodes)){ if(CollUtil.isNotEmpty(allEmployeeCodes)){
List<UserFullInfoDTO> users = userInfoHelper.getUserFullInfoByEmployeeCodes(allEmployeeCodes);
List<UserFullInfoDTO> users = Lists.newArrayList();
for (String employeeCode : allEmployeeCodes) {
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode);
users.add(userFullInfo);
}
if(CollUtil.isNotEmpty(users)){ if(CollUtil.isNotEmpty(users)){
userMap = users.stream().collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode,u -> u)); userMap = users.stream().collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode,u -> u));
} }
@@ -533,6 +544,10 @@ public class PerformanceAppraisalPlanManage {
vo.setProjects(checkProject(g.getProjectCodes(), finalProjectMap)); vo.setProjects(checkProject(g.getProjectCodes(), finalProjectMap));
vo.setReAppraisalUsers(checkUser(g.getReAppraisalUsers(), finalUserMap)); vo.setReAppraisalUsers(checkUser(g.getReAppraisalUsers(), finalUserMap));
vo.setVerificationUsers(checkUser(g.getVerificationUsers(), finalUserMap)); vo.setVerificationUsers(checkUser(g.getVerificationUsers(), finalUserMap));
if (StringUtils.isNotBlank(g.getVerifyLeader())){
UserFullInfoDTO userFullInfoDto = finalUserMap.get(g.getVerifyLeader());
vo.setVerifyLeader(userFullInfoDto);
}
return vo; return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@@ -563,7 +578,11 @@ public class PerformanceAppraisalPlanManage {
allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getReAppraisalUsers())); allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getReAppraisalUsers()));
allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getVerificationUsers())); allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getVerificationUsers()));
if(CollUtil.isNotEmpty(allEmployeeCodes)){ if(CollUtil.isNotEmpty(allEmployeeCodes)){
List<UserFullInfoDTO> users = userInfoHelper.getUserFullInfoByEmployeeCodes(allEmployeeCodes);
List<UserFullInfoDTO> users = Lists.newArrayList();
for (String employeeCode : allEmployeeCodes) {
UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode);
users.add(userFullInfoDto);
}
if(CollUtil.isNotEmpty(users)){ if(CollUtil.isNotEmpty(users)){
userMap = users.stream().collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode,u -> u)); userMap = users.stream().collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode,u -> u));
} }
@@ -580,6 +599,10 @@ public class PerformanceAppraisalPlanManage {
vo.setProjects(checkProject(group.getProjectCodes(), projectMap)); vo.setProjects(checkProject(group.getProjectCodes(), projectMap));
vo.setReAppraisalUsers(checkUser(group.getReAppraisalUsers(), userMap)); vo.setReAppraisalUsers(checkUser(group.getReAppraisalUsers(), userMap));
vo.setVerificationUsers(checkUser(group.getVerificationUsers(), userMap)); vo.setVerificationUsers(checkUser(group.getVerificationUsers(), userMap));
if (StringUtils.isNotBlank(group.getVerifyLeader())){
UserFullInfoDTO dto = userMap.get(group.getVerifyLeader());
vo.setVerifyLeader(dto);
}
return vo; return vo;
} }


@@ -600,9 +623,12 @@ public class PerformanceAppraisalPlanManage {
group.setCreateOn(LocalDateTime.now()); group.setCreateOn(LocalDateTime.now());
group.setCreateBy(user.getUsername()); group.setCreateBy(user.getUsername());
}else{ }else{
// 编辑分组
PerformanceAppraisalProjectGroup old = groupService.getById(dto.getId()); PerformanceAppraisalProjectGroup old = groupService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(old)).throwMessage("该分组不存在 编辑失败!"); VUtils.isTrue(Objects.isNull(old)).throwMessage("该分组不存在 编辑失败!");
group.setId(old.getId()); group.setId(old.getId());
// 先删除旧的分组
groupList.remove(old);
} }
if(CollUtil.isNotEmpty(dto.getProjectCodes())){ if(CollUtil.isNotEmpty(dto.getProjectCodes())){
// 判断选择的项目是否已经在当前评价计划的其他分组内 // 判断选择的项目是否已经在当前评价计划的其他分组内
@@ -610,7 +636,16 @@ public class PerformanceAppraisalPlanManage {
List<String> projectCodeList = groupList.stream() List<String> projectCodeList = groupList.stream()
.map(PerformanceAppraisalProjectGroup::getProjectCodes) .map(PerformanceAppraisalProjectGroup::getProjectCodes)
.collect(Collectors.toList()); .collect(Collectors.toList());
checkProjectCodes(dto.getProjectCodes(),projectCodeList);
List<String> compareCodes = Lists.newArrayList();
for (String projectCode : projectCodeList) {
if (projectCode.contains(StrPool.COMMA)){
List<String> codes = Arrays.asList(projectCode.split(StrPool.COMMA));
compareCodes.addAll(codes);
}else {
compareCodes.add(projectCode);
}
}
checkProjectCodes(dto.getProjectCodes(),compareCodes);
group.setProjectCodes(String.join(StrPool.COMMA, dto.getProjectCodes())); group.setProjectCodes(String.join(StrPool.COMMA, dto.getProjectCodes()));
} }
if(CollUtil.isNotEmpty(dto.getReAppraisalUsers())){ if(CollUtil.isNotEmpty(dto.getReAppraisalUsers())){
@@ -619,7 +654,16 @@ public class PerformanceAppraisalPlanManage {
List<String> reUserList = groupList.stream() List<String> reUserList = groupList.stream()
.map(PerformanceAppraisalProjectGroup::getReAppraisalUsers) .map(PerformanceAppraisalProjectGroup::getReAppraisalUsers)
.collect(Collectors.toList()); .collect(Collectors.toList());
checkReAppraisalAndVerifyUsers(dto.getReAppraisalUsers(),reUserList,CommonConst.REAPPRAISAL_TYPE);
List<String> compareUsers = Lists.newArrayList();
for (String reUser : reUserList) {
if (reUser.contains(StrPool.COMMA)){
List<String> users = Arrays.asList(reUser.split(StrPool.COMMA));
compareUsers.addAll(users);
}else {
compareUsers.add(reUser);
}
}
checkReAppraisalAndVerifyUsers(dto.getReAppraisalUsers(),compareUsers,CommonConst.REAPPRAISAL_TYPE);
group.setReAppraisalUsers(String.join(StrPool.COMMA, dto.getReAppraisalUsers())); group.setReAppraisalUsers(String.join(StrPool.COMMA, dto.getReAppraisalUsers()));
} }
if(CollUtil.isNotEmpty(dto.getVerificationUsers())){ if(CollUtil.isNotEmpty(dto.getVerificationUsers())){
@@ -628,7 +672,16 @@ public class PerformanceAppraisalPlanManage {
List<String> verifyList = groupList.stream() List<String> verifyList = groupList.stream()
.map(PerformanceAppraisalProjectGroup::getVerificationUsers) .map(PerformanceAppraisalProjectGroup::getVerificationUsers)
.collect(Collectors.toList()); .collect(Collectors.toList());
checkReAppraisalAndVerifyUsers(dto.getVerificationUsers(),verifyList,CommonConst.VERIFY_TYPE);
List<String> compareUsers = Lists.newArrayList();
for (String verifyUser : verifyList) {
if (verifyUser.contains(StrPool.COMMA)){
List<String> users = Arrays.asList(verifyUser.split(StrPool.COMMA));
compareUsers.addAll(users);
}else {
compareUsers.add(verifyUser);
}
}
checkReAppraisalAndVerifyUsers(dto.getVerificationUsers(),compareUsers,CommonConst.VERIFY_TYPE);
group.setVerificationUsers(String.join(StrPool.COMMA, dto.getVerificationUsers())); group.setVerificationUsers(String.join(StrPool.COMMA, dto.getVerificationUsers()));
} }
group.setUpdateOn(LocalDateTime.now()); group.setUpdateOn(LocalDateTime.now());
@@ -708,7 +761,7 @@ public class PerformanceAppraisalPlanManage {
vo.setProjectName(project.getProjectName()); vo.setProjectName(project.getProjectName());
vo.setProjectTypeName(BizUtils.getProjectTypeName(project.getProjectType())); vo.setProjectTypeName(BizUtils.getProjectTypeName(project.getProjectType()));
vo.setProjectType(project.getProjectType()); vo.setProjectType(project.getProjectType());
vo.setId(project.getId());
vo.setProjectId(project.getId());
vo.setProjectCode(projectCode); vo.setProjectCode(projectCode);
vo.setProjectYear(project.getProjectYear()); vo.setProjectYear(project.getProjectYear());
vo.setDeclareAmount(project.getDeclareAmount()); vo.setDeclareAmount(project.getDeclareAmount());


+ 333
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/ReAppraisalManage.java View File

@@ -0,0 +1,333 @@
package com.ningdatech.pmapi.performance.manage;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.performance.constant.BizConst;
import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO;
import com.ningdatech.pmapi.performance.model.entity.*;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;
import com.ningdatech.pmapi.performance.service.*;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.sys.service.IRoleService;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
* ReAppraisalManage
* @return
* @author CMM
* @since 2023/08/10 8:55
*/
@Component
@Slf4j
@AllArgsConstructor
public class ReAppraisalManage {

private final IPerformanceAppraisalService performanceAppraisalService;
private final IPerformanceAppraisalProjectService performanceAppraisalProjectService;
private final IProjectService projectService;
private final IRoleService roleService;
private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService;
private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService;
private final IPerformanceAppraisalProjectGroupService groupService;
/**
* 复评-评价计划列表
* @param req
* @return
*/
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
String employeeCode = user.getEmployeeCode();
//当前登录用户 单位code
String empPosUnitCode = user.getEmpPosUnitCode();
// 获取当前登录用户的角色列表,只有绩效复评人员才能查看该列表
List<Role> userRoleList = user.getUserRoleList();
List<Long> roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList());
Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class)
.eq(Role::getName, BizConst.REAPPRAISAL_ROLE));
if (Objects.isNull(role)){
throw new BizException("登录用户没有复评员角色!");
}

// 登录用户不是复评员,不能查看复评计划列表
if (!roleIdList.contains(role.getId())){
return PageVo.empty();
}

// 从绩效评价 项目表中获取已经完成单位自评的项目
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list().stream()
.filter(p -> Objects.nonNull(p.getSelfAppraisalScoreTime())).collect(Collectors.toList());

// 已存在的评价计划添加的评价项目都未完成单位自评
if(CollUtil.isEmpty(paps)){
return PageVo.empty();
}
Set<Long> paIds = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet());

// 获取评价计划关联的分组信息
List<PerformanceAppraisalProjectGroup> groups = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class)
.in(PerformanceAppraisalProjectGroup::getAppraisalId, paIds));
// 获取当前登录复评员所在的分组信息
List<PerformanceAppraisalProjectGroup> groupList = groups.stream().filter(g -> {
String reAppraisalUsers = g.getReAppraisalUsers();
List<String> empCodeList = Arrays.stream(reAppraisalUsers.split(StrPool.COMMA)).collect(Collectors.toList());
if (empCodeList.contains(employeeCode)) {
return true;
}
return false;
}).collect(Collectors.toList());
// 当前登录复评员用户,没有参加评价计划
if (CollUtil.isEmpty(groupList)){
return PageVo.empty();
}
// 获取分组所在的评价计划ID
List<Long> appraisalIds = groupList.stream().map(PerformanceAppraisalProjectGroup::getAppraisalId).collect(Collectors.toList());
// 因为同一个复评员只能出现在一个计划的一个分组中,所以分组信息可按照评价计划ID进行分组
Map<Long, PerformanceAppraisalProjectGroup> groupMap = groupList.stream().collect(Collectors.toMap(PerformanceAppraisalProjectGroup::getAppraisalId, g -> g));
// 获取复评计划列表
Page<PerformanceAppraisal> page = req.page();
LambdaQueryWrapper<PerformanceAppraisal> wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class)
.in(PerformanceAppraisal::getId,appraisalIds)
.orderByDesc(PerformanceAppraisal::getUpdateOn);
performanceAppraisalService.page(page,wrapper);

List<PerformanceAppraisalVO> res = page.getRecords().stream().map(p -> {
PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class);
PerformanceAppraisalProjectGroup group = groupMap.get(p.getId());
if (Objects.nonNull(group)) {
vo.setReAppraisalGroupId(group.getId());
vo.setReAppraisalGroupName(group.getName());
}
return vo;
}).collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}

/**
* 是否可以复评
*
* @param employeeCode
* @param projectCode
* @param appraisalId
* @return
*/
private Boolean checkCanReAppraisal(String employeeCode, String projectCode, Long appraisalId) {
// 首次复评(复评打分时间为空)
// 从绩效评价打分信息表中查询打分类型为复评、打分人员为当前登录复评用户的打分信息
// 如果没有相关的打分信息,说明是当前登录复评用户是首次复评
List<PerformanceAppraisalScoreInfo> scoreInfos = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class)
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode())
.eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode)
.eq(PerformanceAppraisalScoreInfo::getAppraisalId,appraisalId)
.eq(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode, employeeCode));
if (CollUtil.isEmpty(scoreInfos)){
return true;
}
return Boolean.FALSE;
}

public PageVo<PerformanceAppraisalProjectVO> groupProjectList(Long groupId, PerformanceAppraisalListReq req) {

UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
String employeeCode = userDetail.getEmployeeCode();

// 获取分组内的项目信息
PerformanceAppraisalProjectGroup projectGroup = groupService.getById(groupId);
String projectCodes = projectGroup.getProjectCodes();
Long appraisalId = projectGroup.getAppraisalId();
VUtils.isTrue(StringUtils.isBlank(projectCodes)).throwMessage("分组内项目信息不存在!");
List<String> projectCodeList = Arrays.stream(projectCodes.split(StrPool.COMMA)).collect(Collectors.toList());

// 筛选出分组内已完成单位自评、需要复评的评价项目信息
List<PerformanceAppraisalProject> appraisalProjects = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.in(PerformanceAppraisalProject::getProjectCode, projectCodeList)
.eq(PerformanceAppraisalProject::getIsReAppraisal,Boolean.TRUE)
.eq(PerformanceAppraisalProject::getIsCompleteSelfAppraisal, Boolean.TRUE));
// 分组内已完成单位自评的项目信息不存在
if (CollUtil.isEmpty(appraisalProjects)){
return PageVo.empty();
}
List<String> proCodeList = appraisalProjects.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList());
Map<String, PerformanceAppraisalProject> appraisalProjectMap = appraisalProjects.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectCode, p -> p));

Page<Project> page = req.page();
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class)
.in(Project::getProjectCode, proCodeList)
.eq(Project::getNewest, Boolean.TRUE)
.like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName());
projectService.page(page,wrapper);

// 分组内项目信息不存在
if (CollUtil.isEmpty(page.getRecords())){
return PageVo.empty();
}

List<PerformanceAppraisalProjectVO> res = page.getRecords().stream().map(p -> {
PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class);
PerformanceAppraisalProject appraisalProject = appraisalProjectMap.get(p.getProjectCode());
BeanUtil.copyProperties(appraisalProject, vo);
vo.setProjectId(appraisalProject.getProjectId());
vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType()));
vo.setCanReAppraisal(checkCanReAppraisal(employeeCode,appraisalProject.getProjectCode(),appraisalId));
if (Boolean.TRUE.equals(appraisalProject.getIsCompleteReAppraisal())){
// 完成复评的项目可以进行核查
vo.setCanVerify(Boolean.TRUE);
}
vo.setGroupId(groupId);
return vo;
})
.collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}

@Transactional(rollbackFor = Exception.class)
public String submitReAppraisal(ProjectAppraisalDTO param) {
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
String employeeCode = userDetail.getEmployeeCode();
String username = userDetail.getUsername();
Long appraisalId = param.getAppraisalId();
Long appraisalProjectId = param.getAppraisalProjectId();
String appraisalProjectCode = param.getAppraisalProjectCode();
List<ProjectAppraisalInfoDTO> appraisalInfoList = param.getAppraisalInfoList();
Long groupId = param.getGroupId();
PerformanceAppraisalProjectGroup group = groupService.getById(groupId);

// 获取评价项目
PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId, appraisalId)
.eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId)
.eq(PerformanceAppraisalProject::getProjectCode,appraisalProjectCode));

List<Long> ids = appraisalInfoList.stream()
.map(ProjectAppraisalInfoDTO::getProjectTemplateDetailId)
.collect(Collectors.toList());
// 查出项目模版详情信息
List<PerformanceIndicatorProjectTemplateDetail> detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.in(PerformanceIndicatorProjectTemplateDetail::getId, ids));
if (CollUtil.isEmpty(detailList)){
throw new BizException("评价指标不存在!");
}
Map<Long, PerformanceIndicatorProjectTemplateDetail> detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d));
List<PerformanceAppraisalScoreInfo> scoreInfos = appraisalInfoList.stream().map(a -> {
PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId());
BigDecimal score = a.getScore();
BigDecimal indexScore = templateDetail.getIndexScore();
if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){
throw new BizException("复评得分必须大于等于0且小于等于指标分值!");
}
// 保存复评分数信息
PerformanceAppraisalScoreInfo scoreInfo = new PerformanceAppraisalScoreInfo();
scoreInfo.setAppraisalBasis(a.getAppraisalBasis());
scoreInfo.setAppraisalScore(a.getScore());
scoreInfo.setAppraisalBasisAppendix(a.getAppraisalBasisAppendix());
scoreInfo.setAppraisalType(AppraisalTypeEnum.RE_APPRAISAL.getCode());
scoreInfo.setTemplateDetailId(templateDetail.getId());
scoreInfo.setTemplateId(templateDetail.getTemplateId());
scoreInfo.setAppraisalEmployeeCode(employeeCode);
scoreInfo.setAppraisalEmployeeName(username);
scoreInfo.setAppraisalId(appraisalId);
scoreInfo.setAppraisalProjectId(appraisalProjectId);
scoreInfo.setAppraisalProjectCode(appraisalProjectCode);
scoreInfo.setCreateOn(LocalDateTime.now());
scoreInfo.setCreateBy(username);
return scoreInfo;
}).collect(Collectors.toList());

if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){
// 计算复评总分并保存
BigDecimal reAppraisalTotalScore = appraisalInfoList.stream()
.map(ProjectAppraisalInfoDTO::getScore)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal lastReappraisalTotalScore;
// 判断项目所在分组内其他复评人员是否已经打分
if (Objects.nonNull(appraisalProject.getReAppraisalTotalScore())){
// 已经进行了复评,计算两个分值的平均分
BigDecimal add = reAppraisalTotalScore.add(appraisalProject.getReAppraisalTotalScore());
lastReappraisalTotalScore = add.divide(BigDecimal.valueOf(2));
}else {
// 还没有进行过复评
lastReappraisalTotalScore = reAppraisalTotalScore;
}
appraisalProject.setReAppraisalTotalScore(lastReappraisalTotalScore);
// 取最新地复评打分时间
appraisalProject.setReAppraisalScoreTime(LocalDateTime.now());
// 判断当前复评人是否为该评价项目所在分组的复评人员中的最后一个复评人
judgeCompleteReAppraisal(group, appraisalProject);
appraisalProject.setUpdateOn(LocalDateTime.now());
appraisalProject.setUpdateBy(username);
performanceAppraisalProjectService.updateById(appraisalProject);
return "提交成功";
}
return "提交失败";
}

private void judgeCompleteReAppraisal(PerformanceAppraisalProjectGroup group, PerformanceAppraisalProject appraisalProject) {
Map<String, List<PerformanceAppraisalScoreInfo>> scoreInfoMap = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class)
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode()))
.stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode));

List<String> reUsers = Lists.newArrayList();
String reAppraisalUsers = group.getReAppraisalUsers();
String projectCodes = group.getProjectCodes();
if (reAppraisalUsers.contains(StrPool.COMMA)){
reUsers = Arrays.asList(reAppraisalUsers.split(StrPool.COMMA));
}else {
reUsers.add(reAppraisalUsers);
}
List<String> users = Lists.newArrayList();
for (String reUser : reUsers) {
// 获取分组内复评人员对分组内项目的复评分数信息
List<PerformanceAppraisalScoreInfo> scoreInfoList = scoreInfoMap.get(reUser);
if (CollUtil.isNotEmpty(scoreInfoList)){
List<Long> projectIdList = scoreInfoList.stream()
.map(PerformanceAppraisalScoreInfo::getAppraisalProjectId)
.collect(Collectors.toList());
List<String> proCodes = projectService.listByIds(projectIdList).stream()
.map(Project::getProjectCode)
.collect(Collectors.toList());
// 当前登录用户所在分组的复评人员 对分组内所有项目进行了复评
if (CollUtil.isNotEmpty(proCodes)){
String join = String.join(StrPool.COMMA, proCodes);
if (join.equals(projectCodes)) {
users.add(reUser);
}
}
}
}
if (CollUtil.isNotEmpty(users)) {
String join = String.join(StrPool.COMMA, users);
if (join.equals(reAppraisalUsers)) {
// 标记项目完成复评
appraisalProject.setIsCompleteReAppraisal(Boolean.TRUE);
}
}
}
}

+ 332
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/VerifyManage.java View File

@@ -0,0 +1,332 @@
package com.ningdatech.pmapi.performance.manage;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

import com.google.common.collect.Lists;
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum;
import com.ningdatech.pmapi.performance.helper.TemplateDetailBuildHelper;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO;
import com.ningdatech.pmapi.performance.model.entity.*;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;
import com.ningdatech.pmapi.performance.service.*;
import com.ningdatech.pmapi.portrait.service.IProjectTagService;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.sys.service.IRoleService;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
* VerifyManage
* @return
* @author CMM
* @since 2023/08/10 8:55
*/
@Component
@Slf4j
@AllArgsConstructor
public class VerifyManage {

private final IPerformanceAppraisalService performanceAppraisalService;
private final IPerformanceAppraisalProjectService performanceAppraisalProjectService;
private final IProjectService projectService;
private final IRoleService roleService;
private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService;
private final TemplateDetailBuildHelper templateDetailBuildHelper;
private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService;
private final IProjectTagService projectTagService;
private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService;
private final IPerformanceAppraisalProjectGroupService groupService;
/**
* 核查-评价计划列表
* @param req
* @return
*/
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
String employeeCode = user.getEmployeeCode();
// 获取当前登录用户的角色列表,只有专家核查人员才能查看该列表
List<Role> userRoleList = user.getUserRoleList();
List<Long> roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList());
Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class)
.eq(Role::getName, RoleEnum.EXPERT.getDesc()));
if (Objects.isNull(role)){
throw new BizException("登录用户没有复评员角色!");
}

// 登录用户不是专家,不能查看核查计划列表
if (!roleIdList.contains(role.getId())){
return PageVo.empty();
}

// 从绩效评价 分组表中获取当前登录专家所在的分组信息
List<PerformanceAppraisalProjectGroup> groups = Lists.newArrayList();
List<PerformanceAppraisalProjectGroup> projectGroups = groupService.list();
for (PerformanceAppraisalProjectGroup projectGroup : projectGroups) {
String verificationUsers = projectGroup.getVerificationUsers();
if (verificationUsers.contains(StrPool.COMMA)){
if (verificationUsers.contains(employeeCode)){
groups.add(projectGroup);
}
} else if (verificationUsers.equals(employeeCode)) {
groups.add(projectGroup);
}
}
// 当前登录专家没有绩效分组信息
if (CollUtil.isEmpty(groups)){
return PageVo.empty();
}

// 获取分组所在的评价计划ID
List<Long> appraisalIds = groups.stream().map(PerformanceAppraisalProjectGroup::getAppraisalId).collect(Collectors.toList());
// 因为同一个核查人员只能出现在一个计划的一个分组中,所以分组信息可按照评价计划ID进行分组
Map<Long, PerformanceAppraisalProjectGroup> groupMap = groups.stream().collect(Collectors.toMap(PerformanceAppraisalProjectGroup::getAppraisalId, g -> g));
// 获取核查计划列表
Page<PerformanceAppraisal> page = req.page();
LambdaQueryWrapper<PerformanceAppraisal> wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class)
.in(PerformanceAppraisal::getId,appraisalIds)
.orderByDesc(PerformanceAppraisal::getUpdateOn);
performanceAppraisalService.page(page,wrapper);

List<PerformanceAppraisalVO> res = page.getRecords().stream().map(p -> {
PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class);
PerformanceAppraisalProjectGroup group = groupMap.get(p.getId());
if (Objects.nonNull(group)) {
vo.setReAppraisalGroupId(group.getId());
vo.setReAppraisalGroupName(group.getName());
}
return vo;
}).collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}

/**
* 是否可以核查
*
* @param employeeCode
* @param projectCode
* @param appraisalId
* @return
*/
private Boolean checkCanVerify(String employeeCode, String projectCode, Long appraisalId) {

// 首次核查(核查打分信息为空)
// 从绩效评价打分信息表中查询打分类型为专家核查、打分人员为当前登录专家用户的打分信息
// 如果没有相关的打分信息,说明是当前登录复评用户是首次核查
List<PerformanceAppraisalScoreInfo> scoreInfos = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class)
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())
.eq(PerformanceAppraisalScoreInfo::getAppraisalId,appraisalId)
.eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode)
.eq(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode, employeeCode));
if (CollUtil.isEmpty(scoreInfos)){
return true;
}
return Boolean.FALSE;
}

public PageVo<PerformanceAppraisalProjectVO> groupProjectList(Long groupId, PerformanceAppraisalListReq req) {

UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
String employeeCode = userDetail.getEmployeeCode();

// 获取分组内的项目信息
PerformanceAppraisalProjectGroup projectGroup = groupService.getById(groupId);
String projectCodes = projectGroup.getProjectCodes();
Long appraisalId = projectGroup.getAppraisalId();
VUtils.isTrue(StringUtils.isBlank(projectCodes)).throwMessage("分组内项目信息不存在!");
List<String> projectCodeList = Arrays.stream(projectCodes.split(StrPool.COMMA)).collect(Collectors.toList());

// 筛选出分组内已完成复评的评价项目信息
List<PerformanceAppraisalProject> appraisalProjects = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.in(PerformanceAppraisalProject::getProjectCode, projectCodeList)
.eq(PerformanceAppraisalProject::getIsCompleteReAppraisal, Boolean.TRUE));
// 分组内已完成复评的项目信息不存在
if (CollUtil.isEmpty(appraisalProjects)){
return PageVo.empty();
}
List<String> proCodeList = appraisalProjects.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList());
Map<String, PerformanceAppraisalProject> appraisalProjectMap = appraisalProjects.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectCode, p -> p));

Page<Project> page = req.page();
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class)
.in(Project::getProjectCode, proCodeList)
.eq(Project::getNewest, Boolean.TRUE)
.like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName());
projectService.page(page,wrapper);

// 分组内项目信息不存在
if (CollUtil.isEmpty(page.getRecords())){
return PageVo.empty();
}

List<PerformanceAppraisalProjectVO> res = page.getRecords().stream().map(p -> {
PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class);
PerformanceAppraisalProject appraisalProject = appraisalProjectMap.get(p.getProjectCode());
BeanUtil.copyProperties(appraisalProject, vo);
vo.setProjectId(appraisalProject.getProjectId());
vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType()));
vo.setCanVerify(checkCanVerify(employeeCode,appraisalProject.getProjectCode(),appraisalId));
// 如果登录用户是核查组长,该项目可填写整改意见
String verifyLeader = projectGroup.getVerifyLeader();
if (employeeCode.equals(verifyLeader)){
vo.setCanRectify(Boolean.TRUE);
}
return vo;
})
.collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}

@Transactional(rollbackFor = Exception.class)
public String submitVerify(ProjectAppraisalDTO param) {
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
String employeeCode = userDetail.getEmployeeCode();
String username = userDetail.getUsername();
Long appraisalId = param.getAppraisalId();
Long appraisalProjectId = param.getAppraisalProjectId();
String appraisalProjectCode = param.getAppraisalProjectCode();
List<ProjectAppraisalInfoDTO> appraisalInfoList = param.getAppraisalInfoList();
Long groupId = param.getGroupId();
PerformanceAppraisalProjectGroup group = groupService.getById(groupId);

// 获取评价项目
PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId, appraisalId)
.eq(PerformanceAppraisalProject::getProjectCode,appraisalProjectCode)
.eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId));

List<Long> ids = appraisalInfoList.stream()
.map(ProjectAppraisalInfoDTO::getProjectTemplateDetailId)
.collect(Collectors.toList());
// 查出项目模版详情信息
List<PerformanceIndicatorProjectTemplateDetail> detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.in(PerformanceIndicatorProjectTemplateDetail::getId, ids));
if (CollUtil.isEmpty(detailList)){
throw new BizException("评价指标不存在!");
}
Map<Long, PerformanceIndicatorProjectTemplateDetail> detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d));
List<PerformanceAppraisalScoreInfo> scoreInfos = appraisalInfoList.stream().map(a -> {
PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId());
BigDecimal score = a.getScore();
BigDecimal indexScore = templateDetail.getIndexScore();
if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){
throw new BizException("核查得分必须大于等于0且小于等于指标分值!");
}
// 保存核查分数信息
PerformanceAppraisalScoreInfo scoreInfo = new PerformanceAppraisalScoreInfo();
scoreInfo.setAppraisalBasis(a.getAppraisalBasis());
scoreInfo.setAppraisalScore(a.getScore());
scoreInfo.setAppraisalBasisAppendix(a.getAppraisalBasisAppendix());
scoreInfo.setAppraisalType(AppraisalTypeEnum.EXPERT_VERIFY.getCode());
scoreInfo.setTemplateDetailId(templateDetail.getId());
scoreInfo.setTemplateId(templateDetail.getTemplateId());
scoreInfo.setAppraisalEmployeeCode(employeeCode);
scoreInfo.setAppraisalEmployeeName(username);
scoreInfo.setAppraisalId(appraisalId);
scoreInfo.setAppraisalProjectId(appraisalProjectId);
scoreInfo.setAppraisalProjectCode(appraisalProjectCode);
scoreInfo.setCreateOn(LocalDateTime.now());
scoreInfo.setCreateBy(username);
return scoreInfo;
}).collect(Collectors.toList());

if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){
// 计算核查总分并保存
BigDecimal verifyTotalScore = appraisalInfoList.stream()
.map(ProjectAppraisalInfoDTO::getScore)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal lastVerifyTotalScore;
// 判断项目所在分组内其他复评人员是否已经打分
if (Objects.nonNull(appraisalProject.getVerifyTotalScore())){
// 已经进行了核查,计算两个分值的平均分
BigDecimal add = verifyTotalScore.add(appraisalProject.getReAppraisalTotalScore());
lastVerifyTotalScore = add.divide(BigDecimal.valueOf(2));
}else {
// 还没有进行过复评
lastVerifyTotalScore = verifyTotalScore;
}
appraisalProject.setReAppraisalTotalScore(lastVerifyTotalScore);
// 取最新地核查打分时间
appraisalProject.setVerifyScoreTime(LocalDateTime.now());
// 判断当前核查人是否为该评价项目所在分组的核查人员中的最后一个核查人
judgeCompleteVerify(group, appraisalProject);
appraisalProject.setUpdateOn(LocalDateTime.now());
appraisalProject.setUpdateBy(username);
if (Objects.nonNull(param.getIsRectify()) ||
StringUtils.isNotBlank(param.getRectifyOpinion())) {
appraisalProject.setIsRectify(param.getIsRectify());
appraisalProject.setRectifyOpinion(param.getRectifyOpinion());
}
performanceAppraisalProjectService.updateById(appraisalProject);
return "提交成功";
}
return "提交失败";
}

private void judgeCompleteVerify(PerformanceAppraisalProjectGroup group, PerformanceAppraisalProject appraisalProject) {
Map<String, List<PerformanceAppraisalScoreInfo>> scoreInfoMap = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class)
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode()))
.stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode));

List<String> verifyUsers = Lists.newArrayList();
String verificationUsers = group.getVerificationUsers();
String projectCodes = group.getProjectCodes();
if (verificationUsers.contains(StrPool.COMMA)){
verifyUsers = Arrays.asList(verificationUsers.split(StrPool.COMMA));
}else {
verifyUsers.add(verificationUsers);
}
List<String> users = Lists.newArrayList();
for (String verifyUser : verifyUsers) {
// 获取分组内核查人员对分组内项目的核查分数信息
List<PerformanceAppraisalScoreInfo> scoreInfoList = scoreInfoMap.get(verifyUser);
if (CollUtil.isNotEmpty(scoreInfoList)){
List<Long> projectIdList = scoreInfoList.stream()
.map(PerformanceAppraisalScoreInfo::getAppraisalProjectId)
.collect(Collectors.toList());
List<String> proCodes = projectService.listByIds(projectIdList).stream()
.map(Project::getProjectCode)
.collect(Collectors.toList());
// 当前登录用户所在分组的核查人员 对分组内所有项目进行了核查
if (CollUtil.isNotEmpty(proCodes)){
String join = String.join(StrPool.COMMA, proCodes);
if (join.equals(projectCodes)) {
users.add(verifyUser);
}
}
}
}
if (CollUtil.isNotEmpty(users)) {
String join = String.join(StrPool.COMMA, users);
if (join.equals(verificationUsers)) {
appraisalProject.setIsCompleteVerify(Boolean.TRUE);
}
}
}
}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalScoreInfoMapper.java View File

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

import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* Mapper 接口
* </p>
*
* @author CMM
* @since 2023-08-09
*/
public interface PerformanceAppraisalScoreInfoMapper extends BaseMapper<PerformanceAppraisalScoreInfo> {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalScoreInfoMapper.xml View 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.performance.mapper.PerformanceAppraisalScoreInfoMapper">

</mapper>

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java View File

@@ -43,4 +43,7 @@ public class PerformanceAppraisalProjectGroupSaveDTO implements Serializable {


@ApiModelProperty("核查人员") @ApiModelProperty("核查人员")
private List<String> verificationUsers; private List<String> verificationUsers;

@ApiModelProperty("核查组长")
private String verifyLeader;
} }

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java View File

@@ -48,4 +48,7 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable


@ApiModelProperty("附加绩效指标详情") @ApiModelProperty("附加绩效指标详情")
private List<ProjectTemplateDetailDTO> additionalIndexDetails; private List<ProjectTemplateDetailDTO> additionalIndexDetails;

@ApiModelProperty("项目标签信息")
private List<Long> projectTagIds;
} }

+ 42
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalDTO.java View File

@@ -0,0 +1,42 @@
package com.ningdatech.pmapi.performance.model.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
* 项目评价信息
* @return
* @author CMM
* @since 2023/08/08 18:46
*/
@Data
public class ProjectAppraisalDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("评价项目ID")
private Long appraisalProjectId;

@ApiModelProperty("评价项目Code")
private String appraisalProjectCode;

@ApiModelProperty("评价计划ID")
private Long appraisalId;

@ApiModelProperty("项目模板指标详情评价信息集合")
private List<ProjectAppraisalInfoDTO> appraisalInfoList;

@ApiModelProperty("项目是否需要整改")
private Boolean isRectify;

@ApiModelProperty("整改意见")
private String rectifyOpinion;

@ApiModelProperty("评价项目所在分组ID")
private Long groupId;
}

+ 37
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalInfoDTO.java View File

@@ -0,0 +1,37 @@
package com.ningdatech.pmapi.performance.model.dto;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* 项目评价信息
* @return
* @author CMM
* @since 2023/08/08 18:46
*/
@Data
public class ProjectAppraisalInfoDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("项目模板指标详情ID")
private Long projectTemplateDetailId;

@ApiModelProperty("评价得分")
@NotNull(message = "得分不能为空!")
private BigDecimal score;

@ApiModelProperty("评价依据")
@Size(max = 500)
private String appraisalBasis;

@ApiModelProperty("评价依据附件")
private String appraisalBasisAppendix;
}

+ 37
- 1
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java View File

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.performance.model.entity; package com.ningdatech.pmapi.performance.model.entity;


import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@@ -8,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;


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


/** /**
@@ -41,7 +43,7 @@ public class PerformanceAppraisalProject implements Serializable {
@ApiModelProperty("项目编码") @ApiModelProperty("项目编码")
private String projectCode; private String projectCode;


@ApiModelProperty("是否核查")
@ApiModelProperty("是否复评")
private Boolean isReAppraisal; private Boolean isReAppraisal;


@ApiModelProperty("自评开始时间") @ApiModelProperty("自评开始时间")
@@ -49,4 +51,38 @@ public class PerformanceAppraisalProject implements Serializable {


@ApiModelProperty("自评结束时间") @ApiModelProperty("自评结束时间")
private LocalDateTime selfAppraisalEnd; private LocalDateTime selfAppraisalEnd;

@ApiModelProperty("自评总分")
private BigDecimal selfAppraisalTotalScore;

@ApiModelProperty("自评打分时间")
private LocalDateTime selfAppraisalScoreTime;

@ApiModelProperty("复评总分")
private BigDecimal reAppraisalTotalScore;

@ApiModelProperty("复评打分时间")
private LocalDateTime reAppraisalScoreTime;

@ApiModelProperty("核查总分")
private BigDecimal verifyTotalScore;

@ApiModelProperty("核查打分时间")
private LocalDateTime verifyScoreTime;

@ApiModelProperty("项目是否需要整改")
private Boolean isRectify;

@ApiModelProperty("整改意见")
private String rectifyOpinion;

@ApiModelProperty("是否完成自评")
private Boolean isCompleteSelfAppraisal;

@ApiModelProperty("是否完成复评")
private Boolean isCompleteReAppraisal;

@ApiModelProperty("是否完成核查")
private Boolean isCompleteVerify;

} }

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java View File

@@ -46,4 +46,7 @@ public class PerformanceAppraisalProjectGroup implements Serializable {


@ApiModelProperty("核查人员") @ApiModelProperty("核查人员")
private String verificationUsers; private String verificationUsers;

@ApiModelProperty("核查组长")
private String verifyLeader;
} }

+ 73
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalScoreInfo.java View File

@@ -0,0 +1,73 @@
package com.ningdatech.pmapi.performance.model.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* <p>
*
* </p>
*
* @author CMM
* @since 2023-08-09
*/
@Data
@TableName("nd_performance_appraisal_score_info")
@ApiModel(value = "NdPerformanceAppraisalScoreInfo对象", description = "")
public class PerformanceAppraisalScoreInfo implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
private Long id;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("创建人")
private String createBy;

@ApiModelProperty("创建时间")
private LocalDateTime updateOn;

@ApiModelProperty("更新人")
private String updateBy;

@ApiModelProperty("项目评价计划模板ID")
private Long templateId;

@ApiModelProperty("项目评价计划模板详情ID")
private Long templateDetailId;

@ApiModelProperty("评价得分")
private BigDecimal appraisalScore;

@ApiModelProperty("评价依据")
private String appraisalBasis;

@ApiModelProperty("评价依据附件")
private String appraisalBasisAppendix;

@ApiModelProperty("评价人员code")
private String appraisalEmployeeCode;

@ApiModelProperty("评价人员姓名")
private String appraisalEmployeeName;

@ApiModelProperty("评价类型 1 单位自评、2 复评人员复评、3 专家核查")
private Integer appraisalType;

@ApiModelProperty("评价计划ID")
private Long appraisalId;

@ApiModelProperty("评价项目ID")
private Long appraisalProjectId;

@ApiModelProperty("评价项目Code")
private String appraisalProjectCode;
}

+ 3
- 5
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java View File

@@ -10,6 +10,7 @@ import lombok.Data;


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


/** /**
* @Classname PerformanceIndicatorTemplate * @Classname PerformanceIndicatorTemplate
@@ -54,9 +55,6 @@ public class PerformanceIndicatorProjectTemplate implements Serializable {
@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上")
private Integer amountRange; private Integer amountRange;


@ApiModelProperty("项目标签ID")
private Long projectTagId;

@ApiModelProperty("项目标签名称")
private String projectTagName;
@ApiModelProperty("项目标签信息")
private String projectTagIds;
} }

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectGroupVO.java View File

@@ -43,4 +43,7 @@ public class PerformanceAppraisalProjectGroupVO implements Serializable {


@ApiModelProperty("核查人员") @ApiModelProperty("核查人员")
private List<UserFullInfoDTO> verificationUsers; private List<UserFullInfoDTO> verificationUsers;

@ApiModelProperty("核查组长")
private UserFullInfoDTO verifyLeader;
} }

+ 38
- 6
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java View File

@@ -1,7 +1,6 @@
package com.ningdatech.pmapi.performance.model.vo; package com.ningdatech.pmapi.performance.model.vo;


import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -9,7 +8,6 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;


/** /**
* @Classname PerformanceAppraisalProjectVO * @Classname PerformanceAppraisalProjectVO
@@ -24,7 +22,7 @@ public class PerformanceAppraisalProjectVO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;


@ApiModelProperty("项目ID") @ApiModelProperty("项目ID")
private Long id;
private Long projectId;


@ApiModelProperty("项目编码") @ApiModelProperty("项目编码")
private String projectCode; private String projectCode;
@@ -53,6 +51,15 @@ public class PerformanceAppraisalProjectVO implements Serializable {
@ApiModelProperty("是否可自评") @ApiModelProperty("是否可自评")
private Boolean canSelfAppraisal = Boolean.FALSE; private Boolean canSelfAppraisal = Boolean.FALSE;


@ApiModelProperty("是否可复评")
private Boolean canReAppraisal = Boolean.FALSE;

@ApiModelProperty("是否可核查")
private Boolean canVerify = Boolean.FALSE;

@ApiModelProperty("是否可整改")
private Boolean canRectify = Boolean.FALSE;

@ApiModelProperty("自评开始时间") @ApiModelProperty("自评开始时间")
private LocalDateTime selfAppraisalStart; private LocalDateTime selfAppraisalStart;


@@ -60,11 +67,36 @@ public class PerformanceAppraisalProjectVO implements Serializable {
private LocalDateTime selfAppraisalEnd; private LocalDateTime selfAppraisalEnd;


@ApiModelProperty("自评总分") @ApiModelProperty("自评总分")
private BigDecimal selfAppraisalScore;
private BigDecimal selfAppraisalTotalScore;

@ApiModelProperty("自评打分时间")
@JSONField(format = "yyyy-MM-dd HH:mm")
private LocalDateTime selfAppraisalScoreTime;

@ApiModelProperty("复评总分")
private BigDecimal reAppraisalTotalScore;


@ApiModelProperty("打分时间")
@ApiModelProperty("复评打分时间")
@JSONField(format = "yyyy-MM-dd HH:mm") @JSONField(format = "yyyy-MM-dd HH:mm")
private LocalDateTime scoreTime;
private LocalDateTime reAppraisalScoreTime;

@ApiModelProperty("核查总分")
private BigDecimal verifyTotalScore;

@ApiModelProperty("核查打分时间")
@JSONField(format = "yyyy-MM-dd HH:mm")
private LocalDateTime verifyScoreTime;

@ApiModelProperty("项目是否需要整改")
private Boolean isRectify;

@ApiModelProperty("整改意见")
private String rectifyOpinion;

@ApiModelProperty("评价计划ID")
private Long appraisalId;


@ApiModelProperty("所在分组ID")
private Long groupId;


} }

+ 13
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java View File

@@ -51,4 +51,17 @@ public class PerformanceAppraisalVO implements Serializable {


@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;

@ApiModelProperty("复评分组ID")
private Long reAppraisalGroupId;

@ApiModelProperty("复评分组名称")
private String reAppraisalGroupName;

@ApiModelProperty("核查分组ID")
private Long verifyGroupId;

@ApiModelProperty("核查分组名称")
private String verifyGroupName;

} }

+ 52
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectAppraisalIndexDetailVO.java View File

@@ -0,0 +1,52 @@
package com.ningdatech.pmapi.performance.model.vo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* 项目评价指标
* @return
* @author CMM
* @since 2023/08/08 8:55
*/
@Data
@ApiModel(value = "项目自(复)评项目指标模版详情", description = "项目自(复)评项目指标模版详情")
public class ProjectAppraisalIndexDetailVO implements Serializable {

private static final long serialVersionUID = 1L;

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

@ApiModelProperty("申报单位")
private String buildOrgName;

@ApiModelProperty("项目状态")
private Integer projectStatus;

@ApiModelProperty("批复金额")
private BigDecimal approvalAmount;

@ApiModelProperty("预算年度")
private Integer projectYear;

@ApiModelProperty("绩效指标详情")
private List<ProjectTemplateDetailVO> templateDetails;

@ApiModelProperty("附加绩效指标详情")
private List<ProjectTemplateDetailVO> additionalIndexDetails;

@ApiModelProperty("自评总得分")
private BigDecimal selfAppraisalTotalScore;

@ApiModelProperty("复评总得分")
private BigDecimal reAppraisalTotalScore;

@ApiModelProperty("核查总得分")
private BigDecimal verifyTotalScore;
}

+ 3
- 4
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java View File

@@ -50,15 +50,14 @@ public class ProjectIndexTemplateVO implements Serializable {
@ApiModelProperty("状态 0关闭 1开启") @ApiModelProperty("状态 0关闭 1开启")
private Integer status; private Integer status;


@ApiModelProperty("项目标签信息")
private List<Long> projectTagIds;

@ApiModelProperty("绩效指标详情") @ApiModelProperty("绩效指标详情")
private List<ProjectTemplateDetailVO> templateDetails; private List<ProjectTemplateDetailVO> templateDetails;


@ApiModelProperty("附加绩效指标详情") @ApiModelProperty("附加绩效指标详情")
private List<ProjectTemplateDetailVO> additionalIndexDetails; private List<ProjectTemplateDetailVO> additionalIndexDetails;


@ApiModelProperty("项目标签ID")
private Long projectTagId;


@ApiModelProperty("项目标签名称")
private String projectTagName;
} }

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java View File

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.performance.model.vo; package com.ningdatech.pmapi.performance.model.vo;


import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -7,6 +8,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map;


/** /**
* @Classname PerformanceIndicatorProjectTemplateDetail * @Classname PerformanceIndicatorProjectTemplateDetail
@@ -20,6 +22,9 @@ public class ProjectTemplateDetailVO implements Serializable {


private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;


@ApiModelProperty("id")
private Long id;

@ApiModelProperty("关联模板ID") @ApiModelProperty("关联模板ID")
private Long templateId; private Long templateId;


@@ -52,4 +57,20 @@ public class ProjectTemplateDetailVO implements Serializable {


@ApiModelProperty("子指标") @ApiModelProperty("子指标")
private List<ProjectTemplateDetailVO> children; private List<ProjectTemplateDetailVO> children;

@ApiModelProperty("自评分数信息")
private List<PerformanceAppraisalScoreInfo> selfAppraisalScoreInfo;

@ApiModelProperty("复评分数信息")
private Map<String, List<PerformanceAppraisalScoreInfo>> reAppraisalScoreInfo;

@ApiModelProperty("复评得分信息")
private Map<String, BigDecimal> reAppraisalTotalScoreInfo;

@ApiModelProperty("核查分数信息")
private Map<String, List<PerformanceAppraisalScoreInfo>> verifyScoreInfo;

@ApiModelProperty("核查得分信息")
private Map<String, BigDecimal> verifyTotalScoreInfo;

} }

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalScoreInfoService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.performance.service;

import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* <p>
* 服务类
* </p>
*
* @author CMM
* @since 2023-08-09
*/
public interface IPerformanceAppraisalScoreInfoService extends IService<PerformanceAppraisalScoreInfo> {

}

+ 20
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalScoreInfoServiceImpl.java View File

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

import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo;
import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalScoreInfoMapper;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalScoreInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
* <p>
* 服务实现类
* </p>
*
* @author CMM
* @since 2023-08-09
*/
@Service
public class PerformanceAppraisalScoreInfoServiceImpl extends ServiceImpl<PerformanceAppraisalScoreInfoMapper, PerformanceAppraisalScoreInfo> implements IPerformanceAppraisalScoreInfoService {

}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/wps/contants/WpsContant.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.wps.contants;

/**
* @Classname WpsContant
* @Description
* @Date 2023/8/15 14:09
* @Author PoffyZhang
*/
public interface WpsContant {

String WPS_CONVERT_URL_ONLINE = "http://10.53.157.47";
String FIX_FILE_PATH = "/opt/file/";
String PDF_PATH = "/opt/file/offices2pdf.pdf";
String PDF_CONTENT_TYPE = "application/pdf";
String PDF_NAME = "offices2pdf.pdf";
}

+ 82
- 0
pmapi/src/main/java/com/ningdatech/pmapi/wps/controller/WpsConvertController.java View File

@@ -0,0 +1,82 @@
package com.ningdatech.pmapi.wps.controller;

import com.ningdatech.irs.service.IRefreshTokenService;
import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.HttpUtil;
import com.ningdatech.pmapi.wps.manage.WpsConvertManage;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
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 org.springframework.web.client.RestTemplate;

import javax.servlet.http.HttpServletResponse;
import java.security.NoSuchAlgorithmException;
import java.util.Objects;

/**
* @Classname WpsConvertController
* @Description
* @Date 2023/8/14 13:58
* @Author PoffyZhang
*/
@Slf4j
@RestController
@Api(tags = "待办中心控制器")
@RequestMapping("/api/v1/wps-convert")
public class WpsConvertController {
@Autowired
private IRefreshTokenService refreshTokenService;

@Autowired
private WpsConvertManage wpsConvertManage;


@Value("${irs.interface-refresh.request-token-url}")
private String govRequestTokenUrl;
@Value("${irs.interface-refresh.refresh-token-url}")
private String govRefreshTokenUrl;

@GetMapping("/office2pdf")
public String office2pdf(){
return wpsConvertManage.offs2Pdf();
}

@GetMapping("/downloadToPdfStream")
public void downloadToPdfStream(@RequestParam Long fileId, HttpServletResponse response){
wpsConvertManage.downloadToPdfStream(fileId,response);
}

@GetMapping("/test-core")
public String testCore() throws NoSuchAlgorithmException {
long timestamp = System.currentTimeMillis();
String appSecret = "496f0f2a19994f76b4fd9dae087366c7";
String appKey = "A331101453557202109017383";

String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl,
"Fc3re2cq7r64Qfa7", HttpMethod.POST.name());
String sign = CryptUtils.MD5Encode(appKey + secret + timestamp);
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory();
RestTemplate restTemplate;
if(Objects.nonNull(factory)){
restTemplate = new RestTemplate(factory);
}else{
restTemplate = new RestTemplate();
}

String url = "https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm?" +
"dingCode=&matterName=&oid=&useState=1&limit=1000&page=1" +
"&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp;

ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());
return forEntity.getBody();
}
}

+ 159
- 0
pmapi/src/main/java/com/ningdatech/pmapi/wps/manage/WpsConvertManage.java View File

@@ -0,0 +1,159 @@
package com.ningdatech.pmapi.wps.manage;

import cn.hutool.core.util.CharsetUtil;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.OSSObject;
import com.aliyun.oss.model.ObjectMetadata;
import com.ningdatech.file.properties.FileServerProperties;
import com.ningdatech.file.service.FileService;
import com.ningdatech.pmapi.wps.contants.WpsContant;
import com.suwell.ofd.custom.agent.AtomAgent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;

/**
* @Classname WpsConvertManage
* @Description
* @Date 2023/8/14 13:42
* @Author PoffyZhang
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class WpsConvertManage {

@Resource
private FileService fileService;

private final FileServerProperties fileServerProperties;

// HTTPAgent ha = new HTTPAgent("http://127.0.0.1:8090");
//2、定义方法实现 多个文件合并转为1个pdf文件
public String offs2Pdf() {
AtomAgent ha = new AtomAgent("http://10.53.157.47");

try {

//2-1、传参文件对象转换输出PDF文件
//1)、定义集合,存储待转换的原文件
List<File> fileList =new ArrayList<File>();
//2)、定义转换后的pdf文件输出流
OutputStream out = null;
//3)、添加原文件到集合
fileList.add(new File("/temp/111.xlsx"));
// fileList.add(new File("D:/cs.doc"));
// fileList.add(new File("D:/a.pdf"));
// fileList.add(new File("D:\\555.ofd"));
//4)、赋值转换后的pdf文件输出流
out=new FileOutputStream(new File("/temp/offices2_pdf.pdf"));
//5)、调用方法,执行将多个文件转为pdf文件
ha.OFDToPDF(fileList, out);

//2-2、传参文件流转换输出PDF文件(与2-1二选一即可)
//1)、定义集合,存储待转换的原文件(支持传文件流)
// Param[] params = new Param[] {
// new Param(PackEntry.wrap(new FileInputStream("D:\\temp\\111.ofd")), "ofd"),
// new Param(PackEntry.wrap(new FileInputStream("D:\\2.ofd")), "ofd"),
// new Param(PackEntry.wrap(new FileInputStream("D:\\T3.txt")), "txt")
// };
//2)、赋值转换后的pdf文件输出流
// out=new FileOutputStream(new File("D:/convert/offices_pdf.pdf"));
//3)、调用方法,执行将多个文件转为pdf文件
// ha.OFDToPDF(params,out);
return "转换成功";
} catch (Exception e) {
log.error(e.getMessage());
} finally {
try {
//2-6、关闭资源
ha.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return "转换失败";
}

public void downloadToPdfStream(Long fileId, HttpServletResponse response) {
com.ningdatech.file.entity.File file = fileService.getById(fileId);
downloadAndToPdf(file, response);
}

private void downloadAndToPdf(com.ningdatech.file.entity.File file, HttpServletResponse response) {
OSS oss = new OSSClientBuilder().build(fileServerProperties.getAli().getEndpoint(), fileServerProperties.getAli().getAccessKeyId(), fileServerProperties.getAli().getAccessKeySecret());
AtomAgent ha = new AtomAgent(WpsContant.WPS_CONVERT_URL_ONLINE);
try (OSSObject ossObject = oss.getObject(file.getBucket(), file.getPath());
InputStream stream = ossObject.getObjectContent();
ServletOutputStream outputStream = response.getOutputStream()) {
String filePath = WpsContant.FIX_FILE_PATH + file.getOriginalFileName();
convert(stream,filePath);
//转换PDF
List<File> fileList =new ArrayList<File>();
//2)、定义转换后的pdf文件输出流
OutputStream out = null;
//3)、添加原文件到集合
fileList.add(new File(filePath));
//4)、赋值转换后的pdf文件输出流
File pdfFile = new File(WpsContant.PDF_PATH);
out = new FileOutputStream(pdfFile);
//5)、调用方法,执行将多个文件转为pdf文件
ha.OFDToPDF(fileList, out);
FileInputStream fileInputStream = new FileInputStream(pdfFile);

ObjectMetadata metadata = ossObject.getObjectMetadata();
response.setContentType(WpsContant.PDF_CONTENT_TYPE);
String fileName = URLEncoder.encode(WpsContant.PDF_NAME, CharsetUtil.UTF_8);
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName);
byte[] bytes = new byte[4096];
int read;
while ((read = fileInputStream.read(bytes)) != -1) {
outputStream.write(bytes, 0, read);
}
outputStream.flush();
for(File f : fileList){
//用完就删
f.deleteOnExit();
}
}catch (Exception e){
log.error(e.getMessage());
}finally {
oss.shutdown();
try {
ha.close();
} catch (IOException e) {
log.error(e.getMessage());
}
}
}

public static void convert(InputStream inputStream, String filePath) {
try {
File file = new File(filePath);
FileOutputStream outputStream = new FileOutputStream(file);

int bytesRead;
byte[] buffer = new byte[1024];

while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}

outputStream.close();
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/wps/service/IConvertService.java View File

@@ -0,0 +1,5 @@
package com.ningdatech.pmapi.wps.service;

public interface IConvertService {

}

+ 19
- 0
pmapi/src/main/java/com/ningdatech/pmapi/wps/service/impl/ConvertService.java View File

@@ -0,0 +1,19 @@
package com.ningdatech.pmapi.wps.service.impl;

import com.ningdatech.pmapi.wps.service.IConvertService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
* @Classname ConvertService
* @Description
* @Date 2023/8/15 10:56
* @Author PoffyZhang
*/
@Service
@Slf4j
public class ConvertService implements IConvertService {



}

+ 2
- 0
pmapi/src/main/resources/security/auth-dev.yml View File

@@ -36,6 +36,7 @@ security:
- /file/download - /file/download
- /api/v1/zwdd/pull/** - /api/v1/zwdd/pull/**
- /api/v1/irs/** - /api/v1/irs/**
- /api/v1/wps-convert/**
ignore-csrf-urls: ignore-csrf-urls:
- /api/v1/user/auth/** - /api/v1/user/auth/**
- /v2/api-docs - /v2/api-docs
@@ -64,6 +65,7 @@ security:
- /file/download - /file/download
- /api/v1/zwdd/pull/** - /api/v1/zwdd/pull/**
- /api/v1/irs/** - /api/v1/irs/**
- /api/v1/wps-convert/**
role-map: role-map:
"engineer": "engineer":
"project_manager": "project_manager":


+ 2
- 0
pmapi/src/main/resources/security/auth-pre.yml View File

@@ -36,6 +36,7 @@ security:
- /file/download - /file/download
- /api/v1/zwdd/pull/** - /api/v1/zwdd/pull/**
- /api/v1/irs/** - /api/v1/irs/**
- /api/v1/wps-convert/**
ignore-csrf-urls: ignore-csrf-urls:
- /api/v1/user/auth/** - /api/v1/user/auth/**
- /v2/api-docs - /v2/api-docs
@@ -64,6 +65,7 @@ security:
- /file/download - /file/download
- /api/v1/zwdd/pull/** - /api/v1/zwdd/pull/**
- /api/v1/irs/** - /api/v1/irs/**
- /api/v1/wps-convert/**
role-map: role-map:
"engineer": "engineer":
"project_manager": "project_manager":


+ 2
- 0
pmapi/src/main/resources/security/auth-prod.yml View File

@@ -36,6 +36,7 @@ security:
- /file/download - /file/download
- /api/v1/zwdd/pull/** - /api/v1/zwdd/pull/**
- /api/v1/irs/** - /api/v1/irs/**
- /api/v1/wps-convert/**
ignore-csrf-urls: ignore-csrf-urls:
- /api/v1/user/auth/** - /api/v1/user/auth/**
- /v2/api-docs - /v2/api-docs
@@ -64,6 +65,7 @@ security:
- /file/download - /file/download
- /api/v1/zwdd/pull/** - /api/v1/zwdd/pull/**
- /api/v1/irs/** - /api/v1/irs/**
- /api/v1/wps-convert/**
role-map: role-map:
"engineer": "engineer":
"project_manager": "project_manager":


+ 60
- 0
pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest4.java View File

@@ -0,0 +1,60 @@
package com.ningdatech.pmapi.irs;

import com.ningdatech.irs.service.IRefreshTokenService;
import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.HttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.security.NoSuchAlgorithmException;
import java.util.Objects;

/**
* @Classname irsTest3
* @Description
* @Date 2023/7/25 9:52
* @Author PoffyZhang
*/
@Slf4j
public class irsTest4 extends AppTests {
@Resource
private IRefreshTokenService refreshTokenService;

@Value("${irs.interface-refresh.request-token-url}")
private String govRequestTokenUrl;
@Value("${irs.interface-refresh.refresh-token-url}")
private String govRefreshTokenUrl;

@Test
public void test1() throws NoSuchAlgorithmException {
long timestamp = System.currentTimeMillis();
String appSecret = "496f0f2a19994f76b4fd9dae087366c7";
String appKey = "A331101453557202109017383";
String dataName = "大数据管理局";

String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl,
"Fc3re2cq7r64Qfa7", HttpMethod.POST.name());
String sign = CryptUtils.MD5Encode(appKey + secret + timestamp);
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory();
RestTemplate restTemplate;
if(Objects.nonNull(factory)){
restTemplate = new RestTemplate(factory);
}else{
restTemplate = new RestTemplate();
}

String url = "https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm?" +
"dingCode=&matterName=&oid=&useState=1&limit=1000&page=1" +
"&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp;

ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
System.out.println(forEntity.getBody());
}
}

Loading…
Cancel
Save