Browse Source

Merge branch 'master' into state-region

master
PoffyZhang 1 year ago
parent
commit
a2b8d9531b
100 changed files with 4300 additions and 66 deletions
  1. +2
    -1
      ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java
  2. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java
  3. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java
  4. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java
  5. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java
  6. +86
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  7. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java
  8. +27
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/CodeUtil.java
  9. +68
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/CryptUtils.java
  10. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java
  11. +82
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/HmacAuthUtil.java
  12. +217
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/HttpUtil.java
  13. +46
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/Md5Utils.java
  14. +34
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/RefreshKeyUtil.java
  15. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java
  16. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java
  17. +18
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml
  18. +21
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java
  19. +10
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java
  20. +447
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java
  21. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.java
  22. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.xml
  23. +57
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/ProjectApplyBorrow.java
  24. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileListVO.java
  25. +24
    -12
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java
  26. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/INdProjectApplyBorrowService.java
  27. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/NdProjectApplyBorrowServiceImpl.java
  28. +9
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java
  29. +8
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java
  30. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.java
  31. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.xml
  32. +29
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/ProvincialGovBusinessStrip.java
  33. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IProvincialGovBusinessStripService.java
  34. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/ProvincialGovBusinessStripServiceImpl.java
  35. +44
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java
  36. +93
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java
  37. +55
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java
  38. +73
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java
  39. +44
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateStageNameEnum.java
  40. +44
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java
  41. +272
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java
  42. +155
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java
  43. +579
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java
  44. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.java
  45. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.xml
  46. +17
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.java
  47. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.xml
  48. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.java
  49. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.xml
  50. +17
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.java
  51. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.xml
  52. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java
  53. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml
  54. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java
  55. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml
  56. +22
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalProjectDTO.java
  57. +71
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java
  58. +66
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java
  59. +46
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java
  60. +45
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java
  61. +47
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java
  62. +58
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisal.java
  63. +40
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java
  64. +46
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java
  65. +49
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java
  66. +52
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java
  67. +59
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java
  68. +36
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java
  69. +38
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java
  70. +46
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectGroupVO.java
  71. +54
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java
  72. +60
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java
  73. +51
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java
  74. +48
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java
  75. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalApplicationService.java
  76. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectGroupService.java
  77. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectService.java
  78. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalService.java
  79. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java
  80. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateService.java
  81. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalApplicationServiceImpl.java
  82. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectGroupServiceImpl.java
  83. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectServiceImpl.java
  84. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalServiceImpl.java
  85. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java
  86. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java
  87. +1
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java
  88. +0
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  89. +21
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java
  90. +23
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java
  91. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java
  92. +38
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java
  93. +41
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java
  94. +55
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectCollectionController.java
  95. +8
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java
  96. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java
  97. +4
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java
  98. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java
  99. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java
  100. +116
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java

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

@@ -56,7 +56,8 @@ public class GeneratorCodeKingbaseConfig {
}

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

}

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java View File

@@ -39,6 +39,8 @@ public interface CommonConst {
String TITLE = "title";

String FILE_NAME_STR = "fileName";
String FILE_ID_STR = "fileId";
String ID_STR = "id";
String FILE_LIST = "fileList";
String ITEM_BASED = "依据项:";
String ITEM_BASED_FILE_NAME = "依据文件名:";


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java View File

@@ -24,6 +24,8 @@ public interface RegionConst {
* 丽水行政区划编码
*/
String RC_LS = "331100";
//遂昌县
String RC_SC = "331123";

/**
* 中国行政区划编码


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

@@ -28,7 +28,8 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
"com.ningdatech.pmapi.sms.controller",
"com.ningdatech.pmapi.workbench.controller",
"com.ningdatech.pmapi.ding.controller",
"com.ningdatech.pmapi.filemanage.controller"
"com.ningdatech.pmapi.filemanage.controller",
"com.ningdatech.pmapi.performance.controller"
})
public class GlobalResponseHandler implements ResponseBodyAdvice<Object> {



+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java View File

@@ -3,6 +3,9 @@ package com.ningdatech.pmapi.common.helper;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;

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

/**
* @author liuxinxin
* @date 2023/2/10 下午4:38
@@ -23,6 +26,8 @@ public interface UserInfoHelper {

UserFullInfoDTO getUserFullInfo(UserInfo userInfo);

List<UserFullInfoDTO> getUserFullInfos(List<UserInfo> userInfos);

String getUserName(Long userId);

/**
@@ -34,6 +39,8 @@ public interface UserInfoHelper {

UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode);

List<UserFullInfoDTO> getUserFullInfoByEmployeeCodes(Collection<String> employeeCodes);

/**
* 获取用户任职所在单位code
*


+ 86
- 3
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java View File

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
@@ -21,10 +22,9 @@ import com.ningdatech.pmapi.user.service.IUserInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* @author liuxinxin
@@ -127,6 +127,83 @@ public class UserInfoHelperImpl implements UserInfoHelper {
return userFullInfo;
}

/**
* 批量查询 这里 会没有角色
* @param userInfos
* @return
*/
@Override
public List<UserFullInfoDTO> getUserFullInfos(List<UserInfo> userInfos) {
List<UserFullInfoDTO> res = Lists.newArrayList();

if(CollUtil.isEmpty(userInfos)){
return res;
}

Map<String,UserInfo> userMap = userInfos.stream().collect(Collectors.toMap(UserInfo::getEmployeeCode,e->e));

// 获取浙政钉雇员信息 组织信息
List<String> employeeCodes = userInfos.stream().map(UserInfo::getEmployeeCode).collect(Collectors.toList());
if (CollUtil.isNotEmpty(employeeCodes)) {
List<DingEmployeeInfo> dingEmployeeInfoList = iDingEmployeeInfoService
.list(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.in(DingEmployeeInfo::getEmployeeCode, employeeCodes)
.eq(DingEmployeeInfo::getMainJob, "true"));

if(CollUtil.isEmpty(dingEmployeeInfoList)){
return res;
}

// 装配用户任职所在单位
List<String> empPosUnitCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getEmpPosUnitCode).collect(Collectors.toList());
List<String> orgCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getOrganizationCode).collect(Collectors.toList());
List<String> allOrgCodes = Stream.concat(empPosUnitCodes.stream(),orgCodes.stream()).collect(Collectors.toList());
if (CollUtil.isEmpty(allOrgCodes)) {
return res;
}
List<DingOrganization> dingOrganizations = iDingOrganizationService.listByCodes(allOrgCodes);
if (CollUtil.isEmpty(dingOrganizations)) {
return res;
}
Map<String,DingOrganization> orgMap = dingOrganizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode,d -> d));

res = dingEmployeeInfoList.stream().map(e -> {
UserFullInfoDTO userFullInfo = new UserFullInfoDTO();
if(orgMap.containsKey(e.getEmpPosUnitCode())){
DingOrganization organization = orgMap.get(e.getEmpPosUnitCode());
userFullInfo.setEmpPosUnitCode(e.getEmpPosUnitCode());
userFullInfo.setEmpPosUnitName(organization.getOrganizationName());
userFullInfo.setRegionCode(organization.getDivisionCode());
}
if(orgMap.containsKey(e.getOrganizationCode())){
DingOrganization organization = orgMap.get(e.getOrganizationCode());
userFullInfo.setOrganizationCode(organization.getOrganizationCode());
userFullInfo.setOrganizationName(organization.getOrganizationName());
// 测试使用
userFullInfo.setRegionLevel(3);
}

if(userMap.containsKey(e.getEmployeeCode())){
UserInfo userInfo = userMap.get(e.getEmployeeCode());
// 装配返回
userFullInfo.setUserId(userInfo.getId());
userFullInfo.setIdentifier(userInfo.getRealName());
userFullInfo.setRealName(userInfo.getRealName());
userFullInfo.setEmployeeCode(e.getEmployeeCode());
userFullInfo.setUsername(userInfo.getRealName());
userFullInfo.setMobile(userInfo.getMobile());
userFullInfo.setAccountId(userInfo.getAccountId());
String available = userInfo.getAvailable();
if (StringUtils.isNotBlank(available)) {
userFullInfo.setAvailable(UserAvailableEnum.valueOf(available));
}
}
return userFullInfo;
}).collect(Collectors.toList());
}
return res;
}

@Override
public String getUserName(Long userId) {
UserFullInfoDTO userFullInfo = getUserFullInfo(userId);
@@ -154,6 +231,12 @@ public class UserInfoHelperImpl implements UserInfoHelper {
}

@Override
public List<UserFullInfoDTO> getUserFullInfoByEmployeeCodes(Collection<String> employeeCodes) {
List<UserInfo> userInfos = userInfoService.getUserInfoByEmployeeCodes(employeeCodes);
return getUserFullInfos(userInfos);
}

@Override
public String getUserEmpPosUnitCode(Long userId) {
UserFullInfoDTO userFullInfo = getUserFullInfo(userId);
return userFullInfo.getEmpPosUnitCode();


+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java View File

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

import cn.hutool.core.util.StrUtil;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.NumberUtils;

@@ -109,4 +110,10 @@ public class BizUtils {
return strings.stream().map(w -> "'" + w + "'").collect(Collectors.joining(StrPool.COMMA, StrPool.LEFT_BRACKET, StrPool.RIGHT_BRACKET));
}

public static String getProjectTypeName(Integer projectType) {
if (Objects.nonNull(projectType)) {
return ProjectTypeEnum.getDesc(projectType);
}
return StringUtils.EMPTY;
}
}

+ 27
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/util/CodeUtil.java View File

@@ -0,0 +1,27 @@
package com.ningdatech.pmapi.common.util;

import com.ningdatech.basic.util.StrPool;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.Collectors;

/**
* @Classname CodeUtil
* @Description
* @Date 2023/6/20 16:06
* @Author PoffyZhang
*/
@Slf4j
public class CodeUtil {

public static Collection<String> convertStrToList(String str) {
if(StringUtils.isBlank(str)){
return Collections.emptyList();
}
return Arrays.stream(str.split(StrPool.COMMA)).collect(Collectors.toList());
}
}

+ 68
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/util/CryptUtils.java View File

@@ -0,0 +1,68 @@
package com.ningdatech.pmapi.common.util;
import org.apache.commons.codec.binary.Hex;

import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* 加密工具
* @author hank
*/
public class CryptUtils {
/**
* 默认的算法
*/
private static final String DE_KEY_MAC = "HmacMD5";
/**
* 默认的字符集
*/
private static final Charset DE_CHARSET = StandardCharsets.UTF_8;
/**
* 使用默认的算法(HmacMD5) 得到hmac 16进制字符串
* @param inputStr 需要加密的串
* @param key key
* @return 16进制字符串
* @throws Exception
*/
public static String encryptHMAC(String inputStr, String key) throws Exception {
return encryptHMAC(inputStr, key, DE_KEY_MAC);
}
/**
* 使用指定的算法得到hmac 16进制字符串
* @param inputStr 需要加密的串
* @param key key
* @param keyMac hmac算法
* @return 16进制字符串
* @throws Exception
*/
public static String encryptHMAC(String inputStr, String key, String keyMac) throws Exception {
return Hex.encodeHexString(encryptHMAC(inputStr.getBytes(DE_CHARSET), key, keyMac));
}
public static String MD5Encode(String origin) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
return Hex.encodeHexString(md.digest(origin.getBytes(DE_CHARSET)));
}
private static byte[] encryptHMAC(byte[] data, String key, String keyMac) throws Exception {
SecretKey secretKey = new SecretKeySpec(key.getBytes(DE_CHARSET), keyMac);
Mac mac = Mac.getInstance(secretKey.getAlgorithm());
mac.init(secretKey);
return mac.doFinal(data);
}
public static void main(String[] args) throws Exception{
System.out.println("HMACStr:\n" + encryptHMAC("a", "hank"));
}
}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java View File

@@ -46,7 +46,7 @@ import org.assertj.core.util.Lists;
@Slf4j
public class ExcelDownUtil {

private static String encodeName(String name) {
public static String encodeName(String name) {
String fileName;
try {
fileName = URLEncoder.encode(name, "UTF-8");


+ 82
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/util/HmacAuthUtil.java View File

@@ -0,0 +1,82 @@
package com.ningdatech.pmapi.common.util;

import javafx.util.Pair;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.bind.DatatypeConverter;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

public class HmacAuthUtil {
/**
* 构造http请求 header
*
* @param url 请求url,全路径格式,比如:https://bcdsg.zj.gov.cn/api/p/v1/user.get
* @param requestMethod 请求方法,大写格式,如:GET, POST
* @param accessKey 应用的 AK
* @param secretKey 应用的 SK
* @return
*/
public static Map<String, String> generateHeader(String url, String requestMethod, String accessKey, String secretKey) {
Map<String, String> header = new HashMap<>();
try {
DateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
String date = dateFormat.format(new Date());
URI uri = URI.create(url);
String canonicalQueryString = getCanonicalQueryString(uri.getQuery());
String message = requestMethod.toUpperCase() + "\n" + uri.getPath() + "\n" + canonicalQueryString + "\n" + accessKey + "\n" + date + "\n";
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(secretKey.getBytes(), "HmacSHA256"));
byte[] hash = mac.doFinal(message.getBytes());
// to lowercase hexits
DatatypeConverter.printHexBinary(hash);
// to base64
String sign = DatatypeConverter.printBase64Binary(hash);
header.put("X-BG-HMAC-SIGNATURE", sign);
header.put("X-BG-HMAC-ALGORITHM", "hmac-sha256");
header.put("X-BG-HMAC-ACCESS-KEY", accessKey);
header.put("X-BG-DATE-TIME", date);
System.out.println(date);
} catch (Exception e) {
throw new RuntimeException("generate jc brain header error", e);
}
return header;
}

private static String getCanonicalQueryString(String query) {
if (query == null || query.trim().length() == 0) {
return "";
}
List<Pair<String, String>> queryParamList = new ArrayList<>();
String[] params = query.split("&");
for (String param : params) {
String[] keyValue = param.split("=");
Pair<String, String> pair = new Pair<String, String>(keyValue[0], keyValue.length > 1 ? keyValue[1] : "");
queryParamList.add(pair);
}
List<Pair<String, String>> sortedParamList = queryParamList.stream().sorted(Comparator.comparing(param -> param.getKey() + "=" + Optional.ofNullable(param.getValue()).orElse(""))).collect(Collectors.toList());
List<Pair<String, String>> encodeParamList = new ArrayList<>();
sortedParamList.stream().forEach(param -> {
try {
String key = URLEncoder.encode(param.getKey(), "utf-8");
String value = URLEncoder.encode(Optional.ofNullable(param.getValue()).orElse(""), "utf-8");
encodeParamList.add(new Pair<>(key, value));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("encoding error");
}
});
StringBuilder queryParamString = new StringBuilder(64);
for (Pair<String, String> encodeParam : encodeParamList) {
queryParamString.append(encodeParam.getKey()).append("=").append(Optional.ofNullable(encodeParam.getValue()).orElse(""));
queryParamString.append("&");
}
return queryParamString.substring(0, queryParamString.length() - 1);
}
}

+ 217
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/util/HttpUtil.java View File

@@ -0,0 +1,217 @@
package com.ningdatech.pmapi.common.util;

import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
import org.apache.http.conn.util.PublicSuffixMatcher;
import org.apache.http.conn.util.PublicSuffixMatcherLoader;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HttpUtil {
private Logger logger = LoggerFactory.getLogger(getClass());
private RequestConfig requestConfig = RequestConfig.custom()
.setSocketTimeout(15000)
.setConnectTimeout(15000)
.setConnectionRequestTimeout(15000)
.build();
private static HttpUtil instance = null;
private HttpUtil(){}

public static HttpUtil getInstance(){
if (instance == null) {
instance = new HttpUtil();
}
return instance;
}

/**
* 发送 post 请求
* @param httpUrl 地址
*/
public String sendHttpPost(String httpUrl) {
HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost
return sendHttpPost(httpPost);
}

/**
* 发送 post 请求
* @param httpUrl 地址
* @param params 参数(格式:key1=value1&key2=value2)
*/
public String sendHttpPost(String httpUrl, String params) {
HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost
try {
//设置参数
StringEntity stringEntity = new StringEntity(params, "UTF-8");
stringEntity.setContentType("application/x-www-form-urlencoded");
httpPost.setEntity(stringEntity);
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return sendHttpPost(httpPost);
}

/**
* 发送 post 请求
* @param httpUrl 地址
* @param maps 参数
*/
public String sendHttpPost(String httpUrl, Map<String, String> maps) {
HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost
// 创建参数队列
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
for (String key : maps.keySet()) {
nameValuePairs.add(new BasicNameValuePair(key, maps.get(key)));
}
try {
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return sendHttpPost(httpPost);
}

/**
* 发送 Post请求
* @param httpPost
*@return
*/
private String sendHttpPost(HttpPost httpPost) {
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
HttpEntity entity = null;
String responseContent = null;
try {
// 创建默认的 httpClient 实例.
httpClient = HttpClients.createDefault();
httpPost.setConfig(requestConfig);
// 执行请求
response = httpClient.execute(httpPost);
entity = response.getEntity();
responseContent = EntityUtils.toString(entity, "UTF-8");
} catch (Exception e) {
logger.error(e.getMessage(),e);
} finally {
try {
// 关闭连接,释放资源
if (response != null) {
response.close();
}
if (httpClient != null) {
httpClient.close();
}
} catch (IOException e) {
logger.error(e.getMessage(),e);
}
}
return responseContent;
}

/**
* 发送 get 请求
* @param httpUrl
*/
public String sendHttpGet(String httpUrl) {
HttpGet httpGet = new HttpGet(httpUrl);// 创建 get 请求
return sendHttpGet(httpGet);
}

/**
* 发送 get请求 Https
* @param httpUrl
*/
public String sendHttpsGet(String httpUrl) {
HttpGet httpGet = new HttpGet(httpUrl);// 创建 get 请求
return sendHttpsGet(httpGet);
}

/**
* 发送 Get请求
* @param httpGet
*@return
*/
private String sendHttpGet(HttpGet httpGet) {
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
HttpEntity entity = null;
String responseContent = null;
try {
// 创建默认的 httpClient 实例.
httpClient = HttpClients.createDefault();
httpGet.setConfig(requestConfig);
// 执行请求
response = httpClient.execute(httpGet);
entity = response.getEntity();
responseContent = EntityUtils.toString(entity, "UTF-8");
} catch (Exception e) {
logger.error(e.getMessage(),e);
} finally {
try {
// 关闭连接,释放资源
if (response != null) {
response.close();
}
if (httpClient != null) {
httpClient.close();
}
} catch (IOException e) {
logger.error(e.getMessage(),e);
}
}
return responseContent;
}

/**
* 发送 Get请求 Https
*@return
*/
private String sendHttpsGet(HttpGet httpGet) {
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
HttpEntity entity = null;
String responseContent = null;
try {
// 创建默认的 httpClient 实例.
PublicSuffixMatcher publicSuffixMatcher = PublicSuffixMatcherLoader.load(new
URL(httpGet.getURI().toString()));
DefaultHostnameVerifier hostnameVerifier = new DefaultHostnameVerifier(publicSuffixMatcher);
httpClient = HttpClients.custom().setSSLHostnameVerifier(hostnameVerifier).build();
httpGet.setConfig(requestConfig);
// 执行请求
response = httpClient.execute(httpGet);
entity = response.getEntity();
responseContent = EntityUtils.toString(entity, "UTF-8");
} catch (Exception e) {
logger.error(e.getMessage(),e);
} finally {
try {
// 关闭连接,释放资源
if (response != null) {
response.close();
}
if (httpClient != null) {
httpClient.close();
}
} catch (IOException e) {
logger.error(e.getMessage(),e);
}
}
return responseContent;
}
}

+ 46
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/util/Md5Utils.java View File

@@ -0,0 +1,46 @@
package com.ningdatech.pmapi.common.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.security.MessageDigest;

public class Md5Utils {
private static final Logger LOGGER = LoggerFactory.getLogger(Md5Utils.class);
public static byte[] md5(String s) {
MessageDigest algorithm;
try {
algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(s.getBytes("UTF-8"));
byte[] messageDigest = algorithm.digest();
return messageDigest;
} catch (Exception e) {
LOGGER.error("MD5 Error...", e);
}
return null;
}
private static final String toHex(byte hash[]) {
if (hash == null) {
return null;
}
StringBuffer buf = new StringBuffer(hash.length * 2);
int i;
for (i = 0; i < hash.length; i++) {
if ((hash[i] & 0xff) < 0x10) {
buf.append("0");
}
buf.append(Long.toString(hash[i] & 0xff, 16));
}
return buf.toString();
}

public static String hash(String s) {
try {
return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8");
} catch (Exception e) {
LOGGER.error("not supported charset...{}", e);
return s;
}
}
}

+ 34
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/util/RefreshKeyUtil.java View File

@@ -0,0 +1,34 @@
package com.ningdatech.pmapi.common.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;

import java.util.Objects;

/**
* @Classname RefreshKeyUtil
* @Description
* @Date 2023/6/27 10:03
* @Author PoffyZhang
*/
@Slf4j
public class RefreshKeyUtil {
public static String getRequestSecret(String appKey, String appSecret) {
Long requestTime = System.currentTimeMillis();
// 刷新秘钥
HttpUtil httpUtil = HttpUtil.getInstance();
log.info("请求密钥" + appSecret);
String refreshSign = Md5Utils.hash (appKey + appSecret + requestTime);
String refreshUrl = String.format ("http://59.202.38.178/gateway/app/refreshTokenByKey.htm" +
"?appKey=%s&requestTime=%s&sign=%s", appKey, requestTime +"",refreshSign);
log.info(refreshUrl);
String result = httpUtil.sendHttpGet(refreshUrl);
log.info(result);
JSONObject dataJson = JSON.parseObject(result).getJSONObject("datas");
if(Objects.nonNull(dataJson)){
return dataJson.getString("requestSecret");
}
return result;
}
}

+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java View File

@@ -103,6 +103,9 @@ public class ExpertAdminExpertManageAssembler {
}

public List<DictionaryFieldInfo> assembleDictionaryName(List<DictionaryFieldInfo> collect) {
if (CollectionUtil.isEmpty(collect)){
return new ArrayList<>();
}
return collect.stream().peek(r -> {
DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode());
if (Objects.nonNull(dictionaryDTO)) {
@@ -113,6 +116,9 @@ public class ExpertAdminExpertManageAssembler {


public List<TagFieldInfo> assembleTagName(List<TagFieldInfo> collect) {
if (CollectionUtil.isEmpty(collect)){
return new ArrayList<>();
}
return collect.stream().peek(r -> {
TagDTO tagDTO = tagCache.getByTagCode(r.getTagCode());
if (Objects.nonNull(tagDTO)) {


+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java View File

@@ -18,4 +18,10 @@ public interface ExpertAdminManageMapper {
* @return
*/
List<Long> listExpertUserId(@Param("query") ListExpertQuery query);

List<Long> listExpertDictionaryUserId(@Param("query") ListExpertQuery query);

List<Long> listExpertTagUserId(@Param("query") ListExpertQuery query);


}

+ 18
- 8
pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml View File

@@ -103,14 +103,24 @@
<select id="listExpertUserId" resultType="java.lang.Long"
parameterType="com.ningdatech.pmapi.expert.model.query.ListExpertQuery">
<include refid="Expert_Full_Info_Region"/>
<if test="query.expertTagQueryList != null and query.expertTagQueryList.size >0 ">
INTERSECT
<include refid="Expert_Tag_Relation"/>
</if>
<if test="query.expertDictionaryQueryList != null and query.expertDictionaryQueryList.size >0 ">
INTERSECT
<include refid="Expert_Dictionary_Relation"/>
</if>
<!-- <if test="query.expertTagQueryList != null and query.expertTagQueryList.size >0 ">-->
<!-- INTERSECT-->
<!-- <include refid="Expert_Tag_Relation"/>-->
<!-- </if>-->
<!-- <if test="query.expertDictionaryQueryList != null and query.expertDictionaryQueryList.size >0 ">-->
<!-- INTERSECT-->
<!-- <include refid="Expert_Dictionary_Relation"/>-->
<!-- </if>-->
</select>

<select id="listExpertDictionaryUserId" resultType="java.lang.Long"
parameterType="com.ningdatech.pmapi.expert.model.query.ListExpertQuery">
<include refid="Expert_Dictionary_Relation"/>
</select>

<select id="listExpertTagUserId" resultType="java.lang.Long"
parameterType="com.ningdatech.pmapi.expert.model.query.ListExpertQuery">
<include refid="Expert_Tag_Relation"/>
</select>

</mapper>

+ 21
- 2
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java View File

@@ -13,6 +13,8 @@ import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.mapper.ExpertAdminManageMapper;
import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd;
import com.ningdatech.pmapi.expert.model.dto.ExpertAdminExpertManageListDTO;
import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery;
import com.ningdatech.pmapi.expert.model.query.ExpertTagQuery;
import com.ningdatech.pmapi.expert.model.query.ListExpertQuery;
import com.ningdatech.pmapi.expert.service.ExpertAdminManageService;
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
@@ -42,11 +44,28 @@ public class ExpertAdminManageServiceImpl implements ExpertAdminManageService {
private final IExpertTagService iExpertTagService;
private final ExpertAdminManageMapper expertAdminManageMapper;

private List<Long> listExpertUserId(ListExpertQuery listExpertQuery) {
List<Long> userIdList = expertAdminManageMapper.listExpertUserId(listExpertQuery);

List<ExpertTagQuery> expertTagQueryList = listExpertQuery.getExpertTagQueryList();
if (CollectionUtils.isNotEmpty(expertTagQueryList)) {
List<Long> tagUserIdList = expertAdminManageMapper.listExpertTagUserId(listExpertQuery);
userIdList.retainAll(tagUserIdList);
}

List<ExpertDictionaryQuery> expertDictionaryQueryList = listExpertQuery.getExpertDictionaryQueryList();
if (CollectionUtils.isNotEmpty(expertDictionaryQueryList)) {
List<Long> dictionaryUserIdList = expertAdminManageMapper.listExpertDictionaryUserId(listExpertQuery);
userIdList.retainAll(dictionaryUserIdList);
}
return userIdList;
}


@Override
public CommonPage<ExpertAdminExpertManageListDTO> getExpertLibraryList(ExpertAdminExpertManageQueryCmd req) {
ListExpertQuery listExpertQuery = buildListExpertQuery(req);
List<Long> userIdList = expertAdminManageMapper.listExpertUserId(listExpertQuery);
List<Long> userIdList = listExpertUserId(listExpertQuery);

List<ExpertUserFullInfo> evidenceHasBeenSubmittedExpertInfoList = iExpertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class)
.eq(ExpertUserFullInfo::getUserInfoStep, ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey()));
@@ -113,6 +132,6 @@ public class ExpertAdminManageServiceImpl implements ExpertAdminManageService {
@Override
public List<Long> filterExpertUserIdList(ExpertAdminExpertManageQueryCmd queryCmd) {
ListExpertQuery listExpertQuery = buildListExpertQuery(queryCmd);
return expertAdminManageMapper.listExpertUserId(listExpertQuery);
return listExpertUserId(listExpertQuery);
}
}

+ 10
- 1
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java View File

@@ -12,6 +12,8 @@ import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
* @Classname ProjectFileController
* @Description
@@ -43,6 +45,13 @@ public class ProjectFileController {
@ApiOperation(value = "申请借阅", notes = "申请借阅")
@WebLog("档案管理-项目档案-申请借阅")
public String wantRead(@PathVariable Long projectId){
return projectFileManage.wantRead(projectId);
String instanceId = projectFileManage.startApplyBorrowProcess(projectId);
return "启动申请借阅流程实例 【" + instanceId + "】 成功";
}

@PostMapping("/download/{projectId}")
@ApiOperation(value = "档案下载",notes = "档案下载")
public void downloadFile(@PathVariable Long projectId,HttpServletResponse response){
projectFileManage.downloadFile(projectId, response);
}
}

+ 447
- 5
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java View File

@@ -1,22 +1,86 @@
package com.ningdatech.pmapi.filemanage.manage;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.file.entity.File;
import com.ningdatech.file.service.FileService;
import com.ningdatech.file.utils.StrPool;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.expert.manage.ExpertReviewManage;
import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO;
import com.ningdatech.pmapi.expert.model.vo.ProjectReviewDetailVO;
import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow;
import com.ningdatech.pmapi.filemanage.model.param.ProjectFileListParam;
import com.ningdatech.pmapi.filemanage.model.vo.ProjectFileListVO;
import com.ningdatech.pmapi.filemanage.model.vo.ProjectFileVO;
import com.ningdatech.pmapi.filemanage.service.INdProjectApplyBorrowService;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.projectdeclared.manage.ConstructionManage;
import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage;
import com.ningdatech.pmapi.projectdeclared.manage.FinalAcceptanceManage;
import com.ningdatech.pmapi.projectdeclared.manage.PurchaseManage;
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract;
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase;
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.FinalAcceptanceVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO;
import com.ningdatech.pmapi.projectdeclared.service.IContractService;
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService;
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum;
import com.ningdatech.pmapi.sys.manage.NoticeManage;
import com.ningdatech.pmapi.todocenter.constant.WorkNoticeContant;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.bean.entity.WflowModels;
import com.wflow.contants.HisProInsEndActId;
import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
import com.wflow.workflow.bean.process.FileBasicInfo;
import com.wflow.workflow.bean.process.ProcessComment;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
import com.wflow.workflow.service.ProcessInstanceService;
import com.wflow.workflow.service.ProcessModelService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.HistoryService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.task.Comment;
import org.springframework.stereotype.Component;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

/**
* @Classname ProjectFileManage
@@ -30,39 +94,417 @@ import java.util.stream.Collectors;
public class ProjectFileManage {

private final IProjectService projectService;

private final ProjectLibManage projectLibManage;
private final UserInfoHelper userInfoHelper;
private final ProcessModelService processModelService;
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;
private final ProcessInstanceService processInstanceService;
private final NoticeManage noticeManage;
private final IProjectInstService projectInstService;
private final HistoryService historyService;
private final INdProjectApplyBorrowService projectApplyBorrowService;
private final IDingOrganizationService dingOrganizationService;
private final IProjectApplicationService projectApplicationService;
private final TaskService taskService;
private final IPurchaseService purchaseService;
private final IContractService contractService;
private final ExpertReviewManage expertReviewManage;
private final FileService fileService;
private final PurchaseManage purchaseManage;
private final ConstructionManage constructionManage;
private final FinalAcceptanceManage finalAcceptanceManage;

public PageVo<ProjectFileListVO> list(ProjectFileListParam param) {

UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
String employeeCode = userFullInfo.getEmployeeCode();
String empPosUnitCode = userFullInfo.getEmpPosUnitCode();

Page<Project> page = param.page();
projectService.page(page,Wrappers.lambdaQuery(Project.class)
.like(StringUtils.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName())
.like(StringUtils.isNotBlank(param.getBuildOrgName()),Project::getBuildOrgName,param.getBuildOrgName())
.eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode())
.orderByDesc(Project::getUpdateOn));

if(0L == page.getTotal()){
return PageVo.empty();
}

// 获取本单位及下属单位的单位code
Set<String> subOrgSet = getSubOrgList(empPosUnitCode);

List<ProjectFileListVO> vos = page.getRecords().stream().map(p -> {
ProjectFileListVO vo = new ProjectFileListVO();
vo.setId(p.getId());
vo.setCanRead(Boolean.TRUE);
// 用户只可查阅自己及下属单位的项目档案和已经申请借阅通过的项目档案
if (subOrgSet.contains(p.getBuildOrgCode()) || checkCanRead(subOrgSet,p)) {
vo.setCanRead(Boolean.TRUE);
}
vo.setBuildOrgName(p.getBuildOrgName());
vo.setPojectCode(p.getProjectCode());
vo.setProjectName(p.getProjectName());
// 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成
String instCode = p.getInstCode();
// 获取流程实例
HistoricProcessInstance newInstance =
historyService.createHistoricProcessInstanceQuery().processInstanceId(instCode).singleResult();
ProjectInst projectInst = projectInstService
.getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode));
// 推送省局联审的项目流程实例为EMPTY
if (Objects.nonNull(projectInst)) {
Integer instType = projectInst.getInstType();
// 从申请借阅信息表中查询当前项目是否有当前登录用户发起的申请借阅审批流程
ProjectApplyBorrow applyBorrow = projectApplyBorrowService.getOne(Wrappers
.lambdaQuery(ProjectApplyBorrow.class).eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode)
.eq(ProjectApplyBorrow::getProjectId, p.getId()).eq(ProjectApplyBorrow::getInstanceId, instCode));
if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.getCode().equals(instType)
&& !HisProInsEndActId.END.equals(newInstance.getEndActivityId())) {
vo.setCanApplyBorrow(Boolean.FALSE);
}
}
return vo;
}).collect(Collectors.toList());
return PageVo.of(vos,page.getTotal());

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

private boolean checkCanRead(Set<String> subOrgSet, Project project) {
// 从申请借阅信息表中查出本单位及下属单位审批通过的项目
HashSet<Long> borrowProjectIdSet = new HashSet<>();
List<Long> applyBorrowProjectIdList = projectApplyBorrowService
.list(Wrappers.lambdaQuery(ProjectApplyBorrow.class)
.in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet)
.eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE))
.stream().map(ProjectApplyBorrow::getProjectId).filter(borrowProjectIdSet::add).collect(Collectors.toList());
return applyBorrowProjectIdList.contains(project.getId());
}

private Set<String> getSubOrgList(String empPosUnitCode) {
HashSet<String> orgSet = new HashSet<>();
// 先将自己加入子集
orgSet.add(empPosUnitCode);
Set<String> subOrgList = dingOrganizationService
.list(Wrappers.lambdaQuery(DingOrganization.class).eq(DingOrganization::getParentCode, empPosUnitCode))
.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toSet());
// 遍历子集
for (String orgCode : subOrgList) {
orgSet.addAll(getSubOrgList(orgCode));
}
return orgSet;
}

public ProjectFileVO file(Long projectId) {

UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
String empPosUnitCode = userFullInfo.getEmpPosUnitCode();

// 判断该项目是否为本单位或下属单位的项目或者已经申请借阅成功的项目
Project project = projectService.getById(projectId);
Set<String> subOrgList = getSubOrgList(empPosUnitCode);

if (!checkCanRead(subOrgList,project)){
throw new BizException("您没有权限查看此项目档案!");
}
ProjectFileVO projectFileVo = new ProjectFileVO();
String projectCode = project.getProjectCode();
ProjectDetailVO projectDetailVo = projectLibManage.getProjectDetail(projectId);
List<ProcessDetailVO> processDetailVos = projectLibManage.processScheduleDetail(projectId);
ProjectReviewDetailVO projectReviewDetailVo = expertReviewManage.projectExpertReviewDetail(projectCode);
PurchaseVO purchaseVo = purchaseManage.detailByProjectId(projectId);
ContractVO contractVo = constructionManage.detailContractByProjectId(projectId);
PreInsVO preInsVo = constructionManage.detailPreInsByProjectId(projectId);
FinalAcceptanceVO finalAcceptanceVo = finalAcceptanceManage.detailByProjectId(projectId);

projectFileVo.setProjectDetailVo(projectDetailVo);
projectFileVo.setProcessDetailVos(processDetailVos);
projectFileVo.setProjectReviewDetailVo(projectReviewDetailVo);
projectFileVo.setPurchaseVo(purchaseVo);
projectFileVo.setContractVo(contractVo);
projectFileVo.setPreInsVo(preInsVo);
projectFileVo.setFinalAcceptanceVo(finalAcceptanceVo);

return null;
return projectFileVo;
}

public String wantRead(Long projectId) {
return "申请成功";
}

public String startApplyBorrowProcess(Long projectId) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
String employeeCode = user.getEmployeeCode();
VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!");

Project project = projectService.getNewProject(projectId);
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!");

// 首先要判断 项目当前状态 是不是 已归档
VUtils.isTrue(!ProjectStatusEnum.ACCEPTED.getCode().equals(project.getStatus())).throwMessage("提交失败 该项目不是 已归档");

String regionCode = user.getRegionCode();

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getRegionCode, regionCode)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_BORROW.getCode()).last(BizConst.LIMIT_1));

if (Objects.isNull(model)) {
log.error("此 【{}】区域找不到申请借阅流程配置", regionCode);
throw new BusinessException(String.format("此 【%s】区域找不到申请借阅流程配置", regionCode));
}

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode));
params.setProcessUsers(Collections.emptyMap());
// 放入条件判断的项目字段
// 把条件值给放入工作流
defaultDeclaredProjectManage.buildCondition(params, project);
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, project);
String instanceId =
processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap);
log.info("申请借阅申报成功 【{}】", instanceId);

// 保存项目借阅实例相关
projectLibManage.saveProjectByApplyBorrow(project, user, instanceId);

// 发送给第一个审批人消息
noticeManage.sendFirtUser(project, model.getFormName(), instanceId, WorkNoticeContant.PASS_MSG_TEMPLATE,
MsgTypeEnum.PROJECT_REVIEW);

return instanceId;
}

public void downloadFile(Long projectId, HttpServletResponse response) {
Project project = projectService.getById(projectId);
// 获取项目各阶段上传文件ID
List<Long> fileIdList = Lists.newArrayList();
getProjectAppendix(project, fileIdList);

String zipFileName = "项目档案";

// 设置response的header
response.setContentType("application/zip");
response.setHeader("Content-disposition",
"attachment;filename*=utf-8''" + ExcelDownUtil.encodeName(zipFileName) + ".zip");

try {
// 创建ZipOutputStream
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
if (CollUtil.isNotEmpty(fileIdList)) {
// 获取文件输入流
for (Long fileId : fileIdList) {
File file = fileService.getById(fileId);
// 文件不存在,跳过
if (Objects.isNull(file)) {
continue;
}
String originalFileName = file.getOriginalFileName();
String name = originalFileName.substring(0, originalFileName.indexOf(StrPool.DOT));
String fileName = name + StrPool.UNDERSCORE + fileId
+ originalFileName.substring(originalFileName.indexOf(StrPool.DOT));
InputStream fileInputStream = fileService.getFileInputStream(file);
// 文件
ZipEntry zipEntry = new ZipEntry(fileName);
zos.putNextEntry(zipEntry);
byte[] bytes = new byte[1024];
int length;
while ((length = fileInputStream.read(bytes)) >= 0) {
zos.write(bytes, 0, length);
}
fileInputStream.close();
zos.closeEntry();
}
zos.close();
}
} catch (IOException e) {
throw new BizException(e.getMessage());
}
}

private void getProjectAppendix(Project project, List<Long> fileIdList) {
Long projectId = project.getId();
// 项目申报阶段
// 获取立项依据
String buildBasis = project.getBuildBasis();
List<JSONObject> buildBasisFileArray = JSON.parseArray(buildBasis, JSONObject.class);
for (JSONObject jsonObject : buildBasisFileArray) {
String fileInfo = jsonObject.getString(CommonConst.FILE_LIST);
List<Long> buildBasisFileIdList = getFileIdList(fileInfo);
fileIdList.addAll(buildBasisFileIdList);
}
// 获取附件-初步方案
String preliminaryPlanFile = project.getPreliminaryPlanFile();
List<Long> prePlanFileIdList = getFileIdList(preliminaryPlanFile);
fileIdList.addAll(prePlanFileIdList);
// 获取附件-佐证材料
String supMaterialsFile = project.getSupportingMaterialsFile();
List<Long> supMaterialFileIdList = getFileIdList(supMaterialsFile);
fileIdList.addAll(supMaterialFileIdList);
// 获取附件-项目总投资测算明细
String calTotalInvestFile = project.getCalculationTotalInvestmentFile();
List<Long> calTotalInvestFileIdList = getFileIdList(calTotalInvestFile);
fileIdList.addAll(calTotalInvestFileIdList);
// 获取附件-申报单位主要职责(单位三定方案)
String mainResAppFile = project.getMainResponsibilitiesApplicantFile();
List<Long> mainResAppFileIdList = getFileIdList(mainResAppFile);
fileIdList.addAll(mainResAppFileIdList);
// 获取附件-项目申报书
String projectApplicationForm = project.getProjectApplicationForm();
List<Long> projectAppFormFileIdList = getFileIdList(projectApplicationForm);
fileIdList.addAll(projectAppFormFileIdList);
// 获取项目应用信息中的文件
List<ProjectApplication> applicationList = projectApplicationService
.list(Wrappers.lambdaQuery(ProjectApplication.class).eq(ProjectApplication::getProjectId, projectId));
for (ProjectApplication projectApplication : applicationList) {
// 获取试点文件
String experimentsFile = projectApplication.getExperimentsFile();
List<Long> experimentsFileIdList = getFileIdList(experimentsFile);
fileIdList.addAll(experimentsFileIdList);
// 获取应用总投资测算明细
String appEstimateFile = projectApplication.getApplicationEstimateFile();
List<Long> appEstimateFileIdList = getFileIdList(appEstimateFile);
fileIdList.addAll(appEstimateFileIdList);
}
// 流程审核意见文件
// 获取项目关联的流程实例
List<ProjectInst> projectInstList =
projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getProjectId, projectId));
// 从历史评论表中获取对应流程实例的评论附件信息
for (ProjectInst projectInst : projectInstList) {
String instanceId = projectInst.getInstCode();
List<Comment> commentList = taskService.getProcessInstanceComments(instanceId);
for (Comment comment : commentList) {
ProcessComment processComment = JSONObject.parseObject(comment.getFullMessage(), ProcessComment.class);
List<FileBasicInfo> attachments = processComment.getAttachments();
if (CollUtil.isNotEmpty(attachments)) {
List<Long> idList = attachments.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList());
fileIdList.addAll(idList);
}
}
}

// 预审申报阶段
// 预审申报上级条线主管单位审核意见
String higherLineSuperOrgReviewComments = project.getHigherLineSuperOrgReviewComments();
if (StringUtils.isNotBlank(higherLineSuperOrgReviewComments)) {
List<Long> highSuperOrgFileIdList = getFileIdList(higherLineSuperOrgReviewComments);
fileIdList.addAll(highSuperOrgFileIdList);
}

// 方案申报阶段
// 获取建设方案文件
String constructionPlanFile = project.getConstructionPlanFile();
String str = StrPool.LEFT_SQ_BRACKET + StrPool.RIGHT_SQ_BRACKET;
if (!str.equals(constructionPlanFile)) {
JSONObject jsonObject = JSON.parseObject(constructionPlanFile, JSONObject.class);
Long constructFileId = jsonObject.getLong(CommonConst.FILE_ID_STR);
fileIdList.add(constructFileId);
}

// 立项批复阶段
// 获取批复文件
String approvedFile = project.getApprovedFile();
if (Objects.nonNull(approvedFile)) {
fileIdList.add(Long.valueOf(approvedFile));
}
// 获取建设方案文件
String approvedConstructionPlanFile = project.getApprovedConstructionPlanFile();
if (Objects.nonNull(approvedConstructionPlanFile)) {
fileIdList.add(Long.valueOf(approvedConstructionPlanFile));
}

// 采购结果备案阶段
Purchase purchase = purchaseService
.getOne(Wrappers.lambdaQuery(Purchase.class).eq(Purchase::getProjectId, projectId).last(BizConst.LIMIT_1));
// 获取投标文件
if (Objects.nonNull(purchase)) {
String biddingDoc = purchase.getBiddingDoc();
List<Long> biddingFileIdList = getFileIdList(biddingDoc);
fileIdList.addAll(biddingFileIdList);
// 获取招标文件
String bidDoc = purchase.getBidDoc();
List<Long> bidFileIdList = getFileIdList(bidDoc);
fileIdList.addAll(bidFileIdList);
// 获取中标通知书
String acceptanceLetter = purchase.getAcceptanceLetter();
List<Long> acceptFileIdList = getFileIdList(acceptanceLetter);
fileIdList.addAll(acceptFileIdList);
}

// 合同备案阶段
Contract contract = contractService
.getOne(Wrappers.lambdaQuery(Contract.class).eq(Contract::getProjectId, projectId).last(BizConst.LIMIT_1));
// 获取合同附件
if (Objects.nonNull(contract)) {
String attachment = contract.getAttachment();
List<Long> contractFileIdList = getFileIdList(attachment);
fileIdList.addAll(contractFileIdList);
}
// 初验备案阶段
// 获取初验材料
String preliminaryInspectionMaterials = project.getPreliminaryInspectionMaterials();
getInspectionMaterials(fileIdList, preliminaryInspectionMaterials);

// 终验申报阶段
// 获取终验材料
String finalAcceptanceMaterials = project.getFinalAcceptanceMaterials();
getInspectionMaterials(fileIdList, finalAcceptanceMaterials);

// 专家评审记录-如果有初步方案评审会议、部门联审评审会议、建设方案评审会议、验收评审会议对应的附件
// 获取项目的所有评审意见
String projectCode = project.getProjectCode();
ProjectReviewDetailVO projectReviewDetailVO = expertReviewManage.projectExpertReviewDetail(projectCode);
Collection<ProjectReviewDetailVO.ReviewDetailByTypeVO> reviews = projectReviewDetailVO.getReviews();
// 获取最终评审意见附件
if (CollUtil.isNotEmpty(reviews)) {
List<Long> finalReviewFileIdList = reviews.stream().map(r -> {
ExpertReviewDetailVO finalReview = r.getFinalReview();
return finalReview.getAttachFileId();
}).collect(Collectors.toList());
fileIdList.addAll(finalReviewFileIdList);
// 获取组员评审意见
for (ProjectReviewDetailVO.ReviewDetailByTypeVO review : reviews) {
List<ExpertReviewDetailVO> teamMemberReviews = review.getTeamMemberReviews();
for (ExpertReviewDetailVO teamMemberReview : teamMemberReviews) {
Long attachFileId = teamMemberReview.getAttachFileId();
fileIdList.add(attachFileId);
}
}
}
}

private void getInspectionMaterials(List<Long> fileIdList, String preliminaryInspectionMaterials) {
List<String> fileStrList = JSON.parseArray(preliminaryInspectionMaterials, String.class);
if (CollUtil.isNotEmpty(fileStrList)) {
for (String fileStr : fileStrList) {
JSONObject object = JSON.parseObject(fileStr, JSONObject.class);
String dataStr = object.getString("data");
List<String> array = JSON.parseArray(dataStr, String.class);
for (String file : array) {
JSONObject fileObject = JSON.parseObject(file, JSONObject.class);
String filesStr = fileObject.getString("files");
List<JSONObject> jsonObjects = JSON.parseArray(filesStr, JSONObject.class);
if (CollUtil.isEmpty(jsonObjects)) {
// 如果没有上传附件,跳过
continue;
}
for (JSONObject json : jsonObjects) {
String response = json.getString("response");
JSONObject responseJson = JSON.parseObject(response, JSONObject.class);
String fileData = responseJson.getString("data");
JSONObject fileInfoObject = JSON.parseObject(fileData, JSONObject.class);
Long fileId = fileInfoObject.getLong("id");
fileIdList.add(fileId);
}
}
}
}
}

private List<Long> getFileIdList(String buildBasis) {
List<JSONObject> prePlanFileArray = JSON.parseArray(buildBasis, JSONObject.class);
List<Long> prePlanFileIdList = CollUtils.fieldList(prePlanFileArray, w -> w.getLong(CommonConst.ID_STR));
return prePlanFileIdList;
}
}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.java View File

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

import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* Mapper 接口
* </p>
*
* @author CMM
* @since 2023-06-16
*/
public interface NdProjectApplyBorrowMapper extends BaseMapper<ProjectApplyBorrow> {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.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.filemanage.mapper.NdProjectApplyBorrowMapper">

</mapper>

+ 57
- 0
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/ProjectApplyBorrow.java View File

@@ -0,0 +1,57 @@
package com.ningdatech.pmapi.filemanage.model.entity;

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

/**
* <p>
*
* </p>
*
* @author CMM
* @since 2023-06-16
*/
@Data
@TableName("nd_project_apply_borrow")
@ApiModel(value = "NdProjectApplyBorrow对象", description = "")
public class ProjectApplyBorrow implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

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

@ApiModelProperty("申请借阅员工code")
private String applyBorrowEmployeeCode;

@ApiModelProperty("申请借阅用户任职单位code")
private String applyBorrowEmpPosUnitCode;

@ApiModelProperty("申请借阅审批流程ID")
private String instanceId;

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

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

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

@ApiModelProperty("更新时间")
private LocalDateTime updateOn;

@ApiModelProperty("申请借阅是否成功")
private Boolean isSuccess;
}

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

@@ -33,4 +33,7 @@ public class ProjectFileListVO {

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("是否可以申请借阅")
private Boolean canApplyBorrow = Boolean.TRUE;
}

+ 24
- 12
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java View File

@@ -1,10 +1,19 @@
package com.ningdatech.pmapi.filemanage.model.vo;

import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO;
import com.ningdatech.pmapi.expert.model.vo.ProjectReviewDetailVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.FinalAcceptanceVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname ProjectFileVO
@@ -16,21 +25,24 @@ import java.time.LocalDateTime;
@ApiModel(value = "ProjectFileVO", description = "项目档案")
public class ProjectFileVO {

@ApiModelProperty("项目ID")
private Long id;
@ApiModelProperty("项目档案详情")
private ProjectDetailVO projectDetailVo;

@ApiModelProperty("项目名称")
private String projectName;
@ApiModelProperty("流程进度详情")
private List<ProcessDetailVO> processDetailVos;

@ApiModelProperty("项目单位")
private String buildOrgName;
@ApiModelProperty("专家评审详情")
private ProjectReviewDetailVO projectReviewDetailVo;

@ApiModelProperty("项目编号")
private String pojectCode;
@ApiModelProperty("招标登记详情")
private PurchaseVO purchaseVo;

@ApiModelProperty("是否可阅")
private Boolean canRead = Boolean.FALSE;
@ApiModelProperty("合同登记详情")
private ContractVO contractVo;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;
@ApiModelProperty("初验登记详情")
private PreInsVO preInsVo;

@ApiModelProperty("终验信息详情")
private FinalAcceptanceVO finalAcceptanceVo;
}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/INdProjectApplyBorrowService.java View File

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

import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* <p>
* 服务类
* </p>
*
* @author CMM
* @since 2023-06-16
*/
public interface INdProjectApplyBorrowService extends IService<ProjectApplyBorrow> {

}

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

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

import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow;
import com.ningdatech.pmapi.filemanage.mapper.NdProjectApplyBorrowMapper;
import com.ningdatech.pmapi.filemanage.service.INdProjectApplyBorrowService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
* <p>
* 服务实现类
* </p>
*
* @author CMM
* @since 2023-06-16
*/
@Service
public class NdProjectApplyBorrowServiceImpl extends ServiceImpl<NdProjectApplyBorrowMapper, ProjectApplyBorrow> implements INdProjectApplyBorrowService {

}

+ 9
- 4
pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java View File

@@ -1,11 +1,11 @@
package com.ningdatech.pmapi.irs.sign;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.irs.config.IrsSealPlatformProperties;
import com.ningdatech.pmapi.todocenter.model.dto.SignReqDTO;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@@ -43,7 +43,7 @@ public class IRSAPIRequest {
*
* @return
*/
public static byte[] createSignPdf(SignReqDTO req) {
public static String createSignPdf(SignReqDTO req) {
String pdfEncode64 = req.getPdfEncode64();
Float posX = req.getPosX();
Float posY = req.getPosY();
@@ -74,7 +74,12 @@ public class IRSAPIRequest {
throw new BizException("调用IRS盖章接口失败,印章编号为:" + sealSn + StrPool.SEMICOLON + e.getMessage());
}
// return obj;
return resp.getBytes();
JSONObject jsonObject = JSON.parseObject(resp, JSONObject.class);
String data = jsonObject.getString("data");
JSONObject object = JSON.parseObject(data, JSONObject.class);
// 获取盖好章的PDF文件内容Base64字符串
String signFileB64 = object.getString("signFileB64");
return signFileB64;
}


@@ -235,7 +240,7 @@ public class IRSAPIRequest {
//刷新此输出流并强制写出所有缓冲的输出字节
bout.flush();
byte[] bytes = baos.toByteArray();
return Base64.encode(bytes);
return String.valueOf(Base64.getEncoder().encode(bytes));
//return encoder.encodeBuffer(bytes);

} catch (IOException e) {


+ 8
- 7
pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java View File

@@ -1,10 +1,13 @@
package com.ningdatech.pmapi.organization.manage;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.organization.entity.GovBusinessStrip;
import com.ningdatech.pmapi.organization.model.entity.ProvincialGovBusinessStrip;
import com.ningdatech.pmapi.organization.model.vo.GovBusinessStripTreeVO;
import com.ningdatech.pmapi.organization.model.vo.ProvincialGovBusinessStripVO;
import com.ningdatech.pmapi.organization.service.IGovBusinessStripService;
import com.ningdatech.pmapi.organization.service.IProvincialGovBusinessStripService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
@@ -25,6 +28,7 @@ public class GovBusinessStripManage {

private final IGovBusinessStripService iGovBusinessStripService;

private final IProvincialGovBusinessStripService provincialGovBusinessStripService;

public List<GovBusinessStripTreeVO> getChildOrganizationList(String parentCode) {
if (Objects.isNull(parentCode)) {
@@ -44,15 +48,12 @@ public class GovBusinessStripManage {
}

public List<ProvincialGovBusinessStripVO> getProvincialGovBusinessStripList(String businessStripName) {
List<ProvincialGovBusinessStripVO> provincialGovBusinessStripVOList = new ArrayList<>();
ProvincialGovBusinessStripVO provincialGovBusinessStripVO = new ProvincialGovBusinessStripVO();
provincialGovBusinessStripVO.setBusinessStripCode("test_provincial_manage_org_code");
provincialGovBusinessStripVO.setBusinessStripName("测试省局条线主管单位");
provincialGovBusinessStripVOList.add(provincialGovBusinessStripVO);
List<ProvincialGovBusinessStrip> strips = provincialGovBusinessStripService.list(Wrappers.lambdaQuery(ProvincialGovBusinessStrip.class)
.orderByAsc(ProvincialGovBusinessStrip::getBusinessStripName));

provincialGovBusinessStripVOList = provincialGovBusinessStripVOList.stream()
return strips.stream()
.filter(b -> StringUtils.isBlank(businessStripName) || b.getBusinessStripName().contains(businessStripName))
.map(p -> BeanUtil.copyProperties(p,ProvincialGovBusinessStripVO.class))
.collect(Collectors.toList());
return provincialGovBusinessStripVOList;
}
}

+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.java View File

@@ -0,0 +1,15 @@
package com.ningdatech.pmapi.organization.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.pmapi.organization.model.entity.ProvincialGovBusinessStrip;

/**
* <p>
* Mapper 接口
* </p>
* @author zpf
* @since 2023-06-25
*/
public interface ProvincialGovBusinessStripMapper extends BaseMapper<ProvincialGovBusinessStrip> {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.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.organization.mapper.ProvincialGovBusinessStripMapper">

</mapper>

+ 29
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/ProvincialGovBusinessStrip.java View File

@@ -0,0 +1,29 @@
package com.ningdatech.pmapi.organization.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* @author Liuxinxin
* @since 2023-03-08
*/
@TableName("nd_provincial_gov_business_strip")
@Data
@ApiModel(value = "省级条线实体", description = "省级条线实体")
public class ProvincialGovBusinessStrip {

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("条线code")
private String businessStripCode;

@ApiModelProperty("条线名称")
private String businessStripName;

}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IProvincialGovBusinessStripService.java View File

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

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.organization.model.entity.ProvincialGovBusinessStrip;

/**
* <p>
* 服务类
* </p>
*
* @author zpf
* @since 2023-03-08
*/
public interface IProvincialGovBusinessStripService extends IService<ProvincialGovBusinessStrip> {

}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/ProvincialGovBusinessStripServiceImpl.java View File

@@ -0,0 +1,21 @@
package com.ningdatech.pmapi.organization.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.organization.mapper.ProvincialGovBusinessStripMapper;
import com.ningdatech.pmapi.organization.model.entity.ProvincialGovBusinessStrip;
import com.ningdatech.pmapi.organization.service.IProvincialGovBusinessStripService;
import org.springframework.stereotype.Service;

/**
* <p>
* 服务实现类
* </p>
*
* @author zpf
* @since 2023-03-08
*/
@Service
public class ProvincialGovBusinessStripServiceImpl extends ServiceImpl<ProvincialGovBusinessStripMapper, ProvincialGovBusinessStrip>
implements IProvincialGovBusinessStripService {

}

+ 44
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java View File

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

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.performance.manage.OrgSelfAppraisalManage;
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;
import org.springframework.web.bind.annotation.*;

/**
* @Classname OrgSelfAppraisalController
* @Description
* @Date 2023/6/25 14:16
* @Author PoffyZhang
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "绩效评价-单位自评")
@RequestMapping("/api/v1/self-appraisal")
public class OrgSelfAppraisalController {

private final OrgSelfAppraisalManage selfAppraisalManage;

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

@GetMapping("/pending-list/{planId}")
@ApiOperation("当前绩效评价待自评列表")
public PageVo<PerformanceAppraisalProjectVO> pendingList(@PathVariable Long planId, PerformanceAppraisalListReq req) {
return selfAppraisalManage.pendingList(planId,req);
}

@GetMapping("/appraisaled-list/{planId}")
@ApiOperation("当前绩效评价已自评列表")
public PageVo<PerformanceAppraisalProjectVO> appraisaledList(@PathVariable Long planId,PerformanceAppraisalListReq req) {
return selfAppraisalManage.appraisaledList(planId);
}
}

+ 93
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java View File

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

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.performance.manage.PerformanceAppraisalPlanManage;
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalCreateDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalEditDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalProjectGroupSaveDTO;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectGroupVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

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

/**
* @Classname PerformanceAppraisalController
* @Description
* @Date 2023/6/19 14:16
* @Author PoffyZhang
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "绩效评价-评价计划")
@RequestMapping("/api/v1/performance-appraisal/plan")
public class PerformanceAppraisalPlanController {

private final PerformanceAppraisalPlanManage performanceAppraisalPlanManage;

@GetMapping("/list")
@ApiOperation("绩效评价列表")
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) {
return performanceAppraisalPlanManage.list(req);
}

@GetMapping("/detail/{id}")
@ApiOperation("绩效评价列表")
public PerformanceAppraisalVO detail(@PathVariable Long id) {
return performanceAppraisalPlanManage.detail(id);
}

@PostMapping("/create")
@ApiOperation("绩效评价创建")
@WebLog("绩效评价创建")
public String create(@Valid @RequestBody PerformanceAppraisalCreateDTO createDTO) {
return performanceAppraisalPlanManage.create(createDTO);
}

@PostMapping("/edit")
@ApiOperation("编辑绩效评价")
@WebLog("编辑绩效评价")
public String edit(@Valid @RequestBody PerformanceAppraisalEditDTO editDTO) {
return performanceAppraisalPlanManage.edit(editDTO);
}

@PostMapping("/delete/{id}")
@ApiOperation("绩效评价删除")
@WebLog("绩效评价删除")
public String delete(@PathVariable Long id) {
return performanceAppraisalPlanManage.delete(id);
}

@GetMapping("/group/list/{appraisalId}")
@ApiOperation("绩效评价分组列表")
public List<PerformanceAppraisalProjectGroupVO> groupList(@PathVariable Long appraisalId,
@RequestParam(required = false) String name) {
return performanceAppraisalPlanManage.groupList(appraisalId,name);
}

@GetMapping("/group/detail/{id}")
@ApiOperation("绩效评价分组详情")
public PerformanceAppraisalProjectGroupVO groupDetail(@PathVariable Long id) {
return performanceAppraisalPlanManage.groupDetail(id);
}

@PostMapping("/group/save")
@ApiOperation("绩效评价分组保存")
@WebLog("绩效评价分组保存")
public String groupSave(@Valid @RequestBody PerformanceAppraisalProjectGroupSaveDTO dto) {
return performanceAppraisalPlanManage.groupSave(dto);
}

@PostMapping("/group/delete/{id}")
@ApiOperation("绩效评价分组删除")
@WebLog("绩效评价分组删除")
public String groupDelete(@PathVariable Long id) {
return performanceAppraisalPlanManage.groupDelete(id);
}
}

+ 55
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java View File

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

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.performance.manage.IndicatorTemplateManage;
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceIndicatorProjectTemplateVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* @Classname PerformanceIndicatorTemplateController
* @Description
* @Date 2023/6/25 14:16
* @Author PoffyZhang
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "绩效评价-指标配置")
@RequestMapping("/api/v1/indicator-template")
public class PerformanceIndicatorTemplateController {

private final IndicatorTemplateManage indicatorTemplateManage;

@GetMapping("/project/list")
@ApiOperation("项目指标配置模板列表")
public PageVo<PerformanceIndicatorProjectTemplateVO> projectList(PerformanceAppraisalListReq req) {
return indicatorTemplateManage.projectList(req);
}

@GetMapping("/project/detail/{id}")
@ApiOperation("项目指标配置模板详情")
public PerformanceIndicatorProjectTemplateVO projectDetail(@PathVariable Long id) {
return indicatorTemplateManage.projectDetail(id);
}

@PostMapping("/project/save")
@ApiOperation("项目指标配置模板保存")
@WebLog("项目指标配置模板保存")
public String projectTemplateSave(@Valid @RequestBody PerformanceIndicatorProjectTemplateSaveDTO dto) {
return indicatorTemplateManage.projectTemplateSave(dto);
}

@PostMapping("/project/delete/{id}")
@ApiOperation("项目指标配置模板删除")
@WebLog("项目指标配置模板删除")
public String projectTemplateDelete(@PathVariable Long id) {
return indicatorTemplateManage.projectTemplateDelete(id);
}
}

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

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

import cn.hutool.core.collection.CollUtil;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalApplicationVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import org.apache.commons.lang3.StringUtils;

import java.util.*;
import java.util.stream.Collectors;

/**
* @Classname PerformanceAppraisalConverer
* @Description
* @Date 2023/6/19 15:31
* @Author PoffyZhang
*/
public class PerformanceAppraisalConveter {

public static List<PerformanceAppraisalProjectVO> convertProjects(
List<PerformanceAppraisalProject> projects, Map<String, Project> map) {
if(CollUtil.isNotEmpty(projects) && CollUtil.isNotEmpty(map)){
return projects.stream().map(p -> {
PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO();
vo.setIsReAppraisal(p.getIsReAppraisal());
vo.setId(p.getProjectId());
if(map.containsKey(p.getProjectCode())){
Project project = map.get(p.getProjectCode());
vo.setProjectCode(project.getProjectCode());
vo.setProjectName(project.getProjectName());
vo.setProjectType(project.getProjectType());
vo.setProjectTypeName(getProjectTypeName(project.getProjectType()));
vo.setBuildOrgName(project.getBuildOrgName());
vo.setDeclareAmount(project.getDeclareAmount());
vo.setProjectYear(project.getProjectYear());
}
return vo;
}).collect(Collectors.toList());
}
return Collections.emptyList();
}

public static List<PerformanceAppraisalApplicationVO> convertApplications(
List<PerformanceAppraisalApplication> applications, Map<Long, ProjectApplication> map) {
if(CollUtil.isNotEmpty(applications) && CollUtil.isNotEmpty(map)){
return applications.stream().map(a -> {
PerformanceAppraisalApplicationVO vo = new PerformanceAppraisalApplicationVO();
vo.setId(a.getApplicationId());
if(map.containsKey(a.getApplicationId())){
ProjectApplication application = map.get(a.getApplicationId());
vo.setApplicationName(StringUtils.isNotBlank(application.getApplicationName())?
application.getApplicationName() : application.getAccountAppName());
vo.setApplicationType(application.getApplicationType());
vo.setBizDomain(application.getBizDomain());
vo.setPublishSide(application.getPublishSide());
}
return vo;
}).collect(Collectors.toList());
}
return Collections.emptyList();
}

public static String getProjectTypeName(Integer projectType) {
if (Objects.nonNull(projectType)) {
return ProjectTypeEnum.getDesc(projectType);
}
return StringUtils.EMPTY;
}
}

+ 44
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateStageNameEnum.java View File

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

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
* <p>
* PerformanceTemplateStageNameEnum
* </p>
*
* @author Poffy
* @since 16:56 2023/6/27
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum PerformanceTemplateStageNameEnum {
/**
* 模板阶段名称枚举
*/
STAGE_1(1, "立项阶段"),
STAGE_2(2, "建设阶段"),
STAGE_3(3, "运行阶段"),
STAGE_4(4, "附加阶段");

private Integer code;
private String desc;

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

+ 44
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java View File

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

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
* <p>
* PerformanceTemplateTypeEnum
* </p>
*
* @author Poffy
* @since 16:56 2023/6/27
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum PerformanceTemplateTypeEnum {
/**
* 模板类型
*/
STAGE(0, "阶段"),
FIRST_INDEX(1, "第一指标"),
SECOND_INDEX(2, "第二指标"),
THIRD_INDEX(3, "第三指标");

private Integer code;
private String desc;

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

+ 272
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java View File

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

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateStageNameEnum;
import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum;
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO;
import com.ningdatech.pmapi.performance.model.dto.ProjectTemplateDetailDTO;
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate;
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceIndicatorProjectTemplateVO;
import com.ningdatech.pmapi.performance.model.vo.ProjectTemplateDetailVO;
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateDetailService;
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateService;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname IndicatorTemplateManage
* @Description
* @Date 2023/6/26 14:15
* @Author PoffyZhang
*/
@Slf4j
@Component
@AllArgsConstructor
public class IndicatorTemplateManage {
private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService;

private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService;

/**
* 模板列表
* @param req
* @return
*/
public PageVo<PerformanceIndicatorProjectTemplateVO> projectList(PerformanceAppraisalListReq req) {
Page<PerformanceIndicatorProjectTemplate> page = req.page();
LambdaQueryWrapper<PerformanceIndicatorProjectTemplate> wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class)
.like(StringUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName())
.eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceIndicatorProjectTemplate::getRegionCode,req.getRegionCode());
indicatorProjectTemplateService.page(page,wrapper);

if(0L == page.getTotal()){
return PageVo.empty();
}

List<PerformanceIndicatorProjectTemplateVO> res = page.getRecords().stream()
.map(p -> BeanUtil.copyProperties(p, PerformanceIndicatorProjectTemplateVO.class))
.collect(Collectors.toList());

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

/**
* 查询项目模板详情
* @param id
* @return
*/
public PerformanceIndicatorProjectTemplateVO projectDetail(Long id) {
PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getById(id);
if(Objects.isNull(template)){
return null;
}
PerformanceIndicatorProjectTemplateVO vo = BeanUtil.copyProperties(template,
PerformanceIndicatorProjectTemplateVO.class);
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id));
if(CollUtil.isNotEmpty(templateDetails)){
vo.setTemplateDetails(buildTemplateDetail(templateDetails));
}
return vo;
}

/**
* 项目指标 模板保存
* @param dto
* @return
*/
@Transactional
public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class);
if(Objects.nonNull(dto.getId())){
PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!");
template.setId(old.getId());
}else{
template.setId(null);
template.setCreateOn(LocalDateTime.now());
template.setCreateBy(user.getUsername());
}
template.setUpdateOn(LocalDateTime.now());
template.setUpdateBy(user.getUsername());
if(indicatorProjectTemplateService.saveOrUpdate(template)){
//保存 模板的详情
if(CollUtil.isNotEmpty(dto.getTemplateDetails())){
//先删除
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId()));
analysisTemplateDetails(dto.getTemplateDetails(),template.getId());

//校检 3个阶段 总分是不是100
List<PerformanceIndicatorProjectTemplateDetail> stages = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getType, PerformanceTemplateTypeEnum.STAGE.getCode())
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, template.getId())
.in(PerformanceIndicatorProjectTemplateDetail::getName, Lists.newArrayList(PerformanceTemplateStageNameEnum.STAGE_1.getDesc(),
PerformanceTemplateStageNameEnum.STAGE_2.getDesc(), PerformanceTemplateStageNameEnum.STAGE_3.getDesc())));
if(CollUtil.isNotEmpty(stages)){
int sum = stages.stream().filter(p -> Objects.nonNull(p.getScore())).mapToInt(PerformanceIndicatorProjectTemplateDetail::getScore).sum();
VUtils.isTrue(sum != 100).throwMessage("总分不是100 操作失败!");
}
}
return "保存成功";
}
throw new BizException("保存失败!");
}

/**
* 解析 项目考核指标
* @param templateDetails
* @return
*/
public void analysisTemplateDetails(
List<ProjectTemplateDetailDTO> templateDetails,Long templateId) {
if(CollUtil.isEmpty(templateDetails)){
return;
}
analysisTemplateDetailsInner(templateDetails,templateId,null,null);
}

public void analysisTemplateDetailsInner(List<ProjectTemplateDetailDTO> templateDetails,
Long templateId,Long parentId,Long stageId) {
if(CollUtil.isEmpty(templateDetails)){
return;
}
UserInfoDetails user = LoginUserUtil.loginUserDetail();
for(ProjectTemplateDetailDTO detail : templateDetails){
//计算阶段的
PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class);
templateDetail.setCreateBy(user.getUsername());
templateDetail.setCreateOn(LocalDateTime.now());
templateDetail.setUpdateBy(user.getUsername());
templateDetail.setUpdateOn(LocalDateTime.now());
templateDetail.setTemplateId(templateId);
templateDetail.setParentId(parentId);
//如果是阶段的计算下 总分
if(!PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){
templateDetail.setStageId(stageId);
}
indicatorProjectTemplateDetailService.save(templateDetail);
//如果是阶段的话 阶段Id 就是自己的id
if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){
templateDetail.setScore(computeTotalScore(templateDetail));
templateDetail.setStageId(templateDetail.getId());
indicatorProjectTemplateDetailService.updateById(templateDetail);
stageId = templateDetail.getId();
}

if(CollUtil.isNotEmpty(detail.getChildren())){
analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId(),stageId);
}
}
}

/**
* 计算 此阶段下的 总分
* @param templateDetail
* @return
*/
private Integer computeTotalScore(PerformanceIndicatorProjectTemplateDetail templateDetail) {
Integer total = 0;
if(Objects.isNull(templateDetail) || Objects.isNull(templateDetail.getId())){
return total;
}

if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){
List<PerformanceIndicatorProjectTemplateDetail> thirds = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, templateDetail.getTemplateId())
.eq(PerformanceIndicatorProjectTemplateDetail::getStageId, templateDetail.getId())
.eq(PerformanceIndicatorProjectTemplateDetail::getType,PerformanceTemplateTypeEnum.THIRD_INDEX.getCode()));
if(CollUtil.isNotEmpty(thirds)){
total = thirds.stream().mapToInt(PerformanceIndicatorProjectTemplateDetail::getScore).sum();
}
}
return total;
}

/**
* 装配 模板详情
* @param templateDetails
* @return
*/
private List<ProjectTemplateDetailVO> buildTemplateDetail(List<PerformanceIndicatorProjectTemplateDetail> templateDetails) {
List<ProjectTemplateDetailVO> res = Lists.newArrayList();
//第一层是 一级的
for(PerformanceIndicatorProjectTemplateDetail templateDetail : templateDetails){
if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){
ProjectTemplateDetailVO detailVo = BeanUtil.copyProperties(templateDetail, ProjectTemplateDetailVO.class);
List<ProjectTemplateDetailVO> secondList = Lists.newArrayList();
for(PerformanceIndicatorProjectTemplateDetail templateDetailSecond : templateDetails) {
if (Objects.nonNull(templateDetailSecond.getParentId()) &&
templateDetailSecond.getParentId().equals(templateDetail.getId())) {
ProjectTemplateDetailVO detailSecondVo = BeanUtil.copyProperties(templateDetailSecond, ProjectTemplateDetailVO.class);
List<ProjectTemplateDetailVO> thirdList = Lists.newArrayList();
for(PerformanceIndicatorProjectTemplateDetail templateDetailThird : templateDetails) {
if (Objects.nonNull(templateDetailThird.getParentId()) &&
templateDetailThird.getParentId().equals(templateDetailSecond.getId())) {
ProjectTemplateDetailVO detailThirdVo = BeanUtil.copyProperties(templateDetailThird, ProjectTemplateDetailVO.class);
List<ProjectTemplateDetailVO> fourList = Lists.newArrayList();
for(PerformanceIndicatorProjectTemplateDetail templateDetailFour : templateDetails) {
if (Objects.nonNull(templateDetailFour.getParentId()) &&
templateDetailFour.getParentId().equals(templateDetailThird.getId())) {
ProjectTemplateDetailVO detailFourVo = BeanUtil.copyProperties(templateDetailFour, ProjectTemplateDetailVO.class);
fourList.add(detailFourVo);
}
}
detailThirdVo.setChildren(fourList);
thirdList.add(detailThirdVo);
}
}
detailSecondVo.setChildren(thirdList);
secondList.add(detailSecondVo);
}
}
detailVo.setChildren(secondList);
res.add(detailVo);
}
}
return res;
}

/**
* 删除项目模板
* @param id
* @return
*/
public String projectTemplateDelete(Long id) {
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(id);
VUtils.isTrue(Objects.isNull(projectTemplate)).throwMessage("该模板不存在!");

if(CommonEnum.YES.getCode().equals(projectTemplate.getStatus())){
throw new BizException("操作失败 该模板 是启用状态!");
}

if(indicatorProjectTemplateService.removeById(id)){
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,id));
return "删除成功";
}
return "操作失败";
}
}

+ 155
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java View File

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

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
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.function.VUtils;
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.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.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

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

/**
* @Classname OrgSelfAppraisalManage
* @Description
* @Date 2023/6/19 14:18
* @Author PoffyZhang
*/
@Component
@Slf4j
@AllArgsConstructor
public class OrgSelfAppraisalManage {

private final IPerformanceAppraisalService performanceAppraisalService;

private final IPerformanceAppraisalProjectService performanceAppraisalProjectService;

private final IPerformanceAppraisalApplicationService performanceAppraisalApplicationService;

private final IProjectService projectService;

private final IProjectApplicationService applicationService;

/**
* 绩效列表
* @param req
* @return
*/
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();

//当前登录用户 单位code
String empPosUnitCode = user.getEmpPosUnitCode();
List<Project> projectLists = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getBuildOrgCode, empPosUnitCode));

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

List<Long> projectIds = projectLists.stream().map(Project::getId).collect(Collectors.toList());

List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.in(PerformanceAppraisalProject::getProjectId, projectIds));
if(CollUtil.isEmpty(paps)){
return PageVo.empty();
}

Set<Long> paIds = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet());

Page<PerformanceAppraisal> page = req.page();
LambdaQueryWrapper<PerformanceAppraisal> wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class)
.in(PerformanceAppraisal::getId,paIds)
.orderByDesc(PerformanceAppraisal::getUpdateOn);
performanceAppraisalService.page(page,wrapper);
if(0L == page.getTotal()){
return PageVo.empty();
}

List<PerformanceAppraisalVO> res = page.getRecords().stream().map(p -> {
PerformanceAppraisalVO vo = BeanUtil.copyProperties(p,PerformanceAppraisalVO.class);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}

public PageVo<PerformanceAppraisalProjectVO> pendingList(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()));

if(CollUtil.isEmpty(paps)){
return PageVo.empty();
}
Set<String> projectIds = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet());

Page<Project> page = req.page();
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class)
.in(Project::getProjectCode, projectIds)
.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);
vo.setCanSelfAppraisal(checkCanSelfAppraisal(plan));
return vo;
})
.collect(Collectors.toList());

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

/**
* 已经自评表
* @param planId
* @return
*/
public PageVo<PerformanceAppraisalProjectVO> appraisaledList(Long planId) {

return PageVo.empty();
}

/**
* 是否可以自评
* @param plan
* @return
*/
private Boolean checkCanSelfAppraisal(PerformanceAppraisal plan) {
if(LocalDateTime.now().compareTo(plan.getSelfAppraisalStart()) > 0 &&
LocalDateTime.now().compareTo(plan.getSelfAppraisalEnd()) < 0){
return Boolean.TRUE;
}
return Boolean.FALSE;
}
}

+ 579
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java View File

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

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
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.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.common.util.CodeUtil;
import com.ningdatech.pmapi.performance.convert.PerformanceAppraisalConveter;
import com.ningdatech.pmapi.performance.model.dto.AppraisalProjectDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalCreateDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalEditDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalProjectGroupSaveDTO;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectGroup;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectGroupVO;
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.IPerformanceAppraisalProjectGroupService;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

/**
* @Classname PerformanceAppraisalManage
* @Description
* @Date 2023/6/19 14:18
* @Author PoffyZhang
*/
@Component
@Slf4j
@AllArgsConstructor
public class PerformanceAppraisalPlanManage {

private final IPerformanceAppraisalService performanceAppraisalService;

private final IPerformanceAppraisalProjectService performanceAppraisalProjectService;

private final IPerformanceAppraisalApplicationService performanceAppraisalApplicationService;

private final IProjectService projectService;

private final IProjectApplicationService applicationService;

private final IPerformanceAppraisalProjectGroupService groupService;

private final UserInfoHelper userInfoHelper;

/**
* 绩效列表
* @param req
* @return
*/
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) {
Page<PerformanceAppraisal> page = req.page();
LambdaQueryWrapper<PerformanceAppraisal> wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class)
.like(StringUtils.isNotBlank(req.getPlanName()),PerformanceAppraisal::getName,req.getPlanName())
.ge(Objects.nonNull(req.getStart()),PerformanceAppraisal::getCreateOn,req.getStart())
.le(Objects.nonNull(req.getEnd()),PerformanceAppraisal::getCreateOn,req.getEnd())
.orderByDesc(PerformanceAppraisal::getUpdateOn);
performanceAppraisalService.page(page,wrapper);
if(0L == page.getTotal()){
return PageVo.empty();
}

List<Long> paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList());
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.in(PerformanceAppraisalProject::getAppraisalId, paIds));

Map<String,Project> projectMap = Maps.newHashMap();
Map<Long,List<PerformanceAppraisalProject>> papsGroupMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(paps)){
papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId));

List<String> projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList());
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.in(Project::getProjectCode, projectCodes)
.eq(Project::getNewest, Boolean.TRUE));
if(CollUtil.isNotEmpty(projects)){
projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p));
}
}

List<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class)
.in(PerformanceAppraisalApplication::getAppraisalId, paIds));
Map<Long,ProjectApplication> applicationMap = Maps.newHashMap();
Map<Long,List<PerformanceAppraisalApplication>> paasGroupMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(paas)){
paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId));

List<Long> applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList());
List<ProjectApplication> apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.in(ProjectApplication::getId, applicationIds));
if(CollUtil.isNotEmpty(apps)){
applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId,a -> a));
}
}

Map<Long, List<PerformanceAppraisalProject>> finalPapsGroupMap = papsGroupMap;
Map<Long,List<PerformanceAppraisalApplication>> finalPaasGroupMap = paasGroupMap;
Map<String,Project> finalProjectMap = projectMap;
Map<Long,ProjectApplication> finalApplicationMap = applicationMap;
List<PerformanceAppraisalVO> res = page.getRecords().stream().map(p -> {
PerformanceAppraisalVO vo = BeanUtil.copyProperties(p,PerformanceAppraisalVO.class);
if(finalPapsGroupMap.containsKey(p.getId())){
vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(p.getId()),finalProjectMap));
}
if(finalPaasGroupMap.containsKey(p.getId())){
vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(p.getId()),finalApplicationMap));
}
return vo;
}).collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}

public PerformanceAppraisalVO detail(Long id) {

PerformanceAppraisal pa = performanceAppraisalService.getById(id);
VUtils.isTrue(Objects.isNull(pa)).throwMessage("该计划不存在");

PerformanceAppraisalVO vo = BeanUtil.copyProperties(pa,PerformanceAppraisalVO.class);
//绩效关联的项目
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId, id));
Map<String,Project> projectMap = Maps.newHashMap();
Map<Long,List<PerformanceAppraisalProject>> papsGroupMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(paps)){
papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId));

List<String> projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList());
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.in(Project::getProjectCode, projectCodes)
.eq(Project::getNewest, Boolean.TRUE));
if(CollUtil.isNotEmpty(projects)){
projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p));
}
}

//绩效关联的应用
List<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class)
.eq(PerformanceAppraisalApplication::getAppraisalId, id));
Map<Long,ProjectApplication> applicationMap = Maps.newHashMap();
Map<Long,List<PerformanceAppraisalApplication>> paasGroupMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(paas)){
paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId));

List<Long> applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList());
List<ProjectApplication> apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.in(ProjectApplication::getId, applicationIds));
if(CollUtil.isNotEmpty(apps)){
applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId,a -> a));
}
}

Map<Long, List<PerformanceAppraisalProject>> finalPapsGroupMap = papsGroupMap;
Map<Long,List<PerformanceAppraisalApplication>> finalPaasGroupMap = paasGroupMap;
Map<String,Project> finalProjectMap = projectMap;
Map<Long,ProjectApplication> finalApplicationMap = applicationMap;
if(finalPapsGroupMap.containsKey(vo.getId())){
vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(vo.getId()),finalProjectMap));
}
if(finalPaasGroupMap.containsKey(vo.getId())){
vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(vo.getId()),finalApplicationMap));
}
return vo;
}

/**
* 新建计划
* @param createDTO
* @return
*/
@Transactional
public String create(PerformanceAppraisalCreateDTO createDTO) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();

deduplicationName(createDTO);

PerformanceAppraisal pa = BeanUtil.copyProperties(createDTO,PerformanceAppraisal.class);
pa.setCreateOn(LocalDateTime.now());
pa.setCreateBy(user.getUsername());
pa.setUpdateOn(LocalDateTime.now());
pa.setUpdateBy(user.getUsername());
performanceAppraisalService.save(pa);

if(CollUtil.isNotEmpty(createDTO.getProjects())
&& StringUtils.isNotBlank(createDTO.getTarget())
&& createDTO.getTarget().contains("1")){
saveProjects(createDTO,pa.getId(),user);
}

if(CollUtil.isNotEmpty(createDTO.getApplicationIds())
&& StringUtils.isNotBlank(createDTO.getTarget())
&& createDTO.getTarget().contains("2")){
saveApplications(createDTO,pa.getId(),user);
}

return "新建成功";
}


/**
* 编辑计划
* @param editDTO
* @return
*/
@Transactional
public String edit(PerformanceAppraisalEditDTO editDTO) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();

deduplicationName(editDTO);

PerformanceAppraisal pa = BeanUtil.copyProperties(editDTO,PerformanceAppraisal.class);

pa.setUpdateOn(LocalDateTime.now());
pa.setUpdateBy(user.getUsername());
performanceAppraisalService.updateById(pa);

if(CollUtil.isNotEmpty(editDTO.getProjects())){
saveProjects(editDTO,user);
}

if(CollUtil.isNotEmpty(editDTO.getApplicationIds())){
saveApplications(editDTO,user);
}

return "编辑成功";
}

/**
* 名称去重
* @param dto
*/
private void deduplicationName(PerformanceAppraisalCreateDTO dto) {
long count = performanceAppraisalService.count(Wrappers.lambdaQuery(PerformanceAppraisal.class)
.eq(PerformanceAppraisal::getName, dto.getName()));
VUtils.isTrue(count > 0).throwMessage("名称已经存在");
}

private void deduplicationName(PerformanceAppraisalEditDTO dto) {
if(StringUtils.isNotBlank(dto.getName())){
long count =performanceAppraisalService.count(Wrappers.lambdaQuery(PerformanceAppraisal.class)
.eq(PerformanceAppraisal::getName,dto.getName())
.ne(Objects.nonNull(dto.getId()),PerformanceAppraisal::getId,dto.getId()));
VUtils.isTrue(count > 0).throwMessage("名称已经存在");
}
}

@Transactional
public void saveProjects(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) {
if(CollUtil.isEmpty(createDTO.getProjects())){
return;
}

List<AppraisalProjectDTO> projects = createDTO.getProjects();

for(AppraisalProjectDTO appraisalProject : projects){
Project newProject = projectService.getNewProject(appraisalProject.getId());
VUtils.isTrue(Objects.isNull(newProject)).throwMessage("项目不存在 " + appraisalProject.getId());
PerformanceAppraisalProject pap = new PerformanceAppraisalProject();
pap.setAppraisalId(id);
pap.setProjectId(appraisalProject.getId());
pap.setProjectCode(newProject.getProjectCode());
pap.setIsReAppraisal(appraisalProject.getIsReAppraisal());
pap.setCreateBy(user.getUsername());
pap.setCreateOn(LocalDateTime.now());
pap.setUpdateBy(user.getUsername());
pap.setUpdateOn(LocalDateTime.now());
performanceAppraisalProjectService.save(pap);
}
}

@Transactional
public void saveApplications(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) {
if(CollUtil.isEmpty(createDTO.getApplicationIds())){
return;
}

List<Long> applicationIds = createDTO.getApplicationIds();

for(Long applicationId : applicationIds){
ProjectApplication projectApplication = applicationService.getById(applicationId);
VUtils.isTrue(Objects.isNull(projectApplication)).throwMessage("应用不存在 " + applicationId);
PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication();
paa.setAppraisalId(id);
paa.setApplicationId(applicationId);
paa.setCreateBy(user.getUsername());
paa.setCreateOn(LocalDateTime.now());
paa.setUpdateBy(user.getUsername());
paa.setUpdateOn(LocalDateTime.now());
performanceAppraisalApplicationService.save(paa);
}
}

@Transactional
public void saveProjects(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) {
if(Objects.isNull(editDTO.getProjects())){
return;
}

//删除先
performanceAppraisalProjectService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId,editDTO.getId()));
List<AppraisalProjectDTO> projects = editDTO.getProjects();
for(AppraisalProjectDTO appraisalProject : projects){
Project newProject = projectService.getNewProject(appraisalProject.getId());
VUtils.isTrue(Objects.isNull(newProject)).throwMessage("项目不存在 " + appraisalProject.getId());
PerformanceAppraisalProject pap = new PerformanceAppraisalProject();
pap.setAppraisalId(editDTO.getId());
pap.setProjectId(appraisalProject.getId());
pap.setProjectCode(newProject.getProjectCode());
pap.setIsReAppraisal(appraisalProject.getIsReAppraisal());
pap.setCreateBy(user.getUsername());
pap.setCreateOn(LocalDateTime.now());
pap.setUpdateBy(user.getUsername());
pap.setUpdateOn(LocalDateTime.now());
performanceAppraisalProjectService.save(pap);
}
}

@Transactional
public void saveApplications(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) {
if(Objects.isNull(editDTO.getApplicationIds())){
return;
}

//删除先
performanceAppraisalApplicationService.remove(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class)
.eq(PerformanceAppraisalApplication::getAppraisalId,editDTO.getId()));
List<Long> applicationIds = editDTO.getApplicationIds();

for(Long applicationId : applicationIds){
ProjectApplication projectApplication = applicationService.getById(applicationId);
VUtils.isTrue(Objects.isNull(projectApplication)).throwMessage("应用不存在 " + applicationId);
PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication();
paa.setAppraisalId(editDTO.getId());
paa.setApplicationId(applicationId);
paa.setCreateBy(user.getUsername());
paa.setCreateOn(LocalDateTime.now());
paa.setUpdateBy(user.getUsername());
paa.setUpdateOn(LocalDateTime.now());
performanceAppraisalApplicationService.save(paa);
}
}

/**
* 删除绩效评价计划
* 连带删除 其下所有
* @param id
* @return
*/
public String delete(Long id) {
PerformanceAppraisal pa = performanceAppraisalService.getById(id);
VUtils.isTrue(Objects.isNull(pa)).throwMessage("绩效评价不存在 删除失败!");

//如果到了自评就不能删除了
if(pa.getSelfAppraisalStart().compareTo(LocalDateTime.now()) < 0){
throw new BizException("自评已经开始 不能够删除绩效评价");
}

if(performanceAppraisalService.removeById(id)){
return "删除成功";
}
return "删除失败";
}

public List<PerformanceAppraisalProjectGroupVO> groupList(Long appraisalId,String name) {
List<PerformanceAppraisalProjectGroup> groups = groupService.list(
Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class)
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, appraisalId)
.like(StringUtils.isNotBlank(name),PerformanceAppraisalProjectGroup::getName,name));
if(CollUtil.isEmpty(groups)){
return Collections.emptyList();
}

Set<String> allEmployeeCodes = Sets.newHashSet();
Set<String> projectCodes = Sets.newHashSet();
Map<String, UserFullInfoDTO> userMap = Maps.newHashMap();
Map<String, Project> projectMap = Maps.newHashMap();
groups.stream().forEach(g -> {
allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getReAppraisalUsers()));
allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getVerificationUsers()));
projectCodes.addAll(CodeUtil.convertStrToList(g.getProjectIds()));
});

if(CollUtil.isNotEmpty(allEmployeeCodes)){
List<UserFullInfoDTO> users = userInfoHelper.getUserFullInfoByEmployeeCodes(allEmployeeCodes);
if(CollUtil.isNotEmpty(users)){
userMap = users.stream().collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode,u -> u));
}
}

if(CollUtil.isNotEmpty(projectCodes)){
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.in(Project::getProjectCode,projectCodes)
.eq(Project::getNewest,Boolean.TRUE));
if(CollUtil.isNotEmpty(projects)){
projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p));
}
}

Map<String, Project> finalProjectMap = projectMap;
Map<String, UserFullInfoDTO> finalUserMap = userMap;
return groups.stream().map(g -> {
PerformanceAppraisalProjectGroupVO vo = new PerformanceAppraisalProjectGroupVO();
vo.setAppraisalId(g.getAppraisalId());
vo.setName(g.getName());
vo.setCreateOn(g.getCreateOn());
vo.setCreateBy(g.getCreateBy());
vo.setUpdateBy(g.getUpdateBy());
vo.setUpdateOn(g.getUpdateOn());
vo.setId(g.getId());
vo.setProjects(checkProject(g.getProjectIds(), finalProjectMap));
vo.setReAppraisalUsers(checkUser(g.getReAppraisalUsers(), finalUserMap));
vo.setVerificationUsers(checkUser(g.getVerificationUsers(), finalUserMap));
return vo;
}).collect(Collectors.toList());
}

/**
* 分组详情
* @param id
* @return
*/
public PerformanceAppraisalProjectGroupVO groupDetail(Long id) {
PerformanceAppraisalProjectGroup group = groupService.getById(id);

if(Objects.isNull(group)){
return null;
}

Map<String, Project> projectMap = Maps.newHashMap();
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.in(StringUtils.isNotBlank(group.getProjectIds()),Project::getProjectCode,
Arrays.stream(group.getProjectIds().split(StrPool.COMMA)).collect(Collectors.toList()))
.eq(Project::getNewest,Boolean.TRUE));
if(CollUtil.isNotEmpty(projects)){
projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p));
}

Map<String, UserFullInfoDTO> userMap = Maps.newHashMap();
Set<String> allEmployeeCodes = Sets.newHashSet();
allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getReAppraisalUsers()));
allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getVerificationUsers()));
if(CollUtil.isNotEmpty(allEmployeeCodes)){
List<UserFullInfoDTO> users = userInfoHelper.getUserFullInfoByEmployeeCodes(allEmployeeCodes);
if(CollUtil.isNotEmpty(users)){
userMap = users.stream().collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode,u -> u));
}
}

PerformanceAppraisalProjectGroupVO vo = new PerformanceAppraisalProjectGroupVO();
vo.setAppraisalId(group.getAppraisalId());
vo.setName(group.getName());
vo.setCreateOn(group.getCreateOn());
vo.setCreateBy(group.getCreateBy());
vo.setUpdateBy(group.getUpdateBy());
vo.setUpdateOn(group.getUpdateOn());
vo.setId(group.getId());
vo.setProjects(checkProject(group.getProjectIds(), projectMap));
vo.setReAppraisalUsers(checkUser(group.getReAppraisalUsers(), userMap));
vo.setVerificationUsers(checkUser(group.getVerificationUsers(), userMap));
return vo;
}

/**
* 分组 保存
* @param dto
* @return
*/
public String groupSave(PerformanceAppraisalProjectGroupSaveDTO dto) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();

PerformanceAppraisalProjectGroup group = BeanUtil.copyProperties(dto, PerformanceAppraisalProjectGroup.class);

if(Objects.isNull(dto.getId())){
group.setId(null);
group.setCreateOn(LocalDateTime.now());
group.setCreateBy(user.getUsername());
}else{
PerformanceAppraisalProjectGroup old = groupService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(old)).throwMessage("该分组不存在 编辑失败!");
group.setId(old.getId());
}
if(CollUtil.isNotEmpty(dto.getProjectCodes())){
group.setProjectIds(dto.getProjectCodes().stream().collect(Collectors.joining(StrPool.COMMA)));
}
if(CollUtil.isNotEmpty(dto.getReAppraisalUsers())){
group.setReAppraisalUsers(dto.getReAppraisalUsers().stream().collect(Collectors.joining(StrPool.COMMA)));
}
if(CollUtil.isNotEmpty(dto.getVerificationUsers())){
group.setVerificationUsers(dto.getVerificationUsers().stream().collect(Collectors.joining(StrPool.COMMA)));
}
group.setUpdateOn(LocalDateTime.now());
group.setUpdateBy(user.getUsername());
groupService.saveOrUpdate(group);
return "操作成功";
}

/**
* 删除分组
* @param id
* @return
*/
public String groupDelete(Long id) {
PerformanceAppraisalProjectGroup group = groupService.getById(id);
VUtils.isTrue(Objects.isNull(group)).throwMessage("分组不存在");

//评价Id
Long appraisalId = group.getAppraisalId();

PerformanceAppraisal pa = performanceAppraisalService.getById(appraisalId);
VUtils.isTrue(Objects.isNull(pa)).throwMessage("评价不存在");

//如果到了自评就不能删除了
if(pa.getSelfAppraisalStart().compareTo(LocalDateTime.now()) < 0){
throw new BizException("自评已经开始 不能够删除绩效评价");
}

if(groupService.removeById(id)){
return "删除成功";
}
return "删除失败";
}

private List<PerformanceAppraisalProjectVO> checkProject(String projectIds, Map<String, Project> projectMap) {
if(StringUtils.isBlank(projectIds)){
return Collections.emptyList();
}
return Arrays.stream(projectIds.split(StrPool.COMMA)).map(projectCode -> {
PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO();
if(projectMap.containsKey(projectCode)){
Project project = projectMap.get(projectCode);
vo.setProjectTypeName(BizUtils.getProjectTypeName(project.getProjectType()));
vo.setProjectType(project.getProjectType());
vo.setId(project.getId());
vo.setProjectCode(projectCode);
vo.setProjectYear(project.getProjectYear());
vo.setDeclareAmount(project.getDeclareAmount());
}
return vo;
}).collect(Collectors.toList());
}

private List<UserFullInfoDTO> checkUser(String users, Map<String, UserFullInfoDTO> userMap) {
if(StringUtils.isBlank(users)){
return Collections.emptyList();
}
return Arrays.stream(users.split(StrPool.COMMA)).map(
employeeCode -> userMap.get(employeeCode)
).collect(Collectors.toList());
}
}

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

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

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

/**
* <p>
* Mapper 接口
* </p>
*
* @author Zpf
* @since 2023-06-03
*/
public interface PerformanceAppraisalApplicationMapper extends BaseMapper<PerformanceAppraisalApplication> {

}

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

</mapper>

+ 17
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.java View File

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

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal;
import com.ningdatech.pmapi.projectlib.model.entity.Project;

/**
* <p>
* Mapper 接口
* </p>
*
* @author Zpf
* @since 2023-06-03
*/
public interface PerformanceAppraisalMapper extends BaseMapper<PerformanceAppraisal> {

}

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

</mapper>

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

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

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

/**
* <p>
* Mapper 接口
* </p>
*
* @author Zpf
* @since 2023-06-03
*/
public interface PerformanceAppraisalProjectGroupMapper extends BaseMapper<PerformanceAppraisalProjectGroup> {

}

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

</mapper>

+ 17
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.java View File

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

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

/**
* <p>
* Mapper 接口
* </p>
*
* @author Zpf
* @since 2023-06-03
*/
public interface PerformanceAppraisalProjectMapper extends BaseMapper<PerformanceAppraisalProject> {

}

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

</mapper>

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

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

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

/**
* <p>
* Mapper 接口
* </p>
*
* @author Zpf
* @since 2023-06-03
*/
public interface PerformanceIndicatorProjectTemplateDetailMapper extends BaseMapper<PerformanceIndicatorProjectTemplateDetail> {

}

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

</mapper>

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

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

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

/**
* <p>
* Mapper 接口
* </p>
*
* @author Zpf
* @since 2023-06-03
*/
public interface PerformanceIndicatorProjectTemplateMapper extends BaseMapper<PerformanceIndicatorProjectTemplate> {

}

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

</mapper>

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

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

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;

/**
* @Classname AppraisalProjectDTO
* @Description
* @Date 2023/6/19 17:08
* @Author PoffyZhang
*/
@Data
public class AppraisalProjectDTO {

@ApiModelProperty("项目ID")
@NotNull(message = "项目ID 必填")
private Long id;

@ApiModelProperty("是否复评")
private Boolean isReAppraisal = Boolean.FALSE;
}

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

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

import com.alibaba.fastjson.annotation.JSONField;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalApplicationVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
* @Classname PerformanceAppraisalCreateDTO
* @Description 绩效评价对象
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "绩效评价创建对象", description = "绩效评价创建对象")
public class PerformanceAppraisalCreateDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("计划名称")
@NotBlank(message = "请输入计划名称")
private String name;

@ApiModelProperty("自评开始时间")
@NotNull(message = "自评时间错误")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime selfAppraisalStart;

@ApiModelProperty("自评结束时间")
@NotNull(message = "自评时间错误")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime selfAppraisalEnd;

@ApiModelProperty("复评开始时间")
@NotNull(message = "复评时间错误")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime reAppraisalStart;

@ApiModelProperty("复评结束时间")
@NotNull(message = "复评时间错误")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime reAppraisalEnd;

@ApiModelProperty("核查开始时间")
@NotNull(message = "核查时间错误")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime verificationStart;

@ApiModelProperty("核查结束时间")
@NotNull(message = "核查时间错误")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime verificationEnd;

@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2")
@NotBlank(message = "评价目标不能为空")
private String target;

@ApiModelProperty("评价项目 只有ID 和是否复评")
private List<AppraisalProjectDTO> projects;

@ApiModelProperty("评价应用ids")
private List<Long> applicationIds;
}

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

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

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

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
* @Classname PerformanceAppraisalEditDTO
* @Description 绩效评价对象
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "绩效评价编辑对象", description = "绩效评价编辑对象")
public class PerformanceAppraisalEditDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("id")
@NotNull(message = "编辑的时候 id必填")
private Long id;

@ApiModelProperty("计划名称")
@JSONField(format = "yyyy-MM-dd")
private String name;

@ApiModelProperty("自评开始时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime selfAppraisalStart;

@ApiModelProperty("自评结束时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime selfAppraisalEnd;

@ApiModelProperty("复评开始时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime reAppraisalStart;

@ApiModelProperty("复评结束时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime reAppraisalEnd;

@ApiModelProperty("核查开始时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime verificationStart;

@ApiModelProperty("核查结束时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime verificationEnd;

@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2")
private String target;

@ApiModelProperty("评价项目 只有ID 和是否复评")
private List<AppraisalProjectDTO> projects;

@ApiModelProperty("评价应用ids")
private List<Long> applicationIds;
}

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

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

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PerformanceAppraisalProjectGroupSaveDTO
* @Description 绩效评价和项目分组
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "绩效评价项目分组", description = "绩效评价项目分组")
public class PerformanceAppraisalProjectGroupSaveDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("id")
private Long id;

@ApiModelProperty("名称")
private String name;

@ApiModelProperty("计划id")
private Long appraisalId;

@ApiModelProperty("状态 0关闭 1开启")
private Integer status = 0;

@ApiModelProperty("分组内的所有项目code")
private List<String> projectCodes;

@ApiModelProperty("复评人员")
private List<String> reAppraisalUsers;

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

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

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

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

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

/**
* @Classname PerformanceIndicatorProjectTemplateSaveDTO
* @Description 绩效评价考核模板 保存
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板")
public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable {

private static final long serialVersionUID = 1L;

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

@ApiModelProperty("模板名称")
private String name;

@ApiModelProperty("丽水 区域code")
private String regionCode;

@ApiModelProperty("项目年度")
private Integer projectYear;

@ApiModelProperty("项目类型 ")
private Integer projectType;

@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上")
private Integer amountRange;

@ApiModelProperty("状态 0 1")
private Integer status;

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

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

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

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;

/**
* @Classname PerformanceIndicatorProjectTemplateDetail
* @Description 绩效评价考核项目指标模板
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "绩效评价考核项目指标模板详情保存树", description = "绩效评价考核项目指标模板详情保存树")
public class ProjectTemplateDetailDTO implements Serializable {

private static final long serialVersionUID = 1L;

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

@ApiModelProperty("指标名称")
private String name;

@ApiModelProperty("指标类型 0阶段 1一级指标 2二级指标 3三级指标")
private Integer type;

@ApiModelProperty("父级指标id")
private Long parentId;

@ApiModelProperty("分数 3级指标才有")
private Integer score;

@ApiModelProperty("分数细则 3级指标才有")
private String scoreRubric;

@ApiModelProperty("评分pdf")
private String pdf;

@ApiModelProperty("阶段id")
private Long stageId;

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

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

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

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PerformanceAppraisal
* @Description 绩效评价对象
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@TableName("nd_performance_appraisal")
@ApiModel(value = "绩效评价对象", description = "绩效评价对象")
public class PerformanceAppraisal implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;

@ApiModelProperty("计划名称")
private String name;

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

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

@ApiModelProperty("复评开始时间")
private LocalDateTime reAppraisalStart;

@ApiModelProperty("复评结束时间")
private LocalDateTime reAppraisalEnd;

@ApiModelProperty("核查开始时间")
private LocalDateTime verificationStart;

@ApiModelProperty("核查结束时间")
private LocalDateTime verificationEnd;

@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2")
private String target;
}

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

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

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PerformanceAppraisalApplication
* @Description 绩效评价和应用关联对象
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@TableName("nd_performance_appraisal_application")
@ApiModel(value = "绩效评价和应用关联对象", description = "绩效评价和应用关联对象")
public class PerformanceAppraisalApplication implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;

@ApiModelProperty("计划id")
private Long appraisalId;

@ApiModelProperty("应用id")
private Long applicationId;
}

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

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

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PerformanceAppraisalProject
* @Description 绩效评价和项目关联对象
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@TableName("nd_performance_appraisal_project")
@ApiModel(value = "绩效评价和项目关联对象", description = "绩效评价和项目关联对象")
public class PerformanceAppraisalProject implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;

@ApiModelProperty("计划id")
private Long appraisalId;

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

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

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

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

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

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PerformanceAppraisalProjectGroup
* @Description 绩效评价和项目分组
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@TableName("nd_performance_appraisal_project_group")
@ApiModel(value = "绩效评价项目分组", description = "绩效评价项目分组")
public class PerformanceAppraisalProjectGroup implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;

@ApiModelProperty("名称")
private String name;

@ApiModelProperty("计划id")
private Long appraisalId;

@ApiModelProperty("分组内的所有项目id")
private String projectIds;

@ApiModelProperty("复评人员")
private String reAppraisalUsers;

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

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

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

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PerformanceIndicatorTemplate
* @Description 绩效评价考核项目指标模板
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@TableName("nd_performance_indicator_project_template")
@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板")
public class PerformanceIndicatorProjectTemplate implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;

@ApiModelProperty("模板名称")
private String name;

@ApiModelProperty("丽水 区域code")
private String regionCode;

@ApiModelProperty("项目年度")
private Integer projectYear;

@ApiModelProperty("项目类型")
private Integer projectType;

@ApiModelProperty("状态 0关闭 1开启")
private Integer status;

@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上")
private Integer amountRange;
}

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

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

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PerformanceIndicatorProjectTemplateDetail
* @Description 绩效评价考核项目指标模板
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@TableName("nd_performance_indicator_project_template_detail")
@ApiModel(value = "绩效评价考核项目指标模板详情", description = "绩效评价考核项目指标模板详情")
public class PerformanceIndicatorProjectTemplateDetail implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;


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

@ApiModelProperty("指标名称")
private String name;

@ApiModelProperty("指标类型 0阶段 1一级指标 2二级指标 3三级指标")
private Integer type;

@ApiModelProperty("父级指标id")
private Long parentId;

@ApiModelProperty("分数 3级指标才有")
private Integer score;

@ApiModelProperty("分数细则 3级指标才有")
private String scoreRubric;

@ApiModelProperty("评分pdf")
private String pdf;

@ApiModelProperty("阶段id")
private Long stageId;
}

+ 36
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java View File

@@ -0,0 +1,36 @@
package com.ningdatech.pmapi.performance.model.req;

import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;

/**
* <p>
* PerformanceAppraisalListReq
* </p>
*
* @author ZPF
* @since 09:32 2023/06/13
*/
@Data
public class PerformanceAppraisalListReq extends PagePo {

@ApiModelProperty("计划名称")
private String planName;

@ApiModelProperty("开始时间")
private String start;

@ApiModelProperty("结束时间")
private String end;

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

@ApiModelProperty("模板名称")
private String templateName;

@ApiModelProperty("区域code")
private String regionCode;
}

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

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

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

import java.io.Serializable;

/**
* @Classname PerformanceAppraisalApplicationVO
* @Description 绩效评价对象
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "绩效评价应用对象", description = "绩效评价应用对象")
public class PerformanceAppraisalApplicationVO implements Serializable {

private static final long serialVersionUID = 1L;

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

@ApiModelProperty("应用名称")
private String applicationName;

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

@ApiModelProperty("应用类型")
private String applicationType;

@ApiModelProperty("应用领域")
private String bizDomain;

@ApiModelProperty("发布端")
private String publishSide;
}

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

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

import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PerformanceAppraisalProjectGroupVO
* @Description 绩效评价和项目分组
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "绩效评价项目分组", description = "绩效评价项目分组")
public class PerformanceAppraisalProjectGroupVO implements Serializable {

private static final long serialVersionUID = 1L;

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

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;

@ApiModelProperty("名称")
private String name;

@ApiModelProperty("计划id")
private Long appraisalId;

@ApiModelProperty("分组内的所有项目")
private List<PerformanceAppraisalProjectVO> projects;

@ApiModelProperty("复评人员")
private List<UserFullInfoDTO> reAppraisalUsers;

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

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

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

import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
* @Classname PerformanceAppraisalProjectVO
* @Description 绩效评价对象
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "绩效评价项目对象", description = "绩效评价项目对象")
public class PerformanceAppraisalProjectVO implements Serializable {

private static final long serialVersionUID = 1L;

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

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

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

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

@ApiModelProperty("项目类型")
private Integer projectType;

@ApiModelProperty("项目类型名")
private String projectTypeName;

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

@ApiModelProperty("申报金额")
private BigDecimal declareAmount;

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

@ApiModelProperty("是否可自评")
private Boolean canSelfAppraisal = Boolean.FALSE;
}

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

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

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

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

/**
* @Classname PerformanceAppraisal
* @Description 绩效评价对象
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "绩效评价对象", description = "绩效评价对象")
public class PerformanceAppraisalVO implements Serializable {

private static final long serialVersionUID = 1L;

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

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;

@ApiModelProperty("计划名称")
private String name;

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

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

@ApiModelProperty("复评开始时间")
private LocalDateTime reAppraisalStart;

@ApiModelProperty("复评结束时间")
private LocalDateTime reAppraisalEnd;

@ApiModelProperty("核查开始时间")
private LocalDateTime verificationStart;

@ApiModelProperty("核查结束时间")
private LocalDateTime verificationEnd;

@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2")
private String target;

@ApiModelProperty("评价项目列表")
private List<PerformanceAppraisalProjectVO> projects;

@ApiModelProperty("评价应用列表")
private List<PerformanceAppraisalApplicationVO> applications;
}

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

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

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

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

/**
* @Classname PerformanceIndicatorProjectTemplateVO
* @Description 绩效评价考核项目指标模板
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "绩效评价考核项目指标模板", description = "绩效评价考核项目指标模板")
public class PerformanceIndicatorProjectTemplateVO implements Serializable {

private static final long serialVersionUID = 1L;

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

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;

@ApiModelProperty("模板名称")
private String name;

@ApiModelProperty("丽水 区域code")
private String regionCode;

@ApiModelProperty("项目年度")
private Integer projectYear;

@ApiModelProperty("项目类型")
private Integer projectType;

@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上")
private Integer amountRange;

@ApiModelProperty("状态 0关闭 1开启")
private Integer status;

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

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

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

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

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

/**
* @Classname PerformanceIndicatorProjectTemplateDetail
* @Description 绩效评价考核项目指标模板
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "绩效评价考核项目指标模板详情保存树", description = "绩效评价考核项目指标模板详情保存树")
public class ProjectTemplateDetailVO implements Serializable {

private static final long serialVersionUID = 1L;

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

@ApiModelProperty("指标名称")
private String name;

@ApiModelProperty("指标类型 0阶段 1一级指标 2二级指标 3三级指标")
private Integer type;

@ApiModelProperty("父级指标id")
private Long parentId;

@ApiModelProperty("分数 3级指标才有")
private Integer score;

@ApiModelProperty("分数细则 3级指标才有")
private String scoreRubric;

@ApiModelProperty("评分pdf")
private String pdf;

@ApiModelProperty("阶段id")
private Long stageId;

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

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

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

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

/**
* <p>
* 服务类
* </p>
*
* @author PoffyZhang
* @since 2023-06-03
*/
public interface IPerformanceAppraisalApplicationService extends IService<PerformanceAppraisalApplication> {

}

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

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

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

/**
* <p>
* 服务类
* </p>
*
* @author PoffyZhang
* @since 2023-06-03
*/
public interface IPerformanceAppraisalProjectGroupService extends IService<PerformanceAppraisalProjectGroup> {

}

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

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

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

/**
* <p>
* 服务类
* </p>
*
* @author PoffyZhang
* @since 2023-06-03
*/
public interface IPerformanceAppraisalProjectService extends IService<PerformanceAppraisalProject> {

}

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

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

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

/**
* <p>
* 服务类
* </p>
*
* @author PoffyZhang
* @since 2023-06-03
*/
public interface IPerformanceAppraisalService extends IService<PerformanceAppraisal> {

}

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

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

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

/**
* <p>
* 服务类
* </p>
*
* @author PoffyZhang
* @since 2023-06-03
*/
public interface IPerformanceIndicatorProjectTemplateDetailService extends IService<PerformanceIndicatorProjectTemplateDetail> {

}

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

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

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

/**
* <p>
* 服务类
* </p>
*
* @author PoffyZhang
* @since 2023-06-03
*/
public interface IPerformanceIndicatorProjectTemplateService extends IService<PerformanceIndicatorProjectTemplate> {

}

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

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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalApplicationMapper;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalApplicationService;
import org.springframework.stereotype.Service;

/**
* <p>
* 绩效评价和应用 服务实现类
* </p>
*
* @author ZPF
* @since 2023-06-15
*/
@Service
public class PerformanceAppraisalApplicationServiceImpl extends ServiceImpl<PerformanceAppraisalApplicationMapper,
PerformanceAppraisalApplication> implements IPerformanceAppraisalApplicationService {

}

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

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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalProjectGroupMapper;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectGroup;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectGroupService;
import org.springframework.stereotype.Service;

/**
* <p>
* 绩效评价分组 服务实现类
* </p>
*
* @author ZPF
* @since 2023-06-15
*/
@Service
public class PerformanceAppraisalProjectGroupServiceImpl extends ServiceImpl<PerformanceAppraisalProjectGroupMapper,
PerformanceAppraisalProjectGroup> implements IPerformanceAppraisalProjectGroupService {

}

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

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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalProjectMapper;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService;
import org.springframework.stereotype.Service;

/**
* <p>
* 绩效评价和项目 服务实现类
* </p>
*
* @author ZPF
* @since 2023-06-15
*/
@Service
public class PerformanceAppraisalProjectServiceImpl extends ServiceImpl<PerformanceAppraisalProjectMapper,
PerformanceAppraisalProject> implements IPerformanceAppraisalProjectService {

}

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

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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalMapper;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService;
import org.springframework.stereotype.Service;

/**
* <p>
* 绩效评价 服务实现类
* </p>
*
* @author ZPF
* @since 2023-06-15
*/
@Service
public class PerformanceAppraisalServiceImpl extends ServiceImpl<PerformanceAppraisalMapper, PerformanceAppraisal> implements IPerformanceAppraisalService {

}

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

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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.performance.mapper.PerformanceIndicatorProjectTemplateDetailMapper;
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail;
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateDetailService;
import org.springframework.stereotype.Service;

/**
* <p>
* 绩效评价详情 服务实现类
* </p>
*
* @author ZPF
* @since 2023-06-15
*/
@Service
public class PerformanceIndicatorProjectTemplateDetailServiceImpl extends ServiceImpl<PerformanceIndicatorProjectTemplateDetailMapper, PerformanceIndicatorProjectTemplateDetail>
implements IPerformanceIndicatorProjectTemplateDetailService {

}

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

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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.performance.mapper.PerformanceIndicatorProjectTemplateMapper;
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate;
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateService;
import org.springframework.stereotype.Service;

/**
* <p>
* 绩效评价 服务实现类
* </p>
*
* @author ZPF
* @since 2023-06-15
*/
@Service
public class PerformanceIndicatorProjectTemplateServiceImpl extends ServiceImpl<PerformanceIndicatorProjectTemplateMapper, PerformanceIndicatorProjectTemplate>
implements IPerformanceIndicatorProjectTemplateService {

}

+ 1
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java View File

@@ -49,7 +49,6 @@ public class DelayedApplyController {
@PostMapping("/apply")
public String delayedApply(@Validated @RequestBody DelayedApplyDTO dto) {
String instanceId = delayedApplyManage.startDelayedApplyProcess(dto);
return "启动流程实例 【" + instanceId + "】 成功";
//return delayedApplyManage.delayedApply(dto);
return "启动延期申请流程实例 【" + instanceId + "】 成功";
}
}

+ 0
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java View File

@@ -130,8 +130,6 @@ public class DeclaredProjectManage {
projectInfo.setId(null);
}

// defaultDeclaredProjectManage.startProcess(projectInfo,user,ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode());

String regionCode = user.getRegionCode();

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)


+ 21
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java View File

@@ -36,6 +36,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum;
@@ -44,6 +45,7 @@ import com.ningdatech.pmapi.todocenter.constant.WorkNoticeContant;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.bean.entity.WflowModels;
import com.wflow.contants.HisProInsEndActId;
import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
@@ -52,6 +54,8 @@ import com.wflow.workflow.service.ProcessModelService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.HistoryService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -87,6 +91,7 @@ public class DelayedApplyManage {
private final ProjectLibManage projectLibManage;
private final NoticeManage noticeManage;
private final IProjectInstService projectInstService;
private final HistoryService historyService;

/**
* 延期的-项目列表
@@ -131,6 +136,19 @@ public class DelayedApplyManage {
item.setBuildCycle(StringUtils.isNotBlank(w.getBuildCycle()) ?
Integer.valueOf(w.getBuildCycle()) : null);
item.setPlanAcceptanceTime(w.getPlanAcceptanceTime());
// 判断当前项目是否已经开启了延期申请并且没有审批完成
String instCode = w.getInstCode();
// 获取流程通过后的流程实例
HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(instCode)
.singleResult();
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getInstCode, instCode));
Integer instType = projectInst.getInstType();
if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) &&
!HisProInsEndActId.END.equals(newInstance.getEndActivityId())){
item.setCanDelayApply(Boolean.FALSE);
}
return item;
});
return PageVo.of(records, total);
@@ -229,7 +247,7 @@ public class DelayedApplyManage {
.throwMessage("提交失败 该项目不是 已立项|待终验");

VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime())
|| project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) <= 0)
|| project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) > 0)
.throwMessage("当前项目还未过期验收");

String regionCode = user.getRegionCode();
@@ -253,12 +271,11 @@ public class DelayedApplyManage {
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, project);
String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap);
log.info("终验方案项目申报成功 【{}】", instanceId);
log.info("延期申请申报成功 【{}】", instanceId);

// 保存项目相关
// 保存项目延期实例相关
projectLibManage.saveProjectByApplyDelay(dto, project, instanceId);


//发送给第一个审批人消息
noticeManage.sendFirtUser(project,model.getFormName(),instanceId,
WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW);


+ 23
- 9
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java View File

@@ -12,6 +12,7 @@ import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
@@ -191,15 +192,28 @@ public class PurchaseManage {
purchaseEntity.setId(purchase.getId());
}
purchaseEntity.setProjectId(projectId);
purchaseService.saveOrUpdate(purchaseEntity);

//进入到下一状态
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());
project.setTransactionAmount(dto.getTransactionAmount());
project.setTransactionTime(dto.getTransactionTime());
projectService.updateById(project);
if(purchaseService.saveOrUpdate(purchaseEntity)){
//如果 需要推送项目和应用管理的话 只有遂昌县才有
// String areaCode = project.getAreaCode();
// String appCode = dto.getAppCode();
// if(RegionConst.RC_SC.equals(areaCode) && StringUtils.isNotBlank(appCode)){
// try{
//
// }catch (Exception e){
// log.info("绑定以及推送项目和应用关系 失败! {}" + e.getMessage());
// }
// }

//进入到下一状态
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());
project.setTransactionAmount(dto.getTransactionAmount());
project.setTransactionTime(dto.getTransactionTime());
projectService.updateById(project);

return "填写成功";
}

return "填写成功";
return "保存失败";
}
}

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java View File

@@ -56,4 +56,6 @@ public class PurchaseSaveDTO {
@ApiModelProperty("中标通知书")
private String acceptanceLetter;

@ApiModelProperty("应用编码")
private String appCode;
}

+ 38
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java View File

@@ -10,6 +10,8 @@ import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection;
import com.ningdatech.pmapi.projectlib.service.IProjectCollectionService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -31,6 +33,9 @@ public class GenerateProjectCodeUtil {
@Autowired
private IProjectService projectService;

@Autowired
private IProjectCollectionService projectCollectionService;

public String generateProjectCode(ProjectDTO project){
// 获取所属行政区划代码(6位)
String areaCode = project.getAreaCode();
@@ -63,4 +68,37 @@ public class GenerateProjectCodeUtil {
// 生成21位的项目编号
return areaCode + year + fixedNumber + fiscalCode + projectIdStr;
}

public String generateProjectCode(ProjectCollection project){
// 获取所属行政区划代码(6位)
String areaCode = project.getAreaCode();
// 获取建设年度后两位
String year = String.valueOf(project.getProjectYear() % DeclaredProjectContant.Project.YEAR_DRAW_SURPLUS);
// 9-12位固定
String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER;
// 获取公司的财政编码
CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(project.getBuildOrgCode());

// 从表中查出单位配置的财政编码
if (Objects.isNull(companyFiscalCode)){
throw new BizException("申报单位未配置财政编码!");
}

String fiscalCode = companyFiscalCode.getFiscalCode();
// 获取项目编号
String projectIdStr;
// 获取项目库当前最大项目序号
List<ProjectCollection> projectList = projectCollectionService.list(Wrappers.lambdaQuery(ProjectCollection.class).orderByDesc(ProjectCollection::getId));
ProjectCollection maxProject = CollUtil.isEmpty(projectList) ? null : projectList.get(0);
Long projectId = Objects.isNull(maxProject) ? DeclaredProjectContant.Project.MIN_PROJECT_ID : maxProject.getId() + 1;
if (projectId > DeclaredProjectContant.Project.MAX_PROJECT_ID){
// 超过999的项目号从1开始 1
Long newProjectId = projectId % DeclaredProjectContant.Project.MAX_PROJECT_ID;
projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, newProjectId);
}else {
projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, projectId);
}
// 生成21位的项目编号
return areaCode + year + fixedNumber + fiscalCode + projectIdStr;
}
}

+ 41
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java View File

@@ -0,0 +1,41 @@
package com.ningdatech.pmapi.projectlib.controller;

import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.projectlib.manage.ApplicationManage;
import com.ningdatech.pmapi.projectlib.model.dto.ApplicationAppCodeSaveDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* @Classname ProjectApplicationController
* @Description
* @Date 2023/6/27 11:32
* @Author PoffyZhang
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "项目应用控制器")
@RequestMapping("/api/v1/application")
public class ProjectApplicationController {

private final ApplicationManage applicationManage;

@GetMapping("/get-report/{appCode}")
@ApiOperation("获取应用 试运行报告")
@WebLog("获取应用 试运行报告")
public String getReport(@PathVariable String appCode) {
return applicationManage.getReport(appCode);
}

@PostMapping("/save-appcode")
@ApiOperation("保存应用注册的appCode")
@WebLog("保存应用注册的appCode")
public String saveAppCode(@Valid @RequestBody ApplicationAppCodeSaveDTO dto) {
return applicationManage.saveAppCode(dto);
}

}

+ 55
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectCollectionController.java View File

@@ -0,0 +1,55 @@
package com.ningdatech.pmapi.projectlib.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.projectlib.manage.ProjectCollectionManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectCollectionSaveDTO;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectCollectionVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* @Classname ProjectCollectionController
* @Description
* @Date 2023/6/25 9:11
* @Author PoffyZhang
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "项目归集控制器")
@RequestMapping("/api/v1/project-collection")
public class ProjectCollectionController {

private final ProjectCollectionManage collectionManage;

@GetMapping("/list")
@ApiOperation("项目归集列表")
public PageVo<ProjectCollectionVO> list(ProjectListReq req) {
return collectionManage.list(req);
}

@GetMapping("/detail/{id}")
@ApiOperation("项目归集详情")
public ProjectCollectionVO detail(@PathVariable Long id) {
return collectionManage.detail(id);
}

@PostMapping("/save")
@ApiOperation("项目归集保存")
@WebLog("项目归集保存")
public String save(@Valid @RequestBody ProjectCollectionSaveDTO dto) {
return collectionManage.save(dto);
}

@PostMapping("/delete/{id}")
@ApiOperation("项目归集删除")
@WebLog("项目归集删除")
public String delete(@PathVariable Long id) {
return collectionManage.delete(id);
}
}

+ 8
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java View File

@@ -4,7 +4,9 @@ import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.req.ProjectApplicationListReq;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
@@ -44,6 +46,12 @@ public class ProjectLibController {
return projectLibManage.projectLibListWithPermission(req,user);
}

@GetMapping("/application/list")
@ApiOperation("应用列表")
public PageVo<ProjectApplicationVO> applicationList(ProjectApplicationListReq req) {
return projectLibManage.applicationList(req);
}

@GetMapping("/{id}")
@ApiOperation("获取项目详情")
public ProjectDetailVO detail (@PathVariable Long id){


+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java View File

@@ -44,4 +44,16 @@ public enum InstTypeEnum {
}
return StringUtils.EMPTY;
}

public static InstTypeEnum getByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (InstTypeEnum t : InstTypeEnum.values()) {
if (code.equals(t.getCode())) {
return t;
}
}
return null;
}
}

+ 4
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java View File

@@ -93,8 +93,10 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle {
.eq(ProjectStatusChange::getProjectId, projectId)
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PROJECT_APPROVAL.name())
.last("limit 1"));
processDetailVO.setFinishTime(projectStatusChange.getCreateOn());
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED);
if (Objects.nonNull(projectStatusChange)) {
processDetailVO.setFinishTime(projectStatusChange.getCreateOn());
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED);
}
}
processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL);
processSchedule.add(processDetailVO);


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java View File

@@ -89,7 +89,7 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle
processDetailVO.setFinishTime(finishTime);
}
processDetailVO.setProcessProgressVo(instanceDetail);
processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW);
processDetailVO.setProcessName(CommonConst.PROJECT_FINAL_INSPECTION);
processSchedule.add(processDetailVO);
}
}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java View File

@@ -74,7 +74,7 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH
.last("limit 1"));
processDetailVO.setFinishTime(projectStatusChange.getCreateOn());
}
processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE);
processDetailVO.setProcessName(CommonConst.PROJECT_PRELIMINARY_INSPECTION);
processSchedule.add(processDetailVO);
}
}

+ 116
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java View File

@@ -0,0 +1,116 @@
package com.ningdatech.pmapi.projectlib.manage;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.ApiResponse;
import com.ningdatech.pmapi.common.util.HmacAuthUtil;
import com.ningdatech.pmapi.projectlib.model.dto.ApplicationAppCodeSaveDTO;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

import java.time.LocalDateTime;
import java.util.Map;
import java.util.Objects;

/**
* <p>
* ApplicationManage
* </p>
*
* @author ZPF
* @since 14:19 2023/2/1
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class ApplicationManage {

@Value("${irs.app-report.url}")
private String url;

@Value("${irs.app-report.appKey}")
private String appKey;

@Value("${irs.app-report.appScret}")
private String appScret;

private final IProjectApplicationService applicationService;

/**
* 保存 appCode
* @param dto
* @return
*/
public String saveAppCode(ApplicationAppCodeSaveDTO dto) {
Long userId = LoginUserUtil.getUserId();
ProjectApplication app = applicationService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(app)).throwMessage("该应用不存在");

app.setAppCode(dto.getAppCode());
app.setUpdateOn(LocalDateTime.now());
app.setUpdateBy(userId);
if(applicationService.updateById(app)){
return "保存成功";
}
return "保存失败";
}

/**
* 获取试运行报告
* @param appCode
* @return
*/
public String getReport(String appCode) {
String method = HttpMethod.GET.name();
String appUrl = url + "?appCode=" + appCode;

Map<String, String> header = HmacAuthUtil.generateHeader(appUrl, method, appKey, appScret);
//请求头
HttpHeaders headers = new HttpHeaders();

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

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

log.info("body:",forEntity.getBody());
ApiResponse body = forEntity.getBody();

if(!body.getCode().equals(HttpStatus.OK.value())){
throw new BizException(body.getMessage());
}

Object data = body.getData();
if(Objects.nonNull(data)){
JSONObject dataJson = JSON.parseObject(JSON.toJSONString(data));
JSONArray resourceList = dataJson.getJSONArray("resourceList");
if(CollUtil.isNotEmpty(resourceList)){
JSONObject resource = JSON.parseObject(JSON.toJSONString(resourceList.get(0)));
if(StringUtils.isBlank(resource.getString("reportOss"))){
//暂时没有 appCode 所以先返回测试数据
return "https://irs-yyyw.oss-cn-hangzhou-zwynet-d01-a.internet.cloud.zj.gov.cn/tmp/%E6%B8%A9%E5%B7%9E%E5%B8%82%E4%B9%90%E6%B8%85%E5%B8%82%E5%8C%BA%E5%9F%9F%E4%BD%93%E6%A3%80%E4%BF%A1%E6%81%AF%E7%B3%BB%E7%BB%9F_9cf0b901f2ca4fbf8ff274da359ad219.html?Expires=1687833685&OSSAccessKeyId=wMhEw2BhpIDc1xwO&Signature=UPAbMdDy23FI1sNemszg5WH%2BG40%3D";
}else{
return resource.getString("reportOss");
}
}
}
throw new BizException("获取报告失败!");
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save