From e6a0c3381c7e67322cc32e3dbcdfbb409852ed1e Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 14 Jun 2023 13:48:28 +0800 Subject: [PATCH 01/44] =?UTF-8?q?=E5=85=8D=E7=99=BB=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/user/constant/LoginTypeEnum.java | 2 ++ .../security/auth/credential/CredentialAuthProvider.java | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/constant/LoginTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/constant/LoginTypeEnum.java index 5ed7d49..fd9fec6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/constant/LoginTypeEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/constant/LoginTypeEnum.java @@ -17,6 +17,8 @@ public enum LoginTypeEnum { */ DING_QR_LOGIN, + DING_MD_LOGIN, + /** * 手机号验证码登陆 */ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java index b5e76dc..b6f0518 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java @@ -60,6 +60,19 @@ public class CredentialAuthProvider implements AuthenticationProvider { user = userDetailsService.loadUserByUsername(accountId + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); } break; + case DING_MD_LOGIN: { + String code = (String) authenticationToken.getCredentials(); + GenericResult accountResult = zwddAuthClient.getMobileAccountId(code); + if (!accountResult.isSuccess()) { + throw new BadCredentialsException("login fail! 浙政钉免登校验失败"); + } + String accountId = accountResult.getData(); + if (Objects.isNull(accountId)) { + throw new BadCredentialsException("login fail! 浙政钉免登校验失败"); + } + user = userDetailsService.loadUserByUsername(accountId + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); + } + break; case PHONE_VERIFICATION_CODE_LOGIN: { if (!phoneVerifyCodeSkip) { // 校验短信验证码 From fbd009156248b594bcaf0ca633bdbdcdfee28d62 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 14 Jun 2023 14:14:21 +0800 Subject: [PATCH 02/44] =?UTF-8?q?=E5=85=8D=E7=99=BB=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/security/auth/credential/CredentialLoginUserDetailService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java index b4601a9..6a6c301 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java @@ -50,6 +50,7 @@ public class CredentialLoginUserDetailService implements UserDetailsService { } } break; + case DING_MD_LOGIN: case DING_QR_LOGIN: { userFullInfo = userInfoManage.queryUserInfoInAccountIdAuth(username); if (Objects.isNull(userFullInfo)) { From bcf919b625698e63ea851d55a590112e9bdc9317 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 15 Jun 2023 16:47:51 +0800 Subject: [PATCH 03/44] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=BB=B6=E6=9C=9F?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/GeneratorCodeKingbaseConfig.java | 3 +- .../controller/DelayedApplyController.java | 3 +- .../projectdeclared/manage/DelayedApplyManage.java | 6 +- .../pmapi/projectlib/enumeration/InstTypeEnum.java | 12 ++ .../pmapi/projectlib/manage/ProjectLibManage.java | 33 +++--- .../mapper/NdProjectDelayApplyMapper.java | 16 +++ .../mapper/NdProjectDelayApplyMapper.xml | 5 + .../projectlib/model/entity/ProjectDelayApply.java | 57 ++++++++++ .../service/INdProjectDelayApplyService.java | 16 +++ .../impl/NdProjectDelayApplyServiceImpl.java | 20 ++++ .../pmapi/todocenter/manage/HandlerManage.java | 122 +++++++++++++++------ 11 files changed, 233 insertions(+), 60 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectDelayApplyService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectDelayApplyServiceImpl.java diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index e06dd9d..36675c5 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -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_delay_apply"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java index c6028b2..dfb7944 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java @@ -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 + "】 成功"; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java index 8fa4c62..a7d66cd 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java @@ -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; @@ -253,12 +254,11 @@ public class DelayedApplyManage { // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 Map 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); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java index 78b7f82..92511c4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java @@ -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; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 8f39f65..48f2df7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -34,16 +34,14 @@ import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteChainHandle; import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; import com.ningdatech.pmapi.projectlib.model.dto.ProjectApplicationDTO; import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; -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.entity.ProjectRenewalFundDeclaration; +import com.ningdatech.pmapi.projectlib.model.entity.*; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.pmapi.projectlib.service.*; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.exception.BusinessException; import com.wflow.workflow.bean.vo.ProcessDetailVO; import lombok.RequiredArgsConstructor; @@ -79,8 +77,8 @@ public class ProjectLibManage { private final IProjectApplicationService projectApplicationService; private final GenerateProjectCodeUtil generateProjectCodeUtil; private final IProjectInstService projectInstService; - private final StateMachineUtils stateMachineUtils; + private final INdProjectDelayApplyService projectDelayApplyService; public PageVo projectLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); @@ -617,19 +615,18 @@ public class ProjectLibManage { } public void saveProjectByApplyDelay(DelayedApplyDTO dto, Project project, String instanceId) { - // 获取项目的立项批复时间和建设周期 - LocalDateTime approvalDate = project.getApprovalDate(); - String buildCycle = project.getBuildCycle(); - // 重新计算建设周期、验收时间 - String constructCycle = buildCycle + dto.getDelayedMonth(); - project.setBuildCycle(constructCycle); - Long delayedMonth = Long.valueOf(dto.getDelayedMonth()); - String acceptTime = NdDateUtils.format(approvalDate.plusMonths(delayedMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); - project.setBuildCycle(acceptTime); - project.setInstCode(instanceId); - project.setApplyDelayFile(dto.getSupportingMaterials()); - project.setApplyDelayReason(dto.getDelayedReason()); - projectService.updateById(project); + + ProjectDelayApply projectDelayApply = new ProjectDelayApply(); + projectDelayApply.setDelayTime(dto.getDelayedMonth()); + projectDelayApply.setDelayApplyFile(dto.getSupportingMaterials()); + projectDelayApply.setDelayApplyReason(dto.getDelayedReason()); + projectDelayApply.setProjectId(project.getId()); + projectDelayApply.setInstanceId(instanceId); + projectDelayApply.setCreateBy(LoginUserUtil.getUserId()); + projectDelayApply.setCreateOn(LocalDateTime.now()); + projectDelayApply.setUpdateBy(LoginUserUtil.getUserId()); + projectDelayApply.setUpdateOn(LocalDateTime.now()); + projectDelayApplyService.save(projectDelayApply); //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.java new file mode 100644 index 0000000..4a205fb --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.projectlib.mapper; + +import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 项目延期申请记录表 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-06-15 + */ +public interface NdProjectDelayApplyMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.xml new file mode 100644 index 0000000..0413769 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectDelayApplyMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java new file mode 100644 index 0000000..7d9360c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java @@ -0,0 +1,57 @@ +package com.ningdatech.pmapi.projectlib.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; + +/** + *

+ * 项目延期申请记录表 + *

+ * + * @author CMM + * @since 2023-06-15 + */ +@Data +@TableName("nd_project_delay_apply") +@ApiModel(value = "NdProjectDelayApply对象", description = "项目延期申请记录表") +public class ProjectDelayApply implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("延期时间(几个月)") + private Integer delayTime; + + @ApiModelProperty("延期申请佐证材料") + private String delayApplyFile; + + @ApiModelProperty("延期申请理由") + private String delayApplyReason; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新人") + private Long updateBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("延期申请实例ID") + private String instanceId; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectDelayApplyService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectDelayApplyService.java new file mode 100644 index 0000000..613edde --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectDelayApplyService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.projectlib.service; + +import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 项目延期申请记录表 服务类 + *

+ * + * @author CMM + * @since 2023-06-15 + */ +public interface INdProjectDelayApplyService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectDelayApplyServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectDelayApplyServiceImpl.java new file mode 100644 index 0000000..845c6c4 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectDelayApplyServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.projectlib.service.impl; + +import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; +import com.ningdatech.pmapi.projectlib.mapper.NdProjectDelayApplyMapper; +import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 项目延期申请记录表 服务实现类 + *

+ * + * @author CMM + * @since 2023-06-15 + */ +@Service +public class NdProjectDelayApplyServiceImpl extends ServiceImpl implements INdProjectDelayApplyService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index a1abd6a..a8da302 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -6,13 +6,17 @@ import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; +import cn.hutool.core.date.DatePattern; import com.google.common.collect.Lists; +import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.file.service.FileService; import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; +import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; +import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; import org.apache.commons.lang3.StringUtils; -import org.checkerframework.checker.nullness.qual.Nullable; import org.flowable.engine.HistoryService; import org.flowable.engine.RuntimeService; import org.flowable.engine.TaskService; @@ -77,10 +81,9 @@ public class HandlerManage { private final IProjectInstService projectInstService; private final NoticeManage noticeManage; private final DeclaredProjectManage declaredProjectManage; - private final FileService fileService; - private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; + private final INdProjectDelayApplyService projectDelayApplyService; /** * 审核通过后 所处理的逻辑 @@ -93,6 +96,16 @@ public class HandlerManage { HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() .processInstanceId(instance.getId()) .singleResult(); + // 获取当前流程实例类型 + String instanceId = newInstance.getId(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId)); + Integer instType = projectInst.getInstType(); + InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); + if (Objects.isNull(instTypeEnum)){ + throw new BizException("当前审批流类型不存在,流程类型code:" + instType); + } + // 获取流程通过后当前流程详情 ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); // 获取流程通过后当前审核人信息,向其发送工作通知 @@ -124,41 +137,58 @@ public class HandlerManage { // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { - switch (Objects.requireNonNull(ProjectStatusEnum.getValue(declaredProject.getStatus()))) { - // 当前项目状态是预审中 - case PRE_APPLYING: - //先修改项目状态 - updatePassProjectStatus(userId, declaredProject); - //然后入库暂存库 - projectStagingService.addByProject(declaredProject,"暂存入库 待提交部门联审"); - break; - // 当前项目状态是单位内部审核中 - case UNDER_INTERNAL_AUDIT: + // 如果是申请延期和申请借阅审批流程,不走状态机 + if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ + switch (instTypeEnum) { + case APPLY_DELAY: + // 保存延期申请记录,更新项目建设周期和计划验收时间 + updateProjectDelayApplyInfo(declaredProject,instanceId); + break; + case APPLY_BORROW: + // 申请借阅审批逻辑 + break; + default: + throw new BizException("传入实例类型错误: " + instTypeEnum); + } + }else { + switch (Objects.requireNonNull(ProjectStatusEnum.getValue(declaredProject.getStatus()))) { + // 当前项目状态是预审中 + case PRE_APPLYING: + //先修改项目状态 + updatePassProjectStatus(userId, declaredProject); + //然后入库暂存库 + projectStagingService.addByProject(declaredProject, "暂存入库 待提交部门联审"); + break; + // 当前项目状态是单位内部审核中 + case UNDER_INTERNAL_AUDIT: // 当前项目状态是部门联审中 - case DEPARTMENT_JOINT_REVIEW: - //如果是 区县 并且 500万及以上要推送省局重大项目 - if(!StateMachineUtils.isCityProject(declaredProject) && - StateMachineUtils.judgeDeclareAmount(declaredProject, - ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT) ){ - try{ - List applications = projectApplicationService - .list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId,declaredProject.getId())); - joinReviewProvincialBureauService.pushImportProject( - ApplicationConverter.convertProject(declaredProject,applications,fileService)); - }catch (Exception e){ - log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName() ,e.getMessage()); - log.error("区县推送省级联审失败:" + e); + case DEPARTMENT_JOINT_REVIEW: + //如果是 区县 并且 500万及以上要推送省局重大项目 + if (!StateMachineUtils.isCityProject(declaredProject) && + StateMachineUtils.judgeDeclareAmount(declaredProject, + ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT)) { + try { + List applications = projectApplicationService + .list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId, declaredProject.getId())); + joinReviewProvincialBureauService.pushImportProject( + ApplicationConverter.convertProject(declaredProject, applications, fileService)); + updatePassProjectStatus(userId, declaredProject); + break; + } catch (Exception e) { + log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName(), e.getMessage()); + log.error("区县推送省级联审失败:" + e); + } } - } - // 当前项目状态是方案评审中 - case SCHEME_UNDER_REVIEW: - // 当前项目状态是终验审核中 - case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: - updatePassProjectStatus(userId, declaredProject); - break; - default: - throw new IllegalStateException("Unexpected value: " + declaredProject.getStatus()); + // 当前项目状态是方案评审中 + case SCHEME_UNDER_REVIEW: + // 当前项目状态是终验审核中 + case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: + updatePassProjectStatus(userId, declaredProject); + break; + default: + throw new BizException("传入项目状态错误: " + declaredProject.getStatus()); + } } //发送消息 noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), @@ -178,6 +208,26 @@ public class HandlerManage { } } + private void updateProjectDelayApplyInfo(Project declaredProject, String instanceId) { + // 获取延期申请填写的相关信息 + ProjectDelayApply delayApply = projectDelayApplyService.getOne(Wrappers.lambdaQuery(ProjectDelayApply.class) + .eq(ProjectDelayApply::getProjectId, declaredProject.getId()) + .eq(ProjectDelayApply::getInstanceId, instanceId)); + // 获取项目的立项批复时间和建设周期 + LocalDateTime approvalDate = declaredProject.getApprovalDate(); + String buildCycle = declaredProject.getBuildCycle(); + // 重新计算建设周期、验收时间 + String constructCycle = buildCycle + delayApply.getDelayTime(); + declaredProject.setBuildCycle(constructCycle); + Long delayedMonth = Long.valueOf(delayApply.getDelayTime()); + String acceptTime = NdDateUtils.format(approvalDate.plusMonths(delayedMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); + declaredProject.setBuildCycle(acceptTime); + declaredProject.setInstCode(instanceId); + declaredProject.setApplyDelayFile(delayApply.getDelayApplyFile()); + declaredProject.setApplyDelayReason(delayApply.getDelayApplyReason()); + projectService.updateById(declaredProject); + } + /** * 驳回后 所处理的逻辑 From ea806b6112736722c201896f226076930bfea604 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 15 Jun 2023 17:13:46 +0800 Subject: [PATCH 04/44] =?UTF-8?q?=E8=AE=BE=E7=BD=AEsession=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pmapi/src/main/java/com/ningdatech/pmapi/App.java | 2 ++ .../security/auth/config/RedisSessionConfig.java | 16 ++++++--- .../auth/config/RedisSessionTimeoutConfig.java | 38 ++++++++++++++++++++++ pmapi/src/main/resources/application-dev.yml | 1 + 4 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionTimeoutConfig.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/App.java b/pmapi/src/main/java/com/ningdatech/pmapi/App.java index e231688..f667f5f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/App.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/App.java @@ -10,11 +10,13 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; import org.springframework.transaction.annotation.EnableTransactionManagement; /** * @author liuxinxin */ +@EnableRedisHttpSession @SpringBootApplication @EnableAsync @MapperScan(App.MAPPER_PACKAGES) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java index 530d12e..3c6daed 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java @@ -2,12 +2,17 @@ package com.ningdatech.pmapi.user.security.auth.config;//package com.ningdatech. import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.user.security.auth.constants.SessionTimeConstant; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; +import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration; import org.springframework.session.web.http.CookieHttpSessionIdResolver; import org.springframework.session.web.http.DefaultCookieSerializer; +import javax.annotation.PostConstruct; + /** *

* 设置session的过期时间为一天 @@ -17,10 +22,9 @@ import org.springframework.session.web.http.DefaultCookieSerializer; * @Date 2020/7/29 9:46 上午 * @Version 1.0 **/ - @Configuration -// 设置session的过期时间为一天 -@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 24 * 60 * 60 * 10) +@RequiredArgsConstructor +@AutoConfigureAfter(RedisHttpSessionConfiguration.class) public class RedisSessionConfig { @Bean @@ -30,9 +34,11 @@ public class RedisSessionConfig { // 创建 DefaultCookieSerializer 对象 DefaultCookieSerializer cookieSerializer = new DefaultCookieSerializer(); - sessionIdResolver.setCookieSerializer(cookieSerializer); // 设置到 sessionIdResolver 中 + sessionIdResolver.setCookieSerializer(cookieSerializer); + // 设置到 sessionIdResolver 中 cookieSerializer.setCookieName(BizConst.COOKIE_KEY); cookieSerializer.setCookieMaxAge(SessionTimeConstant.SESSION_TIME_SECONDS); return sessionIdResolver; } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionTimeoutConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionTimeoutConfig.java new file mode 100644 index 0000000..99676cf --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionTimeoutConfig.java @@ -0,0 +1,38 @@ +package com.ningdatech.pmapi.user.security.auth.config; + +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.context.annotation.Configuration; +import org.springframework.session.data.redis.RedisIndexedSessionRepository; +import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration; + +import javax.annotation.PostConstruct; + +/** + *

+ * 设置session的过期时间为一天 + *

+ * + * @Author LiuXinXin + * @Date 2020/7/29 9:46 上午 + * @Version 1.0 + **/ +@Configuration +@RequiredArgsConstructor +@AutoConfigureAfter(RedisHttpSessionConfiguration.class) +public class RedisSessionTimeoutConfig { + + @Value("${spring.session.timeout:60 * 60 * 4}") + private Integer springSessionTimeout; + + private final RedisHttpSessionConfiguration redisHttpSessionConfiguration; + private final RedisIndexedSessionRepository redisIndexedSessionRepository; + + @PostConstruct + public void sessionTimeoutTime() { + redisHttpSessionConfiguration.setMaxInactiveIntervalInSeconds(springSessionTimeout); + redisIndexedSessionRepository.setDefaultMaxInactiveInterval(springSessionTimeout); + } + +} diff --git a/pmapi/src/main/resources/application-dev.yml b/pmapi/src/main/resources/application-dev.yml index e95eb4f..6820c94 100644 --- a/pmapi/src/main/resources/application-dev.yml +++ b/pmapi/src/main/resources/application-dev.yml @@ -11,6 +11,7 @@ spring: store-type: redis redis: namespace: "spring:session" + timeout: 864000 redis: timeout: 5000 host: 47.98.125.47 From c04f12d4bb9b6e1507d7a9cbd9665c9f3eba7635 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 15 Jun 2023 19:24:14 +0800 Subject: [PATCH 05/44] =?UTF-8?q?=E8=AE=BE=E7=BD=AEsession=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pmapi/src/main/java/com/ningdatech/pmapi/App.java | 2 -- .../pmapi/user/security/auth/config/RedisSessionConfig.java | 10 ++-------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/App.java b/pmapi/src/main/java/com/ningdatech/pmapi/App.java index f667f5f..e231688 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/App.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/App.java @@ -10,13 +10,11 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; import org.springframework.transaction.annotation.EnableTransactionManagement; /** * @author liuxinxin */ -@EnableRedisHttpSession @SpringBootApplication @EnableAsync @MapperScan(App.MAPPER_PACKAGES) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java index 3c6daed..1eaec87 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java @@ -2,17 +2,12 @@ package com.ningdatech.pmapi.user.security.auth.config;//package com.ningdatech. import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.user.security.auth.constants.SessionTimeConstant; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration; +import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; import org.springframework.session.web.http.CookieHttpSessionIdResolver; import org.springframework.session.web.http.DefaultCookieSerializer; -import javax.annotation.PostConstruct; - /** *

* 设置session的过期时间为一天 @@ -23,8 +18,7 @@ import javax.annotation.PostConstruct; * @Version 1.0 **/ @Configuration -@RequiredArgsConstructor -@AutoConfigureAfter(RedisHttpSessionConfiguration.class) +@EnableRedisHttpSession public class RedisSessionConfig { @Bean From 65cf966defeb2b6d96d2a0736b9b25265f093a0d Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 15 Jun 2023 19:43:17 +0800 Subject: [PATCH 06/44] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=BB=B6=E6=9C=9F?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E6=B5=81=E7=A8=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectdeclared/manage/DelayedApplyManage.java | 2 +- .../pmapi/projectlib/manage/ProjectLibManage.java | 7 ++++++ .../pmapi/todocenter/handle/WithDrawHandle.java | 15 +++++++++++++ .../pmapi/todocenter/manage/HandlerManage.java | 25 ++++++++++++++++------ 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java index a7d66cd..bfef5a1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java @@ -230,7 +230,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(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 48f2df7..14c7385 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -616,6 +616,13 @@ public class ProjectLibManage { public void saveProjectByApplyDelay(DelayedApplyDTO dto, Project project, String instanceId) { + // 更新项目流程实例ID + project.setInstCode(instanceId); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + projectService.updateById(project); + + // 保存延期申请信息 ProjectDelayApply projectDelayApply = new ProjectDelayApply(); projectDelayApply.setDelayTime(dto.getDelayedMonth()); projectDelayApply.setDelayApplyFile(dto.getSupportingMaterials()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/handle/WithDrawHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/handle/WithDrawHandle.java index 5dca80d..c8b4abb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/handle/WithDrawHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/handle/WithDrawHandle.java @@ -1,8 +1,12 @@ package com.ningdatech.pmapi.todocenter.handle; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.exception.BizException; import com.ningdatech.pmapi.common.helper.UserInfoHelper; +import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; +import com.ningdatech.pmapi.projectlib.service.IProjectInstService; import com.ningdatech.pmapi.todocenter.constant.TodoCenterContant; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; @@ -44,6 +48,7 @@ public class WithDrawHandle { private final HistoryService historyService; private final RepositoryService repositoryService; + private final IProjectInstService projectInstService; /** * 判断 当前流程 可否被当前登录人 所撤回 @@ -306,6 +311,16 @@ public class WithDrawHandle { */ public boolean canRootWithDraw(HistoricProcessInstance instance,String employeeCode) { String startUserId = instance.getStartUserId(); + // 如果是申请延期或者申请借阅审批流程,流程发起人不能撤回,直接返回false + String instanceId = instance.getId(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId)); + Integer instType = projectInst.getInstType(); + + if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || + InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ + return Boolean.FALSE; + } //如果流程发起人 不是 当前登录人 直接返回false if(StringUtils.isBlank(employeeCode) || StringUtils.isBlank(startUserId) || !employeeCode.equals(startUserId)){ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index a8da302..49cbc28 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -3,6 +3,7 @@ package com.ningdatech.pmapi.todocenter.manage; import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeContant.*; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; @@ -145,7 +146,7 @@ public class HandlerManage { updateProjectDelayApplyInfo(declaredProject,instanceId); break; case APPLY_BORROW: - // 申请借阅审批逻辑 + //TODO 申请借阅审批逻辑 break; default: throw new BizException("传入实例类型错误: " + instTypeEnum); @@ -217,11 +218,13 @@ public class HandlerManage { LocalDateTime approvalDate = declaredProject.getApprovalDate(); String buildCycle = declaredProject.getBuildCycle(); // 重新计算建设周期、验收时间 - String constructCycle = buildCycle + delayApply.getDelayTime(); + String constructCycle = String.valueOf(Integer.parseInt(buildCycle) + delayApply.getDelayTime()); declaredProject.setBuildCycle(constructCycle); - Long delayedMonth = Long.valueOf(delayApply.getDelayTime()); - String acceptTime = NdDateUtils.format(approvalDate.plusMonths(delayedMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); - declaredProject.setBuildCycle(acceptTime); + Long constructMonth = Long.valueOf(constructCycle); + declaredProject.setBuildCycle(String.valueOf(constructMonth)); + String acceptTime = NdDateUtils.format(approvalDate.plusMonths(constructMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); + LocalDateTime time = LocalDateTime.parse(acceptTime, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); + declaredProject.setPlanAcceptanceTime(time); declaredProject.setInstCode(instanceId); declaredProject.setApplyDelayFile(delayApply.getDelayApplyFile()); declaredProject.setApplyDelayReason(delayApply.getDelayApplyReason()); @@ -236,8 +239,16 @@ public class HandlerManage { */ public void afterRejectTodo(Project declaredProject, HistoricProcessInstance instance) { Long userId = LoginUserUtil.getUserId(); - // 更新项目状态和流程状态 - updateRejectProjectStatus(userId, declaredProject); + // 获取当前流程实例类型 + String instanceId = declaredProject.getInstCode(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId)); + Integer instType = projectInst.getInstType(); + // 审批流程不是申请延期和申请借阅,需调用状态机 + if (!InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && !InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { + // 更新项目状态和流程状态 + updateRejectProjectStatus(userId, declaredProject); + } //发送消息 noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), REJECT_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW_REJECT); From dc065b16ecca83ca7e929cab8eb1e908bf5b280b Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 16 Jun 2023 09:23:35 +0800 Subject: [PATCH 07/44] =?UTF-8?q?=E8=AE=BE=E7=BD=AEsession=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/config/RedisSessionTimeoutConfig.java | 38 ---------------------- .../security/auth/config/SessionTimeoutConfig.java | 38 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 38 deletions(-) delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionTimeoutConfig.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/SessionTimeoutConfig.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionTimeoutConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionTimeoutConfig.java deleted file mode 100644 index 99676cf..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionTimeoutConfig.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ningdatech.pmapi.user.security.auth.config; - -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.AutoConfigureAfter; -import org.springframework.context.annotation.Configuration; -import org.springframework.session.data.redis.RedisIndexedSessionRepository; -import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration; - -import javax.annotation.PostConstruct; - -/** - *

- * 设置session的过期时间为一天 - *

- * - * @Author LiuXinXin - * @Date 2020/7/29 9:46 上午 - * @Version 1.0 - **/ -@Configuration -@RequiredArgsConstructor -@AutoConfigureAfter(RedisHttpSessionConfiguration.class) -public class RedisSessionTimeoutConfig { - - @Value("${spring.session.timeout:60 * 60 * 4}") - private Integer springSessionTimeout; - - private final RedisHttpSessionConfiguration redisHttpSessionConfiguration; - private final RedisIndexedSessionRepository redisIndexedSessionRepository; - - @PostConstruct - public void sessionTimeoutTime() { - redisHttpSessionConfiguration.setMaxInactiveIntervalInSeconds(springSessionTimeout); - redisIndexedSessionRepository.setDefaultMaxInactiveInterval(springSessionTimeout); - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/SessionTimeoutConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/SessionTimeoutConfig.java new file mode 100644 index 0000000..bbf7bd5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/SessionTimeoutConfig.java @@ -0,0 +1,38 @@ +package com.ningdatech.pmapi.user.security.auth.config; + +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.context.annotation.Configuration; +import org.springframework.session.data.redis.RedisIndexedSessionRepository; +import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration; + +import javax.annotation.PostConstruct; + +/** + *

+ * 设置session的过期时间为一天 + *

+ * + * @Author LiuXinXin + * @Date 2020/7/29 9:46 上午 + * @Version 1.0 + **/ +@Configuration +@RequiredArgsConstructor +@AutoConfigureAfter(RedisHttpSessionConfiguration.class) +public class SessionTimeoutConfig { + + @Value("${spring.session.timeout:14400}") + private Integer springSessionTimeout; + + private final RedisHttpSessionConfiguration redisHttpSessionConfiguration; + private final RedisIndexedSessionRepository redisIndexedSessionRepository; + + @PostConstruct + public void sessionTimeoutTime() { + redisHttpSessionConfiguration.setMaxInactiveIntervalInSeconds(springSessionTimeout); + redisIndexedSessionRepository.setDefaultMaxInactiveInterval(springSessionTimeout); + } + +} From cc440c5d56401666e6996abe4822d9205e704772 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 16 Jun 2023 10:24:32 +0800 Subject: [PATCH 08/44] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=AF=BB=E6=89=BE?= =?UTF-8?q?=E4=B8=8B=E4=B8=80=E4=B8=AAtaskId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/todocenter/manage/TodoCenterManage.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index e8cd08b..ba3f283 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -1309,6 +1309,16 @@ public class TodoCenterManage { .asc() .list(); if(CollUtil.isEmpty(tasks)){ + //如果此子单位为空 那就直接再查下 他的其它任务 + List currentTasks = taskService.createTaskQuery() + .processInstanceId(instance.getId()) + .taskAssignee(employeeCode) + .orderByTaskCreateTime() + .asc() + .list(); + if(CollUtil.isNotEmpty(currentTasks)){ + return currentTasks.get(0).getId(); + } return taskId; } return tasks.get(0).getId(); From 208a4da61007eb7a738a959a070f8b3ddf55f23d Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Fri, 16 Jun 2023 10:54:43 +0800 Subject: [PATCH 09/44] =?UTF-8?q?=E5=BB=B6=E6=9C=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectdeclared/manage/DelayedApplyManage.java | 17 +++++++++++++++++ .../pmapi/projectlib/model/vo/ProjectLibListItemVO.java | 3 +++ 2 files changed, 20 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java index bfef5a1..b8bd7df 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java @@ -45,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; @@ -53,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; @@ -88,6 +91,7 @@ public class DelayedApplyManage { private final ProjectLibManage projectLibManage; private final NoticeManage noticeManage; private final IProjectInstService projectInstService; + private final HistoryService historyService; /** * 延期的-项目列表 @@ -132,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); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java index 30fd30a..8cc1c39 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java @@ -133,6 +133,9 @@ public class ProjectLibListItemVO { @ApiModelProperty("是否有上级条线主管部门 0没有 1有") private Integer isHigherSuperOrg; + @ApiModelProperty("是否可以申请延期") + private Boolean canDelayApply = Boolean.TRUE; + //预审申报时候 需不需要上传上级条线意见文件 private Boolean needUploadSuperLineFile; public Boolean getNeedUploadSuperLineFile() { From 3ffd20b9c56a3f7d0e12675b147a3499c31cf770 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Fri, 16 Jun 2023 17:25:04 +0800 Subject: [PATCH 10/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=80=9F=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/GeneratorCodeKingbaseConfig.java | 2 +- .../controller/ProjectFileController.java | 3 +- .../pmapi/filemanage/manage/ProjectFileManage.java | 93 +++++++++++++++++++++- .../mapper/NdProjectApplyBorrowMapper.java | 16 ++++ .../mapper/NdProjectApplyBorrowMapper.xml | 5 ++ .../model/entity/ProjectApplyBorrow.java | 57 +++++++++++++ .../filemanage/model/vo/ProjectFileListVO.java | 3 + .../service/INdProjectApplyBorrowService.java | 16 ++++ .../impl/NdProjectApplyBorrowServiceImpl.java | 20 +++++ .../pmapi/projectlib/manage/ProjectLibManage.java | 36 ++++++++- .../pmapi/todocenter/manage/HandlerManage.java | 24 +++++- 11 files changed, 268 insertions(+), 7 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/ProjectApplyBorrow.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/INdProjectApplyBorrowService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/NdProjectApplyBorrowServiceImpl.java diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index 36675c5..7d4f1d0 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -57,7 +57,7 @@ public class GeneratorCodeKingbaseConfig { public static void main(String[] args) { //generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); - generate("CMM", "test", PATH_CMM, "nd_project_delay_apply"); + generate("CMM", "test", PATH_CMM, "nd_project_apply_borrow"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java index 557c915..3bc5a69 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java @@ -43,6 +43,7 @@ public class ProjectFileController { @ApiOperation(value = "申请借阅", notes = "申请借阅") @WebLog("档案管理-项目档案-申请借阅") public String wantRead(@PathVariable Long projectId){ - return projectFileManage.wantRead(projectId); + String instanceId = projectFileManage.startApplyBorrowProcess(projectId); + return "启动申请借阅流程实例 【" + instanceId + "】 成功"; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index 5da888a..a1d26e9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -2,20 +2,47 @@ package com.ningdatech.pmapi.filemanage.manage; 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.common.constant.BizConst; +import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; +import com.ningdatech.pmapi.common.helper.UserInfoHelper; 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.projectdeclared.manage.DefaultDeclaredProjectManage; +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.ProjectInst; import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; +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.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.history.HistoricProcessInstance; import org.springframework.stereotype.Component; +import java.time.LocalDateTime; +import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -30,8 +57,14 @@ 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; public PageVo list(ProjectFileListParam param) { Page page = param.page(); @@ -50,6 +83,19 @@ public class ProjectFileManage { 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)); + Integer instType = projectInst.getInstType(); + if (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()); @@ -65,4 +111,49 @@ public class ProjectFileManage { 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.ARCHIVED.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 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; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.java new file mode 100644 index 0000000..50545f3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.java @@ -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; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-06-16 + */ +public interface NdProjectApplyBorrowMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.xml new file mode 100644 index 0000000..6a6fa76 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/mapper/NdProjectApplyBorrowMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/ProjectApplyBorrow.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/ProjectApplyBorrow.java new file mode 100644 index 0000000..be5fffc --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/entity/ProjectApplyBorrow.java @@ -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; + +/** + *

+ * + *

+ * + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileListVO.java index f7b2657..c4b4d90 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileListVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileListVO.java @@ -33,4 +33,7 @@ public class ProjectFileListVO { @ApiModelProperty("最后修改时间") private LocalDateTime updateOn; + + @ApiModelProperty("是否可以申请借阅") + private Boolean canApplyBorrow = Boolean.TRUE; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/INdProjectApplyBorrowService.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/INdProjectApplyBorrowService.java new file mode 100644 index 0000000..c4667e7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/INdProjectApplyBorrowService.java @@ -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; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-06-16 + */ +public interface INdProjectApplyBorrowService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/NdProjectApplyBorrowServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/NdProjectApplyBorrowServiceImpl.java new file mode 100644 index 0000000..a76740e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/impl/NdProjectApplyBorrowServiceImpl.java @@ -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; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-06-16 + */ +@Service +public class NdProjectApplyBorrowServiceImpl extends ServiceImpl implements INdProjectApplyBorrowService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 14c7385..f6dd325 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -3,7 +3,6 @@ package com.ningdatech.pmapi.projectlib.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.DatePattern; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -11,7 +10,6 @@ import com.google.common.collect.Lists; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.file.entity.File; import com.ningdatech.file.service.FileService; import com.ningdatech.pmapi.common.constant.CommonConst; @@ -19,13 +17,14 @@ import com.ningdatech.pmapi.common.constant.RegionConst; import com.ningdatech.pmapi.common.enumeration.CommonEnum; import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.util.BizUtils; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.datascope.model.DataScopeDTO; import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; +import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow; +import com.ningdatech.pmapi.filemanage.service.INdProjectApplyBorrowService; import com.ningdatech.pmapi.projectdeclared.model.dto.DelayedApplyDTO; import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; @@ -79,6 +78,7 @@ public class ProjectLibManage { private final IProjectInstService projectInstService; private final StateMachineUtils stateMachineUtils; private final INdProjectDelayApplyService projectDelayApplyService; + private final INdProjectApplyBorrowService projectApplyBorrowService; public PageVo projectLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); @@ -644,4 +644,34 @@ public class ProjectLibManage { projectInst.setUpdateOn(LocalDateTime.now()); projectInstService.save(projectInst); } + + public void saveProjectByApplyBorrow(Project project, UserFullInfoDTO user, String instanceId) { + // 更新项目流程实例ID + project.setInstCode(instanceId); + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); + projectService.updateById(project); + + // 保存项目借阅信息 + ProjectApplyBorrow projectApplyBorrow = new ProjectApplyBorrow(); + projectApplyBorrow.setProjectId(project.getId()); + projectApplyBorrow.setApplyBorrowEmployeeCode(user.getEmployeeCode()); + projectApplyBorrow.setApplyBorrowEmpPosUnitCode(user.getEmpPosUnitCode()); + projectApplyBorrow.setInstanceId(instanceId); + projectApplyBorrow.setCreateOn(LocalDateTime.now()); + projectApplyBorrow.setCreateBy(LoginUserUtil.getUserId()); + projectApplyBorrow.setUpdateOn(LocalDateTime.now()); + projectApplyBorrow.setUpdateBy(LoginUserUtil.getUserId()); + projectApplyBorrow.setIsSuccess(Boolean.FALSE); + projectApplyBorrowService.save(projectApplyBorrow); + + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setInstType(InstTypeEnum.APPLY_BORROW.getCode()); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInstService.save(projectInst); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index 49cbc28..125e1db 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -12,6 +12,8 @@ import com.google.common.collect.Lists; import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.file.service.FileService; import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; +import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow; +import com.ningdatech.pmapi.filemanage.service.INdProjectApplyBorrowService; import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; @@ -85,6 +87,8 @@ public class HandlerManage { private final FileService fileService; private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; private final INdProjectDelayApplyService projectDelayApplyService; + private final INdProjectApplyBorrowService projectApplyBorrowService; + /** * 审核通过后 所处理的逻辑 @@ -146,7 +150,8 @@ public class HandlerManage { updateProjectDelayApplyInfo(declaredProject,instanceId); break; case APPLY_BORROW: - //TODO 申请借阅审批逻辑 + // 更新申请借阅状态为成功 + updateProjectApplyBorrowInfo(declaredProject,instanceId); break; default: throw new BizException("传入实例类型错误: " + instTypeEnum); @@ -209,6 +214,23 @@ public class HandlerManage { } } + private void updateProjectApplyBorrowInfo(Project declaredProject, String instanceId) { + + // 获取申请借阅信息 + ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .eq(ProjectApplyBorrow::getProjectId, declaredProject.getId()) + .eq(ProjectApplyBorrow::getInstanceId, instanceId)); + // 更新项目借阅信息为成功 + projectApplyBorrow.setProjectId(declaredProject.getId()); + projectApplyBorrow.setInstanceId(instanceId); + projectApplyBorrow.setIsSuccess(Boolean.TRUE); + projectApplyBorrow.setCreateOn(LocalDateTime.now()); + projectApplyBorrow.setCreateBy(LoginUserUtil.getUserId()); + projectApplyBorrow.setUpdateOn(LocalDateTime.now()); + projectApplyBorrow.setUpdateBy(LoginUserUtil.getUserId()); + projectApplyBorrowService.updateById(projectApplyBorrow); + } + private void updateProjectDelayApplyInfo(Project declaredProject, String instanceId) { // 获取延期申请填写的相关信息 ProjectDelayApply delayApply = projectDelayApplyService.getOne(Wrappers.lambdaQuery(ProjectDelayApply.class) From e33342d676ee58c5c91db5330a8717674f88b9ad Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Mon, 19 Jun 2023 10:25:00 +0800 Subject: [PATCH 11/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/filemanage/manage/ProjectFileManage.java | 129 ++++++++++++++++++--- 1 file changed, 116 insertions(+), 13 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index a1d26e9..c1e8580 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -1,15 +1,21 @@ package com.ningdatech.pmapi.filemanage.manage; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; import com.ningdatech.pmapi.common.helper.UserInfoHelper; +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.DefaultDeclaredProjectManage; import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; @@ -34,15 +40,13 @@ import com.wflow.workflow.service.ProcessModelService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.checkerframework.checker.nullness.qual.Nullable; import org.flowable.engine.HistoryService; import org.flowable.engine.history.HistoricProcessInstance; import org.springframework.stereotype.Component; import java.time.LocalDateTime; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -65,25 +69,103 @@ public class ProjectFileManage { private final NoticeManage noticeManage; private final IProjectInstService projectInstService; private final HistoryService historyService; + private final INdProjectApplyBorrowService projectApplyBorrowService; + private final IDingOrganizationService dingOrganizationService; public PageVo list(ProjectFileListParam param) { - Page 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()) + + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String employeeCode = userFullInfo.getEmployeeCode(); + String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + + // Page 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.ARCHIVED.getCode()) + // .orderByDesc(Project::getUpdateOn)); + //if(0L == page.getTotal()){ + // return PageVo.empty(); + //} + //List vos = page.getRecords().stream().map(p -> { + // ProjectFileListVO vo = new ProjectFileListVO(); + // vo.setId(p.getId()); + // // 判断该项目是否可以查阅(用户只可查阅自己及下属单位的项目档案) + // List ordCodeList = Lists.newArrayList(); + // String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); + // ordCodeList.add(empPosUnitCode); + // List subOrgList = dingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + // .eq(DingOrganization::getParentCode, empPosUnitCode)); + // if (CollUtil.isNotEmpty(subOrgList)){ + // + // } + // + // 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)); + // 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()); + + Set subOrgSet = getSubOrgList(empPosUnitCode); + List projectList = projectService.list(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.ARCHIVED.getCode()) + // 查出自己及下属单位可查阅的项目档案 + .in(Project::getBuildOrgCode,subOrgSet) .orderByDesc(Project::getUpdateOn)); - if(0L == page.getTotal()){ + // 从申请借阅信息表中查出本单位审批通过的项目添加到列表中 + HashSet borrowProjectIdSet = new HashSet<>(); + List applyBorrowList = projectApplyBorrowService.list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .eq(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, empPosUnitCode) + .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)).stream() + .filter(a -> borrowProjectIdSet.add(a.getProjectId())) + .collect(Collectors.toList()); + for (ProjectApplyBorrow applyBorrow : applyBorrowList) { + Long projectId = applyBorrow.getProjectId(); + if (Objects.nonNull(projectId)){ + Project project = projectService.getById(projectId); + projectList.add(project); + } + } + + if (CollUtil.isEmpty(projectList)){ return PageVo.empty(); } - List vos = page.getRecords().stream().map(p -> { + + List records = projectList.stream().skip((long) (pageNumber - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + + List vos = records.stream().map(p -> { ProjectFileListVO vo = new ProjectFileListVO(); vo.setId(p.getId()); vo.setCanRead(Boolean.TRUE); vo.setBuildOrgName(p.getBuildOrgName()); vo.setPojectCode(p.getProjectCode()); vo.setProjectName(p.getProjectName()); - // 判断当前项目是否已经开启了申请借阅并且没有审批完成 + // 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 String instCode = p.getInstCode(); // 获取流程通过后的流程实例 HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() @@ -92,13 +174,34 @@ public class ProjectFileManage { ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .eq(ProjectInst::getInstCode, instCode)); Integer instType = projectInst.getInstType(); - if (InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && + // 从申请借阅信息表中查询当前项目是否有当前登录用户发起的申请借阅审批流程 + 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,projectList.size()); + } + + private Set getSubOrgList(String empPosUnitCode) { + HashSet orgSet = new HashSet<>(); + // 先将自己加入子集 + orgSet.add(empPosUnitCode); + Set 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) { From 43bb1d9e3dfd769b160223720f23b3dec2ba0397 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Mon, 19 Jun 2023 10:59:47 +0800 Subject: [PATCH 12/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=80=9F=E9=98=85=E4=BF=A1=E6=81=AF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/filemanage/manage/ProjectFileManage.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index c1e8580..7d4b1ed 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -133,14 +133,12 @@ public class ProjectFileManage { .like(StringUtils.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) .like(StringUtils.isNotBlank(param.getBuildOrgName()), Project::getBuildOrgName, param.getBuildOrgName()) .eq(Project::getStatus, ProjectStatusEnum.ARCHIVED.getCode()) - // 查出自己及下属单位可查阅的项目档案 - .in(Project::getBuildOrgCode,subOrgSet) .orderByDesc(Project::getUpdateOn)); - // 从申请借阅信息表中查出本单位审批通过的项目添加到列表中 + // 从申请借阅信息表中查出本单位及下属单位审批通过的项目添加到列表中 HashSet borrowProjectIdSet = new HashSet<>(); List applyBorrowList = projectApplyBorrowService.list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .eq(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, empPosUnitCode) + .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode,subOrgSet) .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)).stream() .filter(a -> borrowProjectIdSet.add(a.getProjectId())) .collect(Collectors.toList()); @@ -161,13 +159,16 @@ public class ProjectFileManage { List vos = records.stream().map(p -> { ProjectFileListVO vo = new ProjectFileListVO(); vo.setId(p.getId()); - vo.setCanRead(Boolean.TRUE); + // 用户只可查阅自己及下属单位的项目档案; + if (subOrgSet.contains(p.getBuildOrgCode())) { + 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(); From e6b26674b3b81bd76587ca84d966827468b20130 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Mon, 19 Jun 2023 11:12:40 +0800 Subject: [PATCH 13/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/filemanage/manage/ProjectFileManage.java | 129 +++++++-------------- 1 file changed, 40 insertions(+), 89 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index 7d4b1ed..bdba048 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -80,81 +80,37 @@ public class ProjectFileManage { Integer pageNumber = param.getPageNumber(); Integer pageSize = param.getPageSize(); - // Page 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.ARCHIVED.getCode()) - // .orderByDesc(Project::getUpdateOn)); - //if(0L == page.getTotal()){ - // return PageVo.empty(); - //} - //List vos = page.getRecords().stream().map(p -> { - // ProjectFileListVO vo = new ProjectFileListVO(); - // vo.setId(p.getId()); - // // 判断该项目是否可以查阅(用户只可查阅自己及下属单位的项目档案) - // List ordCodeList = Lists.newArrayList(); - // String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); - // ordCodeList.add(empPosUnitCode); - // List subOrgList = dingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - // .eq(DingOrganization::getParentCode, empPosUnitCode)); - // if (CollUtil.isNotEmpty(subOrgList)){ - // - // } - // - // 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)); - // 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()); - Set subOrgSet = getSubOrgList(empPosUnitCode); List projectList = projectService.list(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.ARCHIVED.getCode()) - .orderByDesc(Project::getUpdateOn)); + .like(StringUtils.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) + .like(StringUtils.isNotBlank(param.getBuildOrgName()), Project::getBuildOrgName, param.getBuildOrgName()) + .eq(Project::getStatus, ProjectStatusEnum.ARCHIVED.getCode()).orderByDesc(Project::getUpdateOn)); // 从申请借阅信息表中查出本单位及下属单位审批通过的项目添加到列表中 HashSet borrowProjectIdSet = new HashSet<>(); - List applyBorrowList = projectApplyBorrowService.list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode,subOrgSet) - .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)).stream() - .filter(a -> borrowProjectIdSet.add(a.getProjectId())) - .collect(Collectors.toList()); + List applyBorrowList = projectApplyBorrowService + .list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) + .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) + .stream().filter(a -> borrowProjectIdSet.add(a.getProjectId())).collect(Collectors.toList()); for (ProjectApplyBorrow applyBorrow : applyBorrowList) { Long projectId = applyBorrow.getProjectId(); - if (Objects.nonNull(projectId)){ + if (Objects.nonNull(projectId)) { Project project = projectService.getById(projectId); projectList.add(project); } } + // 对整合后的档案列表去重 + HashSet projectIdSet = new HashSet<>(); + List projects = + projectList.stream().filter(p -> projectIdSet.add(p.getId())).collect(Collectors.toList()); - if (CollUtil.isEmpty(projectList)){ + if (CollUtil.isEmpty(projects)) { return PageVo.empty(); } - List records = projectList.stream().skip((long) (pageNumber - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + List records = + projects.stream().skip((long)(pageNumber - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); List vos = records.stream().map(p -> { ProjectFileListVO vo = new ProjectFileListVO(); @@ -169,35 +125,32 @@ public class ProjectFileManage { // 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 String instCode = p.getInstCode(); // 获取流程实例 - HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(instCode) - .singleResult(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instCode)); + HistoricProcessInstance newInstance = + historyService.createHistoricProcessInstanceQuery().processInstanceId(instCode).singleResult(); + ProjectInst projectInst = projectInstService + .getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); 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())){ + 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,projectList.size()); + return PageVo.of(vos, projectList.size()); } private Set getSubOrgList(String empPosUnitCode) { HashSet orgSet = new HashSet<>(); // 先将自己加入子集 orgSet.add(empPosUnitCode); - Set subOrgList = dingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getParentCode, empPosUnitCode)).stream() - .map(DingOrganization::getOrganizationCode) - .collect(Collectors.toSet()); + Set 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)); @@ -208,7 +161,6 @@ public class ProjectFileManage { public ProjectFileVO file(Long projectId) { ProjectDetailVO projectDetailVo = projectLibManage.getProjectDetail(projectId); - return null; } @@ -224,16 +176,14 @@ public class ProjectFileManage { Project project = projectService.getNewProject(projectId); VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); - //首先要判断 项目当前状态 是不是 已归档 - VUtils.isTrue(!ProjectStatusEnum.ARCHIVED.getCode().equals(project.getStatus())) - .throwMessage("提交失败 该项目不是 已归档"); + // 首先要判断 项目当前状态 是不是 已归档 + VUtils.isTrue(!ProjectStatusEnum.ARCHIVED.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)); + .eq(WflowModels::getRegionCode, regionCode) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_BORROW.getCode()).last(BizConst.LIMIT_1)); if (Objects.isNull(model)) { log.error("此 【{}】区域找不到申请借阅流程配置", regionCode); @@ -243,20 +193,21 @@ public class ProjectFileManage { ProcessStartParamsVo params = new ProcessStartParamsVo(); params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); params.setProcessUsers(Collections.emptyMap()); - //放入条件判断的项目字段 - //把条件值给放入工作流 + // 放入条件判断的项目字段 + // 把条件值给放入工作流 defaultDeclaredProjectManage.buildCondition(params, project); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, project); - String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); + 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); + // 发送给第一个审批人消息 + noticeManage.sendFirtUser(project, model.getFormName(), instanceId, WorkNoticeContant.PASS_MSG_TEMPLATE, + MsgTypeEnum.PROJECT_REVIEW); return instanceId; } From fbcf527e94beba97e63db0ff7af3dca6c9a07b37 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 19 Jun 2023 18:11:14 +0800 Subject: [PATCH 14/44] =?UTF-8?q?=E7=BB=A9=E6=95=88=E8=AF=84=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/handler/GlobalResponseHandler.java | 3 +- .../controller/PerformanceAppraisalController.java | 54 ++++ .../convert/PerformanceAppraisalConveter.java | 71 +++++ .../manage/PerformanceAppraisalManage.java | 347 +++++++++++++++++++++ .../PerformanceAppraisalApplicationMapper.java | 16 + .../PerformanceAppraisalApplicationMapper.xml | 5 + .../mapper/PerformanceAppraisalMapper.java | 17 + .../mapper/PerformanceAppraisalMapper.xml | 5 + .../mapper/PerformanceAppraisalProjectMapper.java | 17 + .../mapper/PerformanceAppraisalProjectMapper.xml | 5 + .../performance/model/dto/AppraisalProjectDTO.java | 24 ++ .../model/dto/PerformanceAppraisalCreateDTO.java | 64 ++++ .../model/dto/PerformanceAppraisalEditDTO.java | 66 ++++ .../model/entity/PerformanceAppraisal.java | 58 ++++ .../entity/PerformanceAppraisalApplication.java | 40 +++ .../model/entity/PerformanceAppraisalProject.java | 46 +++ .../model/req/PerformanceAppraisalListReq.java | 32 ++ .../vo/PerformanceAppraisalApplicationVO.java | 38 +++ .../model/vo/PerformanceAppraisalProjectVO.java | 41 +++ .../model/vo/PerformanceAppraisalVO.java | 60 ++++ .../IPerformanceAppraisalApplicationService.java | 16 + .../IPerformanceAppraisalProjectService.java | 16 + .../service/IPerformanceAppraisalService.java | 16 + ...PerformanceAppraisalApplicationServiceImpl.java | 21 ++ .../PerformanceAppraisalProjectServiceImpl.java | 21 ++ .../impl/PerformanceAppraisalServiceImpl.java | 20 ++ 26 files changed, 1118 insertions(+), 1 deletion(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalProjectDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisal.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalApplicationService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalApplicationServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java index 4bae14f..112dd95 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java @@ -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 { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalController.java new file mode 100644 index 0000000..fb26b7d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalController.java @@ -0,0 +1,54 @@ +package com.ningdatech.pmapi.performance.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.ningdatech.pmapi.performance.manage.PerformanceAppraisalManage; +import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalCreateDTO; +import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalEditDTO; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; +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 PerformanceAppraisalController + * @Description + * @Date 2023/6/19 14:16 + * @Author PoffyZhang + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "绩效评价控制器") +@RequestMapping("/api/v1/performance-appraisal") +public class PerformanceAppraisalController { + + private final PerformanceAppraisalManage performanceAppraisalManage; + + @GetMapping("/list") + @ApiOperation("绩效列表") + public PageVo list(PerformanceAppraisalListReq req) { + return performanceAppraisalManage.list(req); + } + + @GetMapping("/detail/{id}") + @ApiOperation("绩效详情") + public PerformanceAppraisalVO detail(@PathVariable Long id) { + return performanceAppraisalManage.detail(id); + } + + @PostMapping("/create") + @ApiOperation("新建绩效") + @WebLog("新建绩效") + public String create(PerformanceAppraisalCreateDTO createDTO) { + return performanceAppraisalManage.create(createDTO); + } + + @PostMapping("/edit") + @ApiOperation("编辑绩效") + @WebLog("编辑绩效") + public String edit(PerformanceAppraisalEditDTO editDTO) { + return performanceAppraisalManage.edit(editDTO); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java new file mode 100644 index 0000000..f2680f3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java @@ -0,0 +1,71 @@ +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 convertProjects( + List projects, Map 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.getProjectId())){ + Project project = map.get(p.getProjectId()); + vo.setProjectName(project.getProjectName()); + vo.setProjectType(project.getProjectType()); + vo.setProjectTypeName(getProjectTypeName(project.getProjectType())); + vo.setBuildOrgName(project.getBuildOrgName()); + } + return vo; + }).collect(Collectors.toList()); + } + return Collections.emptyList(); + } + + public static List convertApplications( + List applications, Map 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.setBuildOrgName(application.get()); + 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; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalManage.java new file mode 100644 index 0000000..d329506 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalManage.java @@ -0,0 +1,347 @@ +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.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +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.entity.PerformanceAppraisal; +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; +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.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.UserInfoDetails; +import com.ningdatech.pmapi.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname PerformanceAppraisalManage + * @Description + * @Date 2023/6/19 14:18 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class PerformanceAppraisalManage { + + 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 list(PerformanceAppraisalListReq req) { + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) + .like(StringUtils.isNotBlank(req.getName()),PerformanceAppraisal::getName,req.getName()) + .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 paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList()); + List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .in(PerformanceAppraisalProject::getAppraisalId, paIds)); + + Map projectMap = Maps.newHashMap(); + Map> papsGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paps)){ + papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); + + List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + List 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 paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .in(PerformanceAppraisalApplication::getAppraisalId, paIds)); + Map applicationMap = Maps.newHashMap(); + Map> paasGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paas)){ + paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); + + List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + List 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> finalPapsGroupMap = papsGroupMap; + Map> finalPaasGroupMap = paasGroupMap; + Map finalProjectMap = projectMap; + Map finalApplicationMap = applicationMap; + List 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 paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, id)); + Map projectMap = Maps.newHashMap(); + Map> papsGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paps)){ + papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); + + List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + List 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 paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId, id)); + Map applicationMap = Maps.newHashMap(); + Map> paasGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paas)){ + paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); + + List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + List 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> finalPapsGroupMap = papsGroupMap; + Map> finalPaasGroupMap = paasGroupMap; + Map finalProjectMap = projectMap; + Map 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 + */ + 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())){ + saveProjects(createDTO,pa.getId(),user); + } + + if(CollUtil.isNotEmpty(createDTO.getApplicationIds())){ + saveApplications(createDTO,pa.getId(),user); + } + + return "新建成功"; + } + + + /** + * 编辑计划 + * @param editDTO + * @return + */ + 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("名称已经存在"); + } + } + + private void saveProjects(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { + if(CollUtil.isEmpty(createDTO.getProjects())){ + return; + } + + List 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); + } + } + + private void saveApplications(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { + if(CollUtil.isEmpty(createDTO.getApplicationIds())){ + return; + } + + List 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); + } + } + + private void saveProjects(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { + if(Objects.isNull(editDTO.getProjects())){ + return; + } + + //删除先 + performanceAppraisalProjectService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId,editDTO.getId())); + List 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); + } + } + + private void saveApplications(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { + if(CollUtil.isEmpty(editDTO.getApplicationIds())){ + return; + } + + //删除先 + performanceAppraisalApplicationService.remove(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId,editDTO.getId())); + List 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); + } + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.java new file mode 100644 index 0000000..957f22f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.java @@ -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; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceAppraisalApplicationMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.xml new file mode 100644 index 0000000..7b75dce --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalApplicationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.java new file mode 100644 index 0000000..1e9a37f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.java @@ -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; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceAppraisalMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.xml new file mode 100644 index 0000000..c0801d4 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.java new file mode 100644 index 0000000..2a0e102 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.java @@ -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; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceAppraisalProjectMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.xml new file mode 100644 index 0000000..afcb05f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalProjectDTO.java new file mode 100644 index 0000000..e0ba8cd --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalProjectDTO.java @@ -0,0 +1,24 @@ +package com.ningdatech.pmapi.performance.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java new file mode 100644 index 0000000..c72260f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java @@ -0,0 +1,64 @@ +package com.ningdatech.pmapi.performance.model.dto; + +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 = "自评时间错误") + private LocalDateTime selfAppraisalStart; + + @ApiModelProperty("自评结束时间") + @NotNull(message = "自评时间错误") + private LocalDateTime selfAppraisalEnd; + + @ApiModelProperty("复评开始时间") + @NotNull(message = "复评时间错误") + private LocalDateTime reAppraisalStart; + + @ApiModelProperty("复评结束时间") + @NotNull(message = "复评时间错误") + private LocalDateTime reAppraisalEnd; + + @ApiModelProperty("核查开始时间") + @NotNull(message = "核查时间错误") + private LocalDateTime verificationStart; + + @ApiModelProperty("核查结束时间") + @NotNull(message = "核查时间错误") + private LocalDateTime verificationEnd; + + @ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") + @NotBlank(message = "评价目标不能为空") + private String target; + + @ApiModelProperty("评价项目 只有ID 和是否复评") + private List projects; + + @ApiModelProperty("评价应用ids") + private List applicationIds; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java new file mode 100644 index 0000000..e2799b6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java @@ -0,0 +1,66 @@ +package com.ningdatech.pmapi.performance.model.dto; + +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("计划名称") + @NotBlank(message = "请输入计划名称") + private String name; + + @ApiModelProperty("自评开始时间") + @NotNull(message = "自评时间错误") + private LocalDateTime selfAppraisalStart; + + @ApiModelProperty("自评结束时间") + @NotNull(message = "自评时间错误") + private LocalDateTime selfAppraisalEnd; + + @ApiModelProperty("复评开始时间") + @NotNull(message = "复评时间错误") + private LocalDateTime reAppraisalStart; + + @ApiModelProperty("复评结束时间") + @NotNull(message = "复评时间错误") + private LocalDateTime reAppraisalEnd; + + @ApiModelProperty("核查开始时间") + @NotNull(message = "核查时间错误") + private LocalDateTime verificationStart; + + @ApiModelProperty("核查结束时间") + @NotNull(message = "核查时间错误") + private LocalDateTime verificationEnd; + + @ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") + @NotBlank(message = "评价目标不能为空") + private String target; + + @ApiModelProperty("评价项目 只有ID 和是否复评") + private List projects; + + @ApiModelProperty("评价应用ids") + private List applicationIds; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisal.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisal.java new file mode 100644 index 0000000..a52c803 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisal.java @@ -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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java new file mode 100644 index 0000000..fe82b6c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java @@ -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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java new file mode 100644 index 0000000..6de11c4 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java @@ -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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java new file mode 100644 index 0000000..9a49528 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java @@ -0,0 +1,32 @@ +package com.ningdatech.pmapi.performance.model.req; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + *

+ * PerformanceAppraisalListReq + *

+ * + * @author ZPF + * @since 09:32 2023/06/13 + */ +@Data +public class PerformanceAppraisalListReq extends PagePo { + + @ApiModelProperty("计划名称") + private String name; + + @ApiModelProperty("开始时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime start; + + @ApiModelProperty("结束时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime end; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java new file mode 100644 index 0000000..a84bf01 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java @@ -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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java new file mode 100644 index 0000000..896d313 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java @@ -0,0 +1,41 @@ +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.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 projectName; + + @ApiModelProperty("申报单位") + private String buildOrgName; + + @ApiModelProperty("项目类型") + private Integer projectType; + + @ApiModelProperty("项目类型名") + private String projectTypeName; + + @ApiModelProperty("是否复评") + private Boolean isReAppraisal; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java new file mode 100644 index 0000000..f1e1aaa --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java @@ -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 projects; + + @ApiModelProperty("评价应用列表") + private List applications; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalApplicationService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalApplicationService.java new file mode 100644 index 0000000..3fc9a0c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalApplicationService.java @@ -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; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceAppraisalApplicationService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectService.java new file mode 100644 index 0000000..5749b93 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectService.java @@ -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; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceAppraisalProjectService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalService.java new file mode 100644 index 0000000..12b3c01 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalService.java @@ -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; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceAppraisalService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalApplicationServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalApplicationServiceImpl.java new file mode 100644 index 0000000..020d8bb --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalApplicationServiceImpl.java @@ -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; + +/** + *

+ * 绩效评价和应用 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceAppraisalApplicationServiceImpl extends ServiceImpl implements IPerformanceAppraisalApplicationService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectServiceImpl.java new file mode 100644 index 0000000..d03db8f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectServiceImpl.java @@ -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; + +/** + *

+ * 绩效评价和项目 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceAppraisalProjectServiceImpl extends ServiceImpl implements IPerformanceAppraisalProjectService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalServiceImpl.java new file mode 100644 index 0000000..0613978 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalServiceImpl.java @@ -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; + +/** + *

+ * 绩效评价 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceAppraisalServiceImpl extends ServiceImpl implements IPerformanceAppraisalService { + +} From e00977c4ed96a4caebf546f9b1e9ee18a975371a Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 20 Jun 2023 17:25:08 +0800 Subject: [PATCH 15/44] =?UTF-8?q?=E7=BB=A9=E6=95=88=E8=AF=84=E4=BB=B7=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/helper/UserInfoHelper.java | 7 + .../common/helper/impl/UserInfoHelperImpl.java | 89 +++- .../com/ningdatech/pmapi/common/util/BizUtils.java | 7 + .../com/ningdatech/pmapi/common/util/CodeUtil.java | 27 ++ .../controller/PerformanceAppraisalController.java | 54 --- .../PerformanceAppraisalPlanController.java | 72 +++ .../convert/PerformanceAppraisalConveter.java | 5 +- .../manage/PerformanceAppraisalManage.java | 347 --------------- .../manage/PerformanceAppraisalPlanManage.java | 485 +++++++++++++++++++++ .../PerformanceAppraisalProjectGroupMapper.java | 16 + .../PerformanceAppraisalProjectGroupMapper.xml | 5 + .../performance/model/dto/AppraisalProjectDTO.java | 2 - .../model/dto/PerformanceAppraisalCreateDTO.java | 7 + .../model/dto/PerformanceAppraisalEditDTO.java | 16 +- .../PerformanceAppraisalProjectGroupSaveDTO.java | 43 ++ .../entity/PerformanceAppraisalProjectGroup.java | 49 +++ .../model/req/PerformanceAppraisalListReq.java | 9 +- .../vo/PerformanceAppraisalProjectGroupVO.java | 46 ++ .../model/vo/PerformanceAppraisalProjectVO.java | 10 + .../IPerformanceAppraisalProjectGroupService.java | 16 + ...erformanceAppraisalProjectGroupServiceImpl.java | 21 + .../pmapi/user/service/IUserInfoService.java | 4 + .../user/service/impl/UserInfoServiceImpl.java | 9 + 23 files changed, 923 insertions(+), 423 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/util/CodeUtil.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectGroupVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectGroupService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectGroupServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java index a7a5d31..306a086 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java @@ -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 getUserFullInfos(List userInfos); + String getUserName(Long userId); /** @@ -34,6 +39,8 @@ public interface UserInfoHelper { UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode); + List getUserFullInfoByEmployeeCodes(Collection employeeCodes); + /** * 获取用户任职所在单位code * diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java index cc9b9c0..7dc75e0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java @@ -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 getUserFullInfos(List userInfos) { + List res = Lists.newArrayList(); + + if(CollUtil.isEmpty(userInfos)){ + return res; + } + + Map userMap = userInfos.stream().collect(Collectors.toMap(UserInfo::getEmployeeCode,e->e)); + + // 获取浙政钉雇员信息 组织信息 + List employeeCodes = userInfos.stream().map(UserInfo::getEmployeeCode).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(employeeCodes)) { + List dingEmployeeInfoList = iDingEmployeeInfoService + .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .in(DingEmployeeInfo::getEmployeeCode, employeeCodes) + .eq(DingEmployeeInfo::getMainJob, "true")); + + if(CollUtil.isEmpty(dingEmployeeInfoList)){ + return res; + } + + // 装配用户任职所在单位 + List empPosUnitCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getEmpPosUnitCode).collect(Collectors.toList()); + List orgCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getOrganizationCode).collect(Collectors.toList()); + List allOrgCodes = Stream.concat(empPosUnitCodes.stream(),orgCodes.stream()).collect(Collectors.toList()); + if (CollUtil.isEmpty(allOrgCodes)) { + return res; + } + List dingOrganizations = iDingOrganizationService.listByCodes(allOrgCodes); + if (CollUtil.isEmpty(dingOrganizations)) { + return res; + } + Map 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 getUserFullInfoByEmployeeCodes(Collection employeeCodes) { + List userInfos = userInfoService.getUserInfoByEmployeeCodes(employeeCodes); + return getUserFullInfos(userInfos); + } + + @Override public String getUserEmpPosUnitCode(Long userId) { UserFullInfoDTO userFullInfo = getUserFullInfo(userId); return userFullInfo.getEmpPosUnitCode(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java index 809dca5..a30cd3f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java @@ -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; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CodeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CodeUtil.java new file mode 100644 index 0000000..12a5268 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CodeUtil.java @@ -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 convertStrToList(String str) { + if(StringUtils.isBlank(str)){ + return Collections.emptyList(); + } + return Arrays.stream(str.split(StrPool.COMMA)).collect(Collectors.toList()); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalController.java deleted file mode 100644 index fb26b7d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalController.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ningdatech.pmapi.performance.controller; - -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.performance.manage.PerformanceAppraisalManage; -import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalCreateDTO; -import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalEditDTO; -import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; -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 PerformanceAppraisalController - * @Description - * @Date 2023/6/19 14:16 - * @Author PoffyZhang - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "绩效评价控制器") -@RequestMapping("/api/v1/performance-appraisal") -public class PerformanceAppraisalController { - - private final PerformanceAppraisalManage performanceAppraisalManage; - - @GetMapping("/list") - @ApiOperation("绩效列表") - public PageVo list(PerformanceAppraisalListReq req) { - return performanceAppraisalManage.list(req); - } - - @GetMapping("/detail/{id}") - @ApiOperation("绩效详情") - public PerformanceAppraisalVO detail(@PathVariable Long id) { - return performanceAppraisalManage.detail(id); - } - - @PostMapping("/create") - @ApiOperation("新建绩效") - @WebLog("新建绩效") - public String create(PerformanceAppraisalCreateDTO createDTO) { - return performanceAppraisalManage.create(createDTO); - } - - @PostMapping("/edit") - @ApiOperation("编辑绩效") - @WebLog("编辑绩效") - public String edit(PerformanceAppraisalEditDTO editDTO) { - return performanceAppraisalManage.edit(editDTO); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java new file mode 100644 index 0000000..d3bc462 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java @@ -0,0 +1,72 @@ +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 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); + } + + @GetMapping("/group/list/{appraisalId}") + @ApiOperation("绩效评价分组列表") + public List groupList(@PathVariable Long appraisalId) { + return performanceAppraisalPlanManage.groupList(appraisalId); + } + + @PostMapping("/group/save") + @ApiOperation("绩效评价分组保存") + @WebLog("绩效评价分组保存") + public String groupSave(@Valid @RequestBody PerformanceAppraisalProjectGroupSaveDTO dto) { + return performanceAppraisalPlanManage.groupSave(dto); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java index f2680f3..1b45196 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java @@ -28,8 +28,9 @@ public class PerformanceAppraisalConveter { PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); vo.setIsReAppraisal(p.getIsReAppraisal()); vo.setId(p.getProjectId()); - if(map.containsKey(p.getProjectId())){ - Project project = map.get(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())); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalManage.java deleted file mode 100644 index d329506..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalManage.java +++ /dev/null @@ -1,347 +0,0 @@ -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.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -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.entity.PerformanceAppraisal; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; -import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; -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.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.UserInfoDetails; -import com.ningdatech.pmapi.user.util.LoginUserUtil; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @Classname PerformanceAppraisalManage - * @Description - * @Date 2023/6/19 14:18 - * @Author PoffyZhang - */ -@Component -@Slf4j -@AllArgsConstructor -public class PerformanceAppraisalManage { - - 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 list(PerformanceAppraisalListReq req) { - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) - .like(StringUtils.isNotBlank(req.getName()),PerformanceAppraisal::getName,req.getName()) - .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 paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList()); - List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .in(PerformanceAppraisalProject::getAppraisalId, paIds)); - - Map projectMap = Maps.newHashMap(); - Map> papsGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paps)){ - papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); - - List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); - List 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 paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .in(PerformanceAppraisalApplication::getAppraisalId, paIds)); - Map applicationMap = Maps.newHashMap(); - Map> paasGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paas)){ - paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); - - List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - List 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> finalPapsGroupMap = papsGroupMap; - Map> finalPaasGroupMap = paasGroupMap; - Map finalProjectMap = projectMap; - Map finalApplicationMap = applicationMap; - List 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 paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId, id)); - Map projectMap = Maps.newHashMap(); - Map> papsGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paps)){ - papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); - - List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); - List 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 paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId, id)); - Map applicationMap = Maps.newHashMap(); - Map> paasGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paas)){ - paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); - - List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - List 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> finalPapsGroupMap = papsGroupMap; - Map> finalPaasGroupMap = paasGroupMap; - Map finalProjectMap = projectMap; - Map 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 - */ - 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())){ - saveProjects(createDTO,pa.getId(),user); - } - - if(CollUtil.isNotEmpty(createDTO.getApplicationIds())){ - saveApplications(createDTO,pa.getId(),user); - } - - return "新建成功"; - } - - - /** - * 编辑计划 - * @param editDTO - * @return - */ - 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("名称已经存在"); - } - } - - private void saveProjects(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { - if(CollUtil.isEmpty(createDTO.getProjects())){ - return; - } - - List 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); - } - } - - private void saveApplications(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { - if(CollUtil.isEmpty(createDTO.getApplicationIds())){ - return; - } - - List 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); - } - } - - private void saveProjects(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { - if(Objects.isNull(editDTO.getProjects())){ - return; - } - - //删除先 - performanceAppraisalProjectService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId,editDTO.getId())); - List 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); - } - } - - private void saveApplications(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { - if(CollUtil.isEmpty(editDTO.getApplicationIds())){ - return; - } - - //删除先 - performanceAppraisalApplicationService.remove(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId,editDTO.getId())); - List 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); - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java new file mode 100644 index 0000000..1dcdbd6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java @@ -0,0 +1,485 @@ +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.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 list(PerformanceAppraisalListReq req) { + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) + .like(StringUtils.isNotBlank(req.getName()),PerformanceAppraisal::getName,req.getName()) + .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 paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList()); + List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .in(PerformanceAppraisalProject::getAppraisalId, paIds)); + + Map projectMap = Maps.newHashMap(); + Map> papsGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paps)){ + papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); + + List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + List 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 paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .in(PerformanceAppraisalApplication::getAppraisalId, paIds)); + Map applicationMap = Maps.newHashMap(); + Map> paasGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paas)){ + paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); + + List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + List 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> finalPapsGroupMap = papsGroupMap; + Map> finalPaasGroupMap = paasGroupMap; + Map finalProjectMap = projectMap; + Map finalApplicationMap = applicationMap; + List 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 paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, id)); + Map projectMap = Maps.newHashMap(); + Map> papsGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paps)){ + papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); + + List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + List 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 paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId, id)); + Map applicationMap = Maps.newHashMap(); + Map> paasGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paas)){ + paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); + + List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + List 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> finalPapsGroupMap = papsGroupMap; + Map> finalPaasGroupMap = paasGroupMap; + Map finalProjectMap = projectMap; + Map 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 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 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 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 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); + } + } + + public List groupList(Long appraisalId) { + List groups = groupService.list( + Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId, appraisalId)); + + if(CollUtil.isEmpty(groups)){ + return Collections.emptyList(); + } + + Set allEmployeeCodes = Sets.newHashSet(); + Set projectCodes = Sets.newHashSet(); + Map userMap = Maps.newHashMap(); + Map 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 users = userInfoHelper.getUserFullInfoByEmployeeCodes(allEmployeeCodes); + if(CollUtil.isNotEmpty(users)){ + userMap = users.stream().collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode,u -> u)); + } + } + + if(CollUtil.isNotEmpty(projectCodes)){ + List 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 finalProjectMap = projectMap; + Map 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 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 "操作成功"; + } + + private List checkProject(String projectIds, Map 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 checkUser(String users, Map userMap) { + if(StringUtils.isBlank(users)){ + return Collections.emptyList(); + } + return Arrays.stream(users.split(StrPool.COMMA)).map( + employeeCode -> userMap.get(employeeCode) + ).collect(Collectors.toList()); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.java new file mode 100644 index 0000000..9fb9b82 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.java @@ -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; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceAppraisalProjectGroupMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.xml new file mode 100644 index 0000000..b017ca1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalProjectGroupMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalProjectDTO.java index e0ba8cd..1e4eace 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalProjectDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalProjectDTO.java @@ -2,9 +2,7 @@ package com.ningdatech.pmapi.performance.model.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Data; - import javax.validation.constraints.NotNull; -import java.util.List; /** * @Classname AppraisalProjectDTO diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java index c72260f..dd3e2b4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java @@ -1,5 +1,6 @@ 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; @@ -30,26 +31,32 @@ public class PerformanceAppraisalCreateDTO implements Serializable { @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") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java index e2799b6..1654133 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java @@ -1,5 +1,6 @@ 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; @@ -27,35 +28,34 @@ public class PerformanceAppraisalEditDTO implements Serializable { private Long id; @ApiModelProperty("计划名称") - @NotBlank(message = "请输入计划名称") + @JSONField(format = "yyyy-MM-dd") 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 和是否复评") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java new file mode 100644 index 0000000..b5bc523 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java @@ -0,0 +1,43 @@ +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("分组内的所有项目code") + private List projectCodes; + + @ApiModelProperty("复评人员") + private List reAppraisalUsers; + + @ApiModelProperty("核查人员") + private List verificationUsers; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java new file mode 100644 index 0000000..dd6939c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java @@ -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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java index 9a49528..064add0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java @@ -1,11 +1,8 @@ package com.ningdatech.pmapi.performance.model.req; -import com.fasterxml.jackson.annotation.JsonFormat; import com.ningdatech.basic.model.PagePo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; - -import javax.validation.constraints.NotNull; import java.time.LocalDateTime; /** @@ -23,10 +20,8 @@ public class PerformanceAppraisalListReq extends PagePo { private String name; @ApiModelProperty("开始时间") - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDateTime start; + private String start; @ApiModelProperty("结束时间") - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDateTime end; + private String end; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectGroupVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectGroupVO.java new file mode 100644 index 0000000..333e8a4 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectGroupVO.java @@ -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 projects; + + @ApiModelProperty("复评人员") + private List reAppraisalUsers; + + @ApiModelProperty("核查人员") + private List verificationUsers; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java index 896d313..57a3828 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java @@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @@ -24,6 +25,9 @@ public class PerformanceAppraisalProjectVO implements Serializable { @ApiModelProperty("项目ID") private Long id; + @ApiModelProperty("项目编码") + private String projectCode; + @ApiModelProperty("项目名称") private String projectName; @@ -38,4 +42,10 @@ public class PerformanceAppraisalProjectVO implements Serializable { @ApiModelProperty("是否复评") private Boolean isReAppraisal; + + @ApiModelProperty("申报金额") + private BigDecimal declareAmount; + + @ApiModelProperty("预算年度") + private Integer projectYear; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectGroupService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectGroupService.java new file mode 100644 index 0000000..4548554 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalProjectGroupService.java @@ -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; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceAppraisalProjectGroupService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectGroupServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectGroupServiceImpl.java new file mode 100644 index 0000000..4ac484e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalProjectGroupServiceImpl.java @@ -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; + +/** + *

+ * 绩效评价分组 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceAppraisalProjectGroupServiceImpl extends ServiceImpl implements IPerformanceAppraisalProjectGroupService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java index c285c2c..7f5ac38 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java @@ -3,6 +3,9 @@ package com.ningdatech.pmapi.user.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ningdatech.pmapi.user.entity.UserInfo; +import java.util.Collection; +import java.util.List; + /** *

* 服务类 @@ -17,4 +20,5 @@ public interface IUserInfoService extends IService { UserInfo getUserInfoByEmployeeCode(String employeeCode); + List getUserInfoByEmployeeCodes(Collection employeeCodes); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java index ba023a4..3f5fa28 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java @@ -10,6 +10,9 @@ import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import java.util.Collection; +import java.util.List; + /** *

* 服务实现类 @@ -39,4 +42,10 @@ public class UserInfoServiceImpl extends ServiceImpl return getOne(query); } + @Override + public List getUserInfoByEmployeeCodes(Collection employeeCodes) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(UserInfo.class) + .in(UserInfo::getEmployeeCode, employeeCodes); + return list(query); + } } From 633108f4c9b390988854d81358a9f6723b7599ac Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 21 Jun 2023 13:46:20 +0800 Subject: [PATCH 16/44] =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E5=B9=B6=E4=B8=94=E6=8F=90=E4=BA=A4=E5=BA=94=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=20=E6=9C=89=E7=94=B3=E6=8A=A5=E5=8D=95?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/filemanage/manage/ProjectFileManage.java | 4 +-- .../PerformanceAppraisalPlanController.java | 5 +-- .../manage/PerformanceAppraisalPlanManage.java | 6 ++-- .../controller/ProjectLibController.java | 8 +++++ .../pmapi/projectlib/manage/ProjectLibManage.java | 40 ++++++++++++++++++++++ .../model/dto/ProjectApplicationDTO.java | 6 ++++ .../model/entity/ProjectApplication.java | 6 ++++ .../model/req/ProjectApplicationListReq.java | 32 +++++++++++++++++ .../projectlib/model/vo/ProjectApplicationVO.java | 6 ++++ .../pmapi/todocenter/manage/HandlerManage.java | 6 ---- 10 files changed, 106 insertions(+), 13 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApplicationListReq.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index bdba048..c012bc1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -84,7 +84,7 @@ public class ProjectFileManage { List projectList = projectService.list(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.ARCHIVED.getCode()).orderByDesc(Project::getUpdateOn)); + .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()).orderByDesc(Project::getUpdateOn)); // 从申请借阅信息表中查出本单位及下属单位审批通过的项目添加到列表中 HashSet borrowProjectIdSet = new HashSet<>(); @@ -177,7 +177,7 @@ public class ProjectFileManage { VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); // 首先要判断 项目当前状态 是不是 已归档 - VUtils.isTrue(!ProjectStatusEnum.ARCHIVED.getCode().equals(project.getStatus())).throwMessage("提交失败 该项目不是 已归档"); + VUtils.isTrue(!ProjectStatusEnum.ACCEPTED.getCode().equals(project.getStatus())).throwMessage("提交失败 该项目不是 已归档"); String regionCode = user.getRegionCode(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java index d3bc462..032e52d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java @@ -59,8 +59,9 @@ public class PerformanceAppraisalPlanController { @GetMapping("/group/list/{appraisalId}") @ApiOperation("绩效评价分组列表") - public List groupList(@PathVariable Long appraisalId) { - return performanceAppraisalPlanManage.groupList(appraisalId); + public List groupList(@PathVariable Long appraisalId, + @RequestParam(required = false) String name) { + return performanceAppraisalPlanManage.groupList(appraisalId,name); } @PostMapping("/group/save") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java index 1dcdbd6..1f0601d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java @@ -368,11 +368,11 @@ public class PerformanceAppraisalPlanManage { } } - public List groupList(Long appraisalId) { + public List groupList(Long appraisalId,String name) { List groups = groupService.list( Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) - .eq(PerformanceAppraisalProjectGroup::getAppraisalId, appraisalId)); - + .eq(PerformanceAppraisalProjectGroup::getAppraisalId, appraisalId) + .like(StringUtils.isNotBlank(name),PerformanceAppraisalProjectGroup::getName,name)); if(CollUtil.isEmpty(groups)){ return Collections.emptyList(); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java index 44bbf6f..7f7dae5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java @@ -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 applicationList(ProjectApplicationListReq req) { + return projectLibManage.applicationList(req); + } + @GetMapping("/{id}") @ApiOperation("获取项目详情") public ProjectDetailVO detail (@PathVariable Long id){ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index f6dd325..af79310 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -34,8 +34,10 @@ import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; import com.ningdatech.pmapi.projectlib.model.dto.ProjectApplicationDTO; import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; import com.ningdatech.pmapi.projectlib.model.entity.*; +import com.ningdatech.pmapi.projectlib.model.req.ProjectApplicationListReq; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; +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.projectlib.service.*; @@ -218,6 +220,8 @@ public class ProjectLibManage { BeanUtils.copyProperties(application, projectApplication); projectApplication.setId(null); projectApplication.setProjectId(finalProject.getId()); + projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode()); + projectApplication.setBuildOrgName(finalProject.getBuildOrgName()); return projectApplication; }).collect(Collectors.toList()); projectApplicationService.saveOrUpdateBatch(applications); @@ -325,6 +329,8 @@ public class ProjectLibManage { ProjectApplication app = BeanUtil.copyProperties(a,ProjectApplication.class); app.setId(null); app.setProjectId(project.getId()); + app.setBuildOrgName(project.getBuildOrgName()); + app.setBuildOrgCode(project.getBuildOrgCode()); return app; }) .collect(Collectors.toList()); @@ -373,6 +379,8 @@ public class ProjectLibManage { ProjectApplication app = BeanUtil.copyProperties(a,ProjectApplication.class); app.setId(null); app.setProjectId(project.getId()); + app.setBuildOrgName(project.getBuildOrgName()); + app.setBuildOrgCode(project.getBuildOrgCode()); return app; }) .collect(Collectors.toList()); @@ -418,6 +426,8 @@ public class ProjectLibManage { ProjectApplication app = BeanUtil.copyProperties(a,ProjectApplication.class); app.setId(null); app.setProjectId(project.getId()); + app.setBuildOrgName(project.getBuildOrgName()); + app.setBuildOrgCode(project.getBuildOrgCode()); return app; }) .collect(Collectors.toList()); @@ -464,6 +474,8 @@ public class ProjectLibManage { ProjectApplication app = BeanUtil.copyProperties(a,ProjectApplication.class); app.setId(null); app.setProjectId(project.getId()); + app.setBuildOrgName(project.getBuildOrgName()); + app.setBuildOrgCode(project.getBuildOrgCode()); return app; }) .collect(Collectors.toList()); @@ -674,4 +686,32 @@ public class ProjectLibManage { projectInst.setUpdateOn(LocalDateTime.now()); projectInstService.save(projectInst); } + + /** + * 应用列表 + * @param req + * @return + */ + public PageVo applicationList(ProjectApplicationListReq req) { + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) + .eq(StringUtils.isNotBlank(req.getBuildOrgName()),ProjectApplication::getBuildOrgName,req.getBuildOrgName()); + + if(StringUtils.isNotBlank(req.getApplicationName())){ + wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName,req.getApplicationName()) + .or(q2 -> q2.like(ProjectApplication::getAccountAppName,req.getApplicationName()))); + } + wrapper.orderByDesc(ProjectApplication::getUpdateOn); + projectApplicationService.page(page,wrapper); + + if(0L == page.getTotal()){ + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(app -> BeanUtil.copyProperties(app,ProjectApplicationVO.class)) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDTO.java index b03528b..23fa04f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDTO.java @@ -156,4 +156,10 @@ public class ProjectApplicationDTO implements Serializable { @ApiModelProperty("试点文件") private String experimentsFile; + @ApiModelProperty("申报单位名称") + private String buildOrgName; + + @ApiModelProperty("申报单位编码") + private String buildOrgCode; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java index 29e5af8..d053af0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java @@ -166,6 +166,12 @@ public class ProjectApplication implements Serializable { @ApiModelProperty("试点文件") private String experimentsFile; + @ApiModelProperty("申报单位名称") + private String buildOrgName; + + @ApiModelProperty("申报单位编码") + private String buildOrgCode; + private Long createBy; private Long updateBy; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApplicationListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApplicationListReq.java new file mode 100644 index 0000000..0ec5190 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectApplicationListReq.java @@ -0,0 +1,32 @@ +package com.ningdatech.pmapi.projectlib.model.req; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * ProjectLibListReq + *

+ * + * @author ZPF + * @since 14:35 2023/2/1 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("应用列表查询") +@EqualsAndHashCode(callSuper = true) +public class ProjectApplicationListReq extends PagePo { + + @ApiModelProperty("申报单位code") + private String buildOrgCode; + + @ApiModelProperty("申报单位名") + private String buildOrgName; + + @ApiModelProperty("应用名") + private String applicationName; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java index dd19153..feb42b4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java @@ -162,6 +162,12 @@ public class ProjectApplicationVO implements Serializable { @ApiModelProperty("试点文件") private String experimentsFile; + @ApiModelProperty("申报单位名称") + private String buildOrgName; + + @ApiModelProperty("申报单位编码") + private String buildOrgCode; + private Long createBy; private Long updateBy; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index 125e1db..615f648 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -215,17 +215,12 @@ public class HandlerManage { } private void updateProjectApplyBorrowInfo(Project declaredProject, String instanceId) { - // 获取申请借阅信息 ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) .eq(ProjectApplyBorrow::getProjectId, declaredProject.getId()) .eq(ProjectApplyBorrow::getInstanceId, instanceId)); // 更新项目借阅信息为成功 - projectApplyBorrow.setProjectId(declaredProject.getId()); - projectApplyBorrow.setInstanceId(instanceId); projectApplyBorrow.setIsSuccess(Boolean.TRUE); - projectApplyBorrow.setCreateOn(LocalDateTime.now()); - projectApplyBorrow.setCreateBy(LoginUserUtil.getUserId()); projectApplyBorrow.setUpdateOn(LocalDateTime.now()); projectApplyBorrow.setUpdateBy(LoginUserUtil.getUserId()); projectApplyBorrowService.updateById(projectApplyBorrow); @@ -243,7 +238,6 @@ public class HandlerManage { String constructCycle = String.valueOf(Integer.parseInt(buildCycle) + delayApply.getDelayTime()); declaredProject.setBuildCycle(constructCycle); Long constructMonth = Long.valueOf(constructCycle); - declaredProject.setBuildCycle(String.valueOf(constructMonth)); String acceptTime = NdDateUtils.format(approvalDate.plusMonths(constructMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); LocalDateTime time = LocalDateTime.parse(acceptTime, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); declaredProject.setPlanAcceptanceTime(time); From b8a64d05ce13e0aeac00de26abdd894ca7be87a1 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Wed, 21 Jun 2023 17:55:58 +0800 Subject: [PATCH 17/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/constant/CommonConst.java | 2 + .../pmapi/common/util/ExcelDownUtil.java | 2 +- .../controller/ProjectFileController.java | 8 + .../pmapi/filemanage/manage/ProjectFileManage.java | 267 ++++++++++++++++++++- .../handle/ProjectFinalInspectionHandle.java | 2 +- .../handle/ProjectPreliminaryInspectionHandle.java | 2 +- 6 files changed, 277 insertions(+), 6 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java index 953d02c..67df739 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java @@ -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 = "依据文件名:"; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java index bc6f5a3..05e10b6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java @@ -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"); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java index 3bc5a69..f89fe7d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java @@ -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 @@ -46,4 +48,10 @@ public class ProjectFileController { 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); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index bdba048..3083c8c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -1,14 +1,26 @@ 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.entity.vo.result.AttachFileVo; +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; @@ -17,12 +29,18 @@ 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.DefaultDeclaredProjectManage; +import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; +import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; +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; @@ -34,20 +52,34 @@ 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.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.compress.archivers.zip.ZipArchiveEntry; +import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; +import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.checkerframework.checker.nullness.qual.Nullable; 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.time.LocalDateTime; +import javax.servlet.http.HttpServletResponse; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; import java.util.*; import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; /** * @Classname ProjectFileManage @@ -71,6 +103,12 @@ public class ProjectFileManage { 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; public PageVo list(ProjectFileListParam param) { @@ -141,7 +179,7 @@ public class ProjectFileManage { return vo; }).collect(Collectors.toList()); - return PageVo.of(vos, projectList.size()); + return PageVo.of(vos, projects.size()); } private Set getSubOrgList(String empPosUnitCode) { @@ -211,4 +249,227 @@ public class ProjectFileManage { return instanceId; } + + public void downloadFile(Long projectId,HttpServletResponse response) { + Project project = projectService.getById(projectId); + // 获取项目各阶段上传文件ID + List 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"); + //response.setHeader("Content-Disposition", "attachment;filename=" + zipFileName); + + 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 fileIdList) { + Long projectId = project.getId(); + // 项目申报阶段 + // 获取立项依据 + String buildBasis = project.getBuildBasis(); + List buildBasisFileArray = JSON.parseArray(buildBasis, JSONObject.class); + for (JSONObject jsonObject : buildBasisFileArray) { + String fileInfo = jsonObject.getString(CommonConst.FILE_LIST); + List buildBasisFileIdList = getFileIdList(fileInfo); + fileIdList.addAll(buildBasisFileIdList); + } + // 获取附件-初步方案 + String preliminaryPlanFile = project.getPreliminaryPlanFile(); + List prePlanFileIdList = getFileIdList(preliminaryPlanFile); + fileIdList.addAll(prePlanFileIdList); + // 获取附件-佐证材料 + String supMaterialsFile = project.getSupportingMaterialsFile(); + List supMaterialFileIdList = getFileIdList(supMaterialsFile); + fileIdList.addAll(supMaterialFileIdList); + // 获取附件-项目总投资测算明细 + String calTotalInvestFile = project.getCalculationTotalInvestmentFile(); + List calTotalInvestFileIdList = getFileIdList(calTotalInvestFile); + fileIdList.addAll(calTotalInvestFileIdList); + // 获取附件-申报单位主要职责(单位三定方案) + String mainResAppFile = project.getMainResponsibilitiesApplicantFile(); + List mainResAppFileIdList = getFileIdList(mainResAppFile); + fileIdList.addAll(mainResAppFileIdList); + // 获取附件-项目申报书 + String projectApplicationForm = project.getProjectApplicationForm(); + List projectAppFormFileIdList = getFileIdList(projectApplicationForm); + fileIdList.addAll(projectAppFormFileIdList); + // 获取项目应用信息中的文件 + List applicationList = projectApplicationService + .list(Wrappers.lambdaQuery(ProjectApplication.class).eq(ProjectApplication::getProjectId, projectId)); + for (ProjectApplication projectApplication : applicationList) { + // 获取试点文件 + String experimentsFile = projectApplication.getExperimentsFile(); + List experimentsFileIdList = getFileIdList(experimentsFile); + fileIdList.addAll(experimentsFileIdList); + // 获取应用总投资测算明细 + String appEstimateFile = projectApplication.getApplicationEstimateFile(); + List appEstimateFileIdList = getFileIdList(appEstimateFile); + fileIdList.addAll(appEstimateFileIdList); + } + // 流程审核意见文件 + // 获取项目关联的流程实例 + List projectInstList = + projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getProjectId, projectId)); + // 从历史评论表中获取对应流程实例的评论附件信息 + for (ProjectInst projectInst : projectInstList) { + String instanceId = projectInst.getInstCode(); + List commentList = taskService.getProcessInstanceComments(instanceId); + for (Comment comment : commentList) { + ProcessComment processComment = JSONObject.parseObject(comment.getFullMessage(), ProcessComment.class); + List attachments = processComment.getAttachments(); + if (CollUtil.isNotEmpty(attachments)){ + List idList = attachments.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList()); + fileIdList.addAll(idList); + } + } + } + + // 预审申报阶段 + // 预审申报上级条线主管单位审核意见 + String higherLineSuperOrgReviewComments = project.getHigherLineSuperOrgReviewComments(); + if (StringUtils.isNotBlank(higherLineSuperOrgReviewComments)){ + List highSuperOrgFileIdList = getFileIdList(higherLineSuperOrgReviewComments); + fileIdList.addAll(highSuperOrgFileIdList); + } + + // 方案申报阶段 + // 获取建设方案文件 + String constructionPlanFile = project.getConstructionPlanFile(); + JSONObject jsonObject = JSON.parseObject(constructionPlanFile, JSONObject.class); + Long constructFileId = jsonObject.getLong(CommonConst.FILE_ID_STR); + fileIdList.add(constructFileId); + + // 立项批复阶段 + // 获取批复文件 + String approvedFile = project.getApprovedFile(); + fileIdList.add(Long.valueOf(approvedFile)); + // 获取建设方案文件 + String approvedConstructionPlanFile = project.getApprovedConstructionPlanFile(); + fileIdList.add(Long.valueOf(approvedConstructionPlanFile)); + + // 采购结果备案阶段 + Purchase purchase = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class) + .eq(Purchase::getProjectId, projectId) + .last(BizConst.LIMIT_1)); + // 获取投标文件 + String biddingDoc = purchase.getBiddingDoc(); + List biddingFileIdList = getFileIdList(biddingDoc); + fileIdList.addAll(biddingFileIdList); + // 获取招标文件 + String bidDoc = purchase.getBidDoc(); + List bidFileIdList = getFileIdList(bidDoc); + fileIdList.addAll(bidFileIdList); + // 获取中标通知书 + String acceptanceLetter = purchase.getAcceptanceLetter(); + List acceptFileIdList = getFileIdList(acceptanceLetter); + fileIdList.addAll(acceptFileIdList); + + // 合同备案阶段 + Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) + .eq(Contract::getProjectId, projectId) + .last(BizConst.LIMIT_1)); + // 获取合同附件 + String attachment = contract.getAttachment(); + List 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 reviews = projectReviewDetailVO.getReviews(); + // 获取最终评审意见附件 + if (CollUtil.isNotEmpty(reviews)) { + List finalReviewFileIdList = reviews.stream().map(r -> { + ExpertReviewDetailVO finalReview = r.getFinalReview(); + return finalReview.getAttachFileId(); + }).collect(Collectors.toList()); + fileIdList.addAll(finalReviewFileIdList); + // 获取组员评审意见 + for (ProjectReviewDetailVO.ReviewDetailByTypeVO review : reviews) { + List teamMemberReviews = review.getTeamMemberReviews(); + for (ExpertReviewDetailVO teamMemberReview : teamMemberReviews) { + Long attachFileId = teamMemberReview.getAttachFileId(); + fileIdList.add(attachFileId); + } + } + } + } + + private void getInspectionMaterials(List fileIdList, String preliminaryInspectionMaterials) { + List 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 array = JSON.parseArray(dataStr, String.class); + for (String file : array) { + JSONObject fileObject = JSON.parseObject(file, JSONObject.class); + String filesStr = fileObject.getString("files"); + List 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 getFileIdList(String buildBasis) { + List prePlanFileArray = JSON.parseArray(buildBasis, JSONObject.class); + List prePlanFileIdList = CollUtils.fieldList(prePlanFileArray, w -> w.getLong(CommonConst.ID_STR)); + return prePlanFileIdList; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java index 8d93f02..0d4265e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java @@ -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); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java index beffe7a..38b768a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java @@ -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); } } From eae974cf14068a60ae0aaa56f3bbe73420fd6381 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Wed, 21 Jun 2023 17:56:12 +0800 Subject: [PATCH 18/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/filemanage/manage/ProjectFileManage.java | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index 3083c8c..01901c3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -250,7 +250,7 @@ public class ProjectFileManage { return instanceId; } - public void downloadFile(Long projectId,HttpServletResponse response) { + public void downloadFile(Long projectId, HttpServletResponse response) { Project project = projectService.getById(projectId); // 获取项目各阶段上传文件ID List fileIdList = Lists.newArrayList(); @@ -260,23 +260,24 @@ public class ProjectFileManage { // 设置response的header response.setContentType("application/zip"); - response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + ExcelDownUtil.encodeName(zipFileName) + ".zip"); - //response.setHeader("Content-Disposition", "attachment;filename=" + zipFileName); + response.setHeader("Content-disposition", + "attachment;filename*=utf-8''" + ExcelDownUtil.encodeName(zipFileName) + ".zip"); try { // 创建ZipOutputStream ZipOutputStream zos = new ZipOutputStream(response.getOutputStream()); - if (CollUtil.isNotEmpty(fileIdList)){ + if (CollUtil.isNotEmpty(fileIdList)) { // 获取文件输入流 for (Long fileId : fileIdList) { File file = fileService.getById(fileId); // 文件不存在,跳过 - if (Objects.isNull(file)){ + 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)); + String fileName = name + StrPool.UNDERSCORE + fileId + + originalFileName.substring(originalFileName.indexOf(StrPool.DOT)); InputStream fileInputStream = fileService.getFileInputStream(file); // 文件 ZipEntry zipEntry = new ZipEntry(fileName); @@ -351,7 +352,7 @@ public class ProjectFileManage { for (Comment comment : commentList) { ProcessComment processComment = JSONObject.parseObject(comment.getFullMessage(), ProcessComment.class); List attachments = processComment.getAttachments(); - if (CollUtil.isNotEmpty(attachments)){ + if (CollUtil.isNotEmpty(attachments)) { List idList = attachments.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList()); fileIdList.addAll(idList); } @@ -361,7 +362,7 @@ public class ProjectFileManage { // 预审申报阶段 // 预审申报上级条线主管单位审核意见 String higherLineSuperOrgReviewComments = project.getHigherLineSuperOrgReviewComments(); - if (StringUtils.isNotBlank(higherLineSuperOrgReviewComments)){ + if (StringUtils.isNotBlank(higherLineSuperOrgReviewComments)) { List highSuperOrgFileIdList = getFileIdList(higherLineSuperOrgReviewComments); fileIdList.addAll(highSuperOrgFileIdList); } @@ -382,9 +383,8 @@ public class ProjectFileManage { fileIdList.add(Long.valueOf(approvedConstructionPlanFile)); // 采购结果备案阶段 - Purchase purchase = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class) - .eq(Purchase::getProjectId, projectId) - .last(BizConst.LIMIT_1)); + Purchase purchase = purchaseService + .getOne(Wrappers.lambdaQuery(Purchase.class).eq(Purchase::getProjectId, projectId).last(BizConst.LIMIT_1)); // 获取投标文件 String biddingDoc = purchase.getBiddingDoc(); List biddingFileIdList = getFileIdList(biddingDoc); @@ -399,9 +399,8 @@ public class ProjectFileManage { fileIdList.addAll(acceptFileIdList); // 合同备案阶段 - Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) - .eq(Contract::getProjectId, projectId) - .last(BizConst.LIMIT_1)); + Contract contract = contractService + .getOne(Wrappers.lambdaQuery(Contract.class).eq(Contract::getProjectId, projectId).last(BizConst.LIMIT_1)); // 获取合同附件 String attachment = contract.getAttachment(); List contractFileIdList = getFileIdList(attachment); From 5daa8dd30a90528571465516e0fd3ab20ab1de09 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 21 Jun 2023 18:00:32 +0800 Subject: [PATCH 19/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BD=92=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectlib/model/entity/ProjectCollection.java | 143 +++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java new file mode 100644 index 0000000..ce6c860 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java @@ -0,0 +1,143 @@ +package com.ningdatech.pmapi.projectlib.model.entity; + +import com.baomidou.mybatisplus.annotation.*; +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; + +/** + *

+ * 项目归集对象 + *

+ * + * @author ZPF + * @since 2023-06-21 + */ +@Data +@TableName("nd_project_collection") +@ApiModel(value = "NdProject_collection", description = "项目归集对象") +public class ProjectCollection implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("所属地区编号") + private String areaCode; + + @ApiModelProperty("所属地区名称") + private String area; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("项目类型 1:建设 2:运维") + private Integer projectType; + + @ApiModelProperty("是否首次新建 0:否 1:是") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("建设层级 1:国家级 2:省级 3:省本级 4:市级 5:市本级 6:区县 7乡镇") + private Integer buildLevel; + + @ApiModelProperty("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + private String financialCode; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + private BigDecimal declareAmount; + + @ApiModelProperty("立项批复资金(万元)") + private BigDecimal approvalAmount; + + @ApiModelProperty("关联应用") + private String applicationName; + + @ApiModelProperty("关联应用IRS编码") + private String applicationIrsCode; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("可行性研究报告") + private String feasibilityStudyReport; + + @ApiModelProperty("立项批复文件") + private String approvedFile; + + @ApiModelProperty("采购文件") + private String purchaseFile; + + @ApiModelProperty("中标通知书") + private String acceptanceLetter; + + @ApiModelProperty("采购合同") + private String purchaseContract; + + @ApiModelProperty("验收报告") + private String acceptanceReport; + + @ApiModelProperty("变更批复文件") + private String changeApprovalDoc; + + @ApiModelProperty("承建单位") + private String constructionOrg; + + @ApiModelProperty("承建单位统一信用编码") + private String constructionOrgCreditCode; + + @ApiModelProperty("监理单位") + private String supervisorOrg; + + @ApiModelProperty("监理单位统一信用编码") + private String supervisorOrgCreditCode; + + @ApiModelProperty("主管部门名称") + private String superOrg; + + @ApiModelProperty("主管部门Code") + private String superOrgCode; +} From 27cd777ff3be2a0018949ec2d55f9431abfb1e04 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Sun, 25 Jun 2023 10:57:26 +0800 Subject: [PATCH 20/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/filemanage/manage/ProjectFileManage.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index 05baa00..1fab0be 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -167,14 +167,17 @@ public class ProjectFileManage { historyService.createHistoricProcessInstanceQuery().processInstanceId(instCode).singleResult(); ProjectInst projectInst = projectInstService .getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); - 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); + // 推送省局联审的项目流程实例为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()); From d0fa0cd48a3c4da3d57383888d3c144e66f83e09 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Sun, 25 Jun 2023 11:00:17 +0800 Subject: [PATCH 21/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BD=92=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ProjectCollectionController.java | 55 ++++++++ .../projectlib/manage/ProjectCollectionManage.java | 136 ++++++++++++++++++ .../projectlib/mapper/ProjectCollectionMapper.java | 16 +++ .../projectlib/mapper/ProjectCollectionMapper.xml | 5 + .../model/dto/ProjectCollectionSaveDTO.java | 148 ++++++++++++++++++++ .../pmapi/projectlib/model/req/ProjectListReq.java | 3 + .../projectlib/model/vo/ProjectCollectionVO.java | 153 +++++++++++++++++++++ .../service/IProjectCollectionService.java | 16 +++ .../service/impl/ProjectCollectionServiceImpl.java | 21 +++ .../user/security/auth/model/UserInfoDetails.java | 12 ++ 10 files changed, 565 insertions(+) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectCollectionController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectCollectionService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectCollectionServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectCollectionController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectCollectionController.java new file mode 100644 index 0000000..5a6a913 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectCollectionController.java @@ -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 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); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java new file mode 100644 index 0000000..e6c3cba --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java @@ -0,0 +1,136 @@ +package com.ningdatech.pmapi.projectlib.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.common.helper.RegionCacheHelper; +import com.ningdatech.pmapi.projectlib.model.dto.ProjectCollectionSaveDTO; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; +import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; +import com.ningdatech.pmapi.projectlib.model.vo.ProjectCollectionVO; +import com.ningdatech.pmapi.projectlib.service.IProjectCollectionService; +import com.ningdatech.pmapi.sys.model.dto.RegionDTO; +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.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname ProjectCollectionManage + * @Description + * @Date 2023/6/25 9:13 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class ProjectCollectionManage { + + private final IProjectCollectionService collectionService; + + private final RegionCacheHelper regionCacheHelper; + + /** + * 项目归集 + * @param req + * @return + */ + public PageVo list(ProjectListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String buildOrgCode = req.getBuildOrgCode(); + //如果是超管 可以看所有 + if(user.getSuperAdmin()){ + buildOrgCode = null; + } + + Page page = req.page(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectCollection.class) + .like(StringUtils.isNotBlank(req.getProjectName()), ProjectCollection::getProjectName, req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectCollection::getBuildOrgName, req.getBuildOrgName()) + .eq(Objects.nonNull(buildOrgCode), ProjectCollection::getBuildOrgCode, buildOrgCode); + //处理 行政区域 + if(StringUtils.isNotBlank(req.getRegionCode())){ + List regions = regionCacheHelper.listChildren(req.getRegionCode(), req.getRegionLevel()); + + if(CollUtil.isNotEmpty(regions)){ + wrapper.in(ProjectCollection::getAreaCode,regions.stream().map(RegionDTO::getRegionCode).collect(Collectors.toList())); + } + } + + collectionService.page(page,wrapper); + + if(0L == page.getTotal()){ + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(record -> BeanUtil.copyProperties(record,ProjectCollectionVO.class)) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 项目归集详情 + * @param id + * @return + */ + public ProjectCollectionVO detail(Long id) { + ProjectCollection projectCollection = collectionService.getById(id); + + return BeanUtil.copyProperties(projectCollection,ProjectCollectionVO.class); + } + + /** + * 保存 + * @param dto + * @return + */ + public String save(ProjectCollectionSaveDTO dto) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + ProjectCollection projectCollection = BeanUtil.copyProperties(dto,ProjectCollection.class); + if(Objects.nonNull(dto.getId())){ + ProjectCollection old = collectionService.getById(dto.getId()); + VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目归集不存在!"); + projectCollection.setId(dto.getId()); + }else{ + projectCollection.setCreateBy(user.getUsername()); + projectCollection.setCreateOn(LocalDateTime.now()); + } + + projectCollection.setUpdateBy(user.getUsername()); + projectCollection.setUpdateOn(LocalDateTime.now()); + if(collectionService.saveOrUpdate(projectCollection)){ + return "保存成功"; + } + return "保存失败"; + } + + /** + * 删除 + * @param id + * @return + */ + public String delete(Long id) { + ProjectCollection projectCollection = collectionService.getById(id); + + VUtils.isTrue(Objects.isNull(projectCollection)).throwMessage("该项目归集不存在 删除失败"); + + if(collectionService.removeById(id)){ + return "删除成功"; + } + return "删除失败"; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.java new file mode 100644 index 0000000..297d91b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.projectlib.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; + +/** + *

+ * Mapper 接口 + *

+ * + * @author ZPF + * @since 2023-06-25 + */ +public interface ProjectCollectionMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.xml new file mode 100644 index 0000000..463409d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectCollectionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java new file mode 100644 index 0000000..5392876 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java @@ -0,0 +1,148 @@ +package com.ningdatech.pmapi.projectlib.model.dto; + +import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; +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.Objects; +import java.util.Optional; + +/** + *

+ * 项目归集对象 + *

+ * + * @author ZPF + * @since 2023-06-21 + */ +@Data +@ApiModel(value = "ProjectCollectionSaveDTO", description = "项目归集对象保存") +public class ProjectCollectionSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("所属地区编号") + private String areaCode; + + @ApiModelProperty("所属地区名称") + private String area; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("项目类型 1:建设 2:运维") + private Integer projectType; + + @ApiModelProperty("是否首次新建 0:否 1:是") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("建设层级 1:国家级 2:省级 3:省本级 4:市级 5:市本级 6:区县 7乡镇") + private Integer buildLevel; + + @ApiModelProperty("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + private String financialCode; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + private BigDecimal declareAmount; + + @ApiModelProperty("立项批复资金(万元)") + private BigDecimal approvalAmount; + + @ApiModelProperty("关联应用") + private String applicationName; + + @ApiModelProperty("关联应用IRS编码") + private String applicationIrsCode; + + @ApiModelProperty("可行性研究报告") + private String feasibilityStudyReport; + + @ApiModelProperty("立项批复文件") + private String approvedFile; + + @ApiModelProperty("采购文件") + private String purchaseFile; + + @ApiModelProperty("中标通知书") + private String acceptanceLetter; + + @ApiModelProperty("采购合同") + private String purchaseContract; + + @ApiModelProperty("验收报告") + private String acceptanceReport; + + @ApiModelProperty("变更批复文件") + private String changeApprovalDoc; + + @ApiModelProperty("承建单位") + private String constructionOrg; + + @ApiModelProperty("承建单位统一信用编码") + private String constructionOrgCreditCode; + + @ApiModelProperty("监理单位") + private String supervisorOrg; + + @ApiModelProperty("监理单位统一信用编码") + private String supervisorOrgCreditCode; + + @ApiModelProperty("主管部门名称") + private String superOrg; + + @ApiModelProperty("主管部门Code") + private String superOrgCode; + + private String projectTypeName; + + public String getProjectTypeName() { + if (Objects.nonNull(this.projectType)) { + Optional.ofNullable(ProjectTypeEnum.getDesc(this.projectType)) + .ifPresent(desc -> this.projectTypeName = desc); + } + return this.projectTypeName; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java index 1dae680..0259e92 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java @@ -31,6 +31,9 @@ public class ProjectListReq extends PagePo { @ApiModelProperty("区域编码") private String regionCode; + @ApiModelProperty("区域等级") + private Integer regionLevel = 3; + @ApiModelProperty("项目名称") private String projectName; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java new file mode 100644 index 0000000..a6ab4dc --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java @@ -0,0 +1,153 @@ +package com.ningdatech.pmapi.projectlib.model.vo; + +import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; +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.Objects; +import java.util.Optional; + +/** + *

+ * 项目归集对象 + *

+ * + * @author ZPF + * @since 2023-06-21 + */ +@Data +@ApiModel(value = "ProjectCollectionVO", description = "项目归集对象") +public class ProjectCollectionVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("所属地区编号") + private String areaCode; + + @ApiModelProperty("所属地区名称") + private String area; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目负责人") + private String responsibleMan; + + @ApiModelProperty("负责人手机号码") + private String responsibleManMobile; + + @ApiModelProperty("项目联系人") + private String contactName; + + @ApiModelProperty("项目联系人手机号码") + private String contactPhone; + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + private String buildOrgCode; + + @ApiModelProperty("项目类型 1:建设 2:运维") + private Integer projectType; + + @ApiModelProperty("是否首次新建 0:否 1:是") + private Integer isFirst; + + @ApiModelProperty("项目预算年度") + private Integer projectYear; + + @ApiModelProperty("建设层级 1:国家级 2:省级 3:省本级 4:市级 5:市本级 6:区县 7乡镇") + private Integer buildLevel; + + @ApiModelProperty("发改编码") + private String developCode; + + @ApiModelProperty("财政编码") + private String financialCode; + + @ApiModelProperty("项目简介") + private String projectIntroduction; + + @ApiModelProperty("资金申报情况-申报金额(万元)") + private BigDecimal declareAmount; + + @ApiModelProperty("立项批复资金(万元)") + private BigDecimal approvalAmount; + + @ApiModelProperty("关联应用") + private String applicationName; + + @ApiModelProperty("关联应用IRS编码") + private String applicationIrsCode; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; + + @ApiModelProperty("可行性研究报告") + private String feasibilityStudyReport; + + @ApiModelProperty("立项批复文件") + private String approvedFile; + + @ApiModelProperty("采购文件") + private String purchaseFile; + + @ApiModelProperty("中标通知书") + private String acceptanceLetter; + + @ApiModelProperty("采购合同") + private String purchaseContract; + + @ApiModelProperty("验收报告") + private String acceptanceReport; + + @ApiModelProperty("变更批复文件") + private String changeApprovalDoc; + + @ApiModelProperty("承建单位") + private String constructionOrg; + + @ApiModelProperty("承建单位统一信用编码") + private String constructionOrgCreditCode; + + @ApiModelProperty("监理单位") + private String supervisorOrg; + + @ApiModelProperty("监理单位统一信用编码") + private String supervisorOrgCreditCode; + + @ApiModelProperty("主管部门名称") + private String superOrg; + + @ApiModelProperty("主管部门Code") + private String superOrgCode; + + private String projectTypeName; + + public String getProjectTypeName() { + if (Objects.nonNull(this.projectType)) { + Optional.ofNullable(ProjectTypeEnum.getDesc(this.projectType)) + .ifPresent(desc -> this.projectTypeName = desc); + } + return this.projectTypeName; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectCollectionService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectCollectionService.java new file mode 100644 index 0000000..e48b496 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectCollectionService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.projectlib.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; + +/** + *

+ * 服务类 + *

+ * + * @author ZPF + * @since 2023-06-25 + */ +public interface IProjectCollectionService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectCollectionServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectCollectionServiceImpl.java new file mode 100644 index 0000000..2504fe0 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectCollectionServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.projectlib.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.pmapi.projectlib.mapper.ProjectCollectionMapper; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; +import com.ningdatech.pmapi.projectlib.service.IProjectCollectionService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-25 + */ +@Service +public class ProjectCollectionServiceImpl extends ServiceImpl + implements IProjectCollectionService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java index 831ee2b..c477497 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java @@ -145,6 +145,18 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { return Boolean.FALSE; } + public Boolean getSuperAdmin() { + if (CollUtil.isNotEmpty(this.userRoleList)) { + for (Role role : this.userRoleList) { + RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); + if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.SUPER_ADMIN.name())) { + return Boolean.TRUE; + } + } + } + return Boolean.FALSE; + } + public Boolean getIsMunicipalOrg() { //如果是丽水市本级的code 就是 if (RegionConst.RC_LS.equals(this.regionCode)) { From f58cd98c89ccfe6831e9c77dd89775555b325a13 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Sun, 25 Jun 2023 13:58:17 +0800 Subject: [PATCH 22/44] =?UTF-8?q?=E7=BB=A9=E6=95=88debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/performance/convert/PerformanceAppraisalConveter.java | 3 ++- .../java/com/ningdatech/pmapi/sys/service/impl/RoleServiceImpl.java | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java index 1b45196..e31be2e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java @@ -35,6 +35,8 @@ public class PerformanceAppraisalConveter { 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()); @@ -54,7 +56,6 @@ public class PerformanceAppraisalConveter { application.getApplicationName() : application.getAccountAppName()); vo.setApplicationType(application.getApplicationType()); vo.setBizDomain(application.getBizDomain()); -// vo.setBuildOrgName(application.get()); vo.setPublishSide(application.getPublishSide()); } return vo; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleServiceImpl.java index 56e2464..b94cd34 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RoleServiceImpl.java @@ -19,6 +19,7 @@ import com.ningdatech.pmapi.sys.model.dto.RoleUpdateDTO; import com.ningdatech.pmapi.sys.model.entity.*; import com.ningdatech.pmapi.sys.service.*; import com.ningdatech.pmapi.sys.utils.AuthCacheKeyUtils; +import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; import com.ningdatech.pmapi.user.manage.UserAuthManage; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -119,6 +120,7 @@ public class RoleServiceImpl extends ServiceImpl implements IR Role role = BeanUtil.toBean(data, Role.class); role.setCreateBy(userId); role.setUpdateBy(userId); + role.setCode(RoleEnum.NORMAL_MEMBER.name()); save(role); saveRoleMenu(data.getMenuIds(), role.getId()); saveRoleMenuDatascope(data.getMenuDataScopeList(), role.getId()); From ba647f587a1b14a7e637e54c5b5a687609f47b1f Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Sun, 25 Jun 2023 15:22:15 +0800 Subject: [PATCH 23/44] =?UTF-8?q?=E7=BB=A9=E6=95=88debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OrgSelfAppraisalController.java | 37 +++++ .../PerformanceAppraisalPlanController.java | 20 +++ .../performance/manage/OrgSelfAppraisalManage.java | 180 +++++++++++++++++++++ .../manage/PerformanceAppraisalPlanManage.java | 94 +++++++++++ .../model/dto/ProjectCollectionSaveDTO.java | 3 + .../projectlib/model/entity/ProjectCollection.java | 3 + .../projectlib/model/vo/ProjectCollectionVO.java | 3 + 7 files changed, 340 insertions(+) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java new file mode 100644 index 0000000..7b9b218 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java @@ -0,0 +1,37 @@ +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.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 list(PerformanceAppraisalListReq req) { + return selfAppraisalManage.list(req); + } + + @GetMapping("/detail/{id}") + @ApiOperation("当前用户的绩效评价计划详情") + public PerformanceAppraisalVO detail(@PathVariable Long id) { + return selfAppraisalManage.detail(id); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java index 032e52d..c501e1c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java @@ -57,6 +57,13 @@ public class PerformanceAppraisalPlanController { 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 groupList(@PathVariable Long appraisalId, @@ -64,10 +71,23 @@ public class PerformanceAppraisalPlanController { 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); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java new file mode 100644 index 0000000..56697ce --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java @@ -0,0 +1,180 @@ +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.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.performance.convert.PerformanceAppraisalConveter; +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.req.PerformanceAppraisalListReq; +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.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.UserInfoDetails; +import com.ningdatech.pmapi.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +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 list(PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + //当前登录用户 单位code + String empPosUnitCode = user.getEmpPosUnitCode(); + projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getBuildOrgCode,empPosUnitCode)); + + + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) + .like(StringUtils.isNotBlank(req.getName()),PerformanceAppraisal::getName,req.getName()) + .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 paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList()); + List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .in(PerformanceAppraisalProject::getAppraisalId, paIds)); + + Map projectMap = Maps.newHashMap(); + Map> papsGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paps)){ + papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); + + List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + List 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 paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .in(PerformanceAppraisalApplication::getAppraisalId, paIds)); + Map applicationMap = Maps.newHashMap(); + Map> paasGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paas)){ + paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); + + List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + List 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> finalPapsGroupMap = papsGroupMap; + Map> finalPaasGroupMap = paasGroupMap; + Map finalProjectMap = projectMap; + Map finalApplicationMap = applicationMap; + List 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 paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, id)); + Map projectMap = Maps.newHashMap(); + Map> papsGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paps)){ + papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); + + List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + List 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 paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId, id)); + Map applicationMap = Maps.newHashMap(); + Map> paasGroupMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(paas)){ + paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); + + List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + List 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> finalPapsGroupMap = papsGroupMap; + Map> finalPaasGroupMap = paasGroupMap; + Map finalProjectMap = projectMap; + Map 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; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java index 1f0601d..d6dd8f3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java @@ -8,6 +8,7 @@ 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; @@ -368,6 +369,27 @@ public class PerformanceAppraisalPlanManage { } } + /** + * 删除绩效评价计划 + * 连带删除 其下所有 + * @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 groupList(Long appraisalId,String name) { List groups = groupService.list( Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) @@ -422,6 +444,52 @@ public class PerformanceAppraisalPlanManage { } /** + * 分组详情 + * @param id + * @return + */ + public PerformanceAppraisalProjectGroupVO groupDetail(Long id) { + PerformanceAppraisalProjectGroup group = groupService.getById(id); + + if(Objects.isNull(group)){ + return null; + } + + Map projectMap = Maps.newHashMap(); + List 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 userMap = Maps.newHashMap(); + Set allEmployeeCodes = Sets.newHashSet(); + allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getReAppraisalUsers())); + allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getVerificationUsers())); + if(CollUtil.isNotEmpty(allEmployeeCodes)){ + List 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 @@ -455,6 +523,32 @@ public class PerformanceAppraisalPlanManage { 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 checkProject(String projectIds, Map projectMap) { if(StringUtils.isBlank(projectIds)){ return Collections.emptyList(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java index 5392876..7060b4f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java @@ -28,6 +28,9 @@ public class ProjectCollectionSaveDTO implements Serializable { @ApiModelProperty("主键") private Long id; + @ApiModelProperty("项目编号") + private String projectCode; + @ApiModelProperty("所属地区编号") private String areaCode; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java index ce6c860..8eb46e2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java @@ -28,6 +28,9 @@ public class ProjectCollection implements Serializable { @TableId(type = IdType.AUTO) private Long id; + @ApiModelProperty("项目编号") + private String projectCode; + @ApiModelProperty("所属地区编号") private String areaCode; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java index a6ab4dc..cc136a2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java @@ -28,6 +28,9 @@ public class ProjectCollectionVO implements Serializable { @ApiModelProperty("主键") private Long id; + @ApiModelProperty("项目编号") + private String projectCode; + @ApiModelProperty("所属地区编号") private String areaCode; From 0af911c93b99968389625e4d6ff917814514f499 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Sun, 25 Jun 2023 15:40:15 +0800 Subject: [PATCH 24/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=94=B3=E8=AF=B7=E5=80=9F=E9=98=85=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/filemanage/manage/ProjectFileManage.java | 66 ++++++++-------------- .../projectlib/handle/ProjectApprovalHandle.java | 6 +- 2 files changed, 29 insertions(+), 43 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index 1fab0be..6134969 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -4,13 +4,13 @@ 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.entity.vo.result.AttachFileVo; import com.ningdatech.file.service.FileService; import com.ningdatech.file.utils.StrPool; import com.ningdatech.pmapi.common.constant.BizConst; @@ -59,11 +59,7 @@ import com.wflow.workflow.service.ProcessInstanceService; import com.wflow.workflow.service.ProcessModelService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; -import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; -import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.checkerframework.checker.nullness.qual.Nullable; import org.flowable.engine.HistoryService; import org.flowable.engine.TaskService; import org.flowable.engine.history.HistoricProcessInstance; @@ -71,11 +67,8 @@ import org.flowable.engine.task.Comment; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletResponse; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.net.URL; import java.util.*; import java.util.stream.Collectors; import java.util.zip.ZipEntry; @@ -115,46 +108,26 @@ public class ProjectFileManage { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); String employeeCode = userFullInfo.getEmployeeCode(); String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); - Integer pageNumber = param.getPageNumber(); - Integer pageSize = param.getPageSize(); - Set subOrgSet = getSubOrgList(empPosUnitCode); - List projectList = projectService.list(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)); - - // 从申请借阅信息表中查出本单位及下属单位审批通过的项目添加到列表中 - HashSet borrowProjectIdSet = new HashSet<>(); - List applyBorrowList = projectApplyBorrowService - .list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) - .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) - .stream().filter(a -> borrowProjectIdSet.add(a.getProjectId())).collect(Collectors.toList()); - for (ProjectApplyBorrow applyBorrow : applyBorrowList) { - Long projectId = applyBorrow.getProjectId(); - if (Objects.nonNull(projectId)) { - Project project = projectService.getById(projectId); - projectList.add(project); - } - } - // 对整合后的档案列表去重 - HashSet projectIdSet = new HashSet<>(); - List projects = - projectList.stream().filter(p -> projectIdSet.add(p.getId())).collect(Collectors.toList()); + Page 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 (CollUtil.isEmpty(projects)) { + if(0L == page.getTotal()){ return PageVo.empty(); } - List records = - projects.stream().skip((long)(pageNumber - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + // 获取本单位及下属单位的单位code + Set subOrgSet = getSubOrgList(empPosUnitCode); - List vos = records.stream().map(p -> { + List vos = page.getRecords().stream().map(p -> { ProjectFileListVO vo = new ProjectFileListVO(); vo.setId(p.getId()); - // 用户只可查阅自己及下属单位的项目档案; - if (subOrgSet.contains(p.getBuildOrgCode())) { + // 用户只可查阅自己及下属单位的项目档案和已经申请借阅通过的项目档案 + if (subOrgSet.contains(p.getBuildOrgCode()) || checkCanRead(subOrgSet,p)) { vo.setCanRead(Boolean.TRUE); } vo.setBuildOrgName(p.getBuildOrgName()); @@ -182,7 +155,18 @@ public class ProjectFileManage { return vo; }).collect(Collectors.toList()); - return PageVo.of(vos, projects.size()); + return PageVo.of(vos, page.getTotal()); + } + + private boolean checkCanRead(Set subOrgSet, Project project) { + // 从申请借阅信息表中查出本单位及下属单位审批通过的项目 + HashSet borrowProjectIdSet = new HashSet<>(); + List 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 getSubOrgList(String empPosUnitCode) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java index 7e77620..88814c9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java @@ -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); From 6f349876ea9b2330a4ea14b22898197fa4ccb26b Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Sun, 25 Jun 2023 15:55:00 +0800 Subject: [PATCH 25/44] =?UTF-8?q?=E5=BB=BA=E8=AE=BE=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java | 3 +++ .../ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java | 3 +++ .../com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java | 3 +++ 3 files changed, 9 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java index 7060b4f..7ce4b42 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java @@ -70,6 +70,9 @@ public class ProjectCollectionSaveDTO implements Serializable { @ApiModelProperty("项目类型 1:建设 2:运维") private Integer projectType; + @ApiModelProperty("建设类型 1软件,2硬件,3服务") + private Integer constructionType; + @ApiModelProperty("是否首次新建 0:否 1:是") private Integer isFirst; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java index 8eb46e2..fa281d9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java @@ -70,6 +70,9 @@ public class ProjectCollection implements Serializable { @ApiModelProperty("项目类型 1:建设 2:运维") private Integer projectType; + @ApiModelProperty("建设类型 1软件,2硬件,3服务") + private Integer constructionType; + @ApiModelProperty("是否首次新建 0:否 1:是") private Integer isFirst; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java index cc136a2..73daabd 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java @@ -70,6 +70,9 @@ public class ProjectCollectionVO implements Serializable { @ApiModelProperty("项目类型 1:建设 2:运维") private Integer projectType; + @ApiModelProperty("建设类型 1软件,2硬件,3服务") + private Integer constructionType; + @ApiModelProperty("是否首次新建 0:否 1:是") private Integer isFirst; From 411b653cafb2e7ff8a751bc3ee8f86a747cf7353 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Sun, 25 Jun 2023 16:18:14 +0800 Subject: [PATCH 26/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BA=93=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/manage/ProjectLibManage.java | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index af79310..c32281b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; @@ -17,6 +18,7 @@ import com.ningdatech.pmapi.common.constant.RegionConst; import com.ningdatech.pmapi.common.enumeration.CommonEnum; import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; +import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.util.BizUtils; @@ -25,6 +27,8 @@ import com.ningdatech.pmapi.datascope.model.DataScopeDTO; import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow; 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.model.dto.DelayedApplyDTO; import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; @@ -81,6 +85,8 @@ public class ProjectLibManage { private final StateMachineUtils stateMachineUtils; private final INdProjectDelayApplyService projectDelayApplyService; private final INdProjectApplyBorrowService projectApplyBorrowService; + private final IDingOrganizationService dingOrganizationService; + private final UserInfoHelper userInfoHelper; public PageVo projectLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); @@ -545,10 +551,47 @@ public class ProjectLibManage { } public List processScheduleDetail(Long projectId) { + + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); + List processDetailVOS = new ArrayList<>(); + // 判断该项目是否为本单位或下属单位的项目或者已经申请借阅成功的项目 + Project project = projectService.getById(projectId); + Set subOrgList = getSubOrgList(empPosUnitCode); + + if (!checkCanRead(subOrgList,project)){ + throw new BizException("您没有权限查看此项目档案!"); + } return processExecuteHandle.handle(projectId, processDetailVOS); } + private boolean checkCanRead(Set subOrgSet, Project project) { + // 从申请借阅信息表中查出本单位及下属单位审批通过的项目 + HashSet borrowProjectIdSet = new HashSet<>(); + List 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 getSubOrgList(String empPosUnitCode) { + HashSet orgSet = new HashSet<>(); + // 先将自己加入子集 + orgSet.add(empPosUnitCode); + Set 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 void exportList(ProjectListReq param, HttpServletResponse response) { param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); From 314e4523368f7ad2e91919da77cdc8cd4ace7b24 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Sun, 25 Jun 2023 17:18:40 +0800 Subject: [PATCH 27/44] =?UTF-8?q?=E7=9C=81=E7=BA=A7=E6=9D=A1=E7=BA=BF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/GovBusinessStripManage.java | 15 +++++------ .../mapper/ProvincialGovBusinessStripMapper.java | 15 +++++++++++ .../mapper/ProvincialGovBusinessStripMapper.xml | 5 ++++ .../model/entity/ProvincialGovBusinessStrip.java | 29 ++++++++++++++++++++++ .../IProvincialGovBusinessStripService.java | 16 ++++++++++++ .../ProvincialGovBusinessStripServiceImpl.java | 21 ++++++++++++++++ .../performance/manage/OrgSelfAppraisalManage.java | 5 ++-- .../model/dto/ProjectCollectionSaveDTO.java | 9 +++++++ .../projectlib/model/entity/ProjectCollection.java | 13 ++++++++-- .../projectlib/model/vo/ProjectCollectionVO.java | 9 +++++++ 10 files changed, 125 insertions(+), 12 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/ProvincialGovBusinessStrip.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IProvincialGovBusinessStripService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/ProvincialGovBusinessStripServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java index 9235fd7..ded0c81 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/GovBusinessStripManage.java @@ -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 getChildOrganizationList(String parentCode) { if (Objects.isNull(parentCode)) { @@ -44,15 +48,12 @@ public class GovBusinessStripManage { } public List getProvincialGovBusinessStripList(String businessStripName) { - List provincialGovBusinessStripVOList = new ArrayList<>(); - ProvincialGovBusinessStripVO provincialGovBusinessStripVO = new ProvincialGovBusinessStripVO(); - provincialGovBusinessStripVO.setBusinessStripCode("test_provincial_manage_org_code"); - provincialGovBusinessStripVO.setBusinessStripName("测试省局条线主管单位"); - provincialGovBusinessStripVOList.add(provincialGovBusinessStripVO); + List 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; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.java new file mode 100644 index 0000000..8d05229 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.java @@ -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; + +/** + *

+ * Mapper 接口 + *

+ * @author zpf + * @since 2023-06-25 + */ +public interface ProvincialGovBusinessStripMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.xml new file mode 100644 index 0000000..482a0ea --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/ProvincialGovBusinessStripMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/ProvincialGovBusinessStrip.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/ProvincialGovBusinessStrip.java new file mode 100644 index 0000000..696c0ef --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/ProvincialGovBusinessStrip.java @@ -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; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IProvincialGovBusinessStripService.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IProvincialGovBusinessStripService.java new file mode 100644 index 0000000..f48f69b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IProvincialGovBusinessStripService.java @@ -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; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-03-08 + */ +public interface IProvincialGovBusinessStripService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/ProvincialGovBusinessStripServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/ProvincialGovBusinessStripServiceImpl.java new file mode 100644 index 0000000..6978215 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/ProvincialGovBusinessStripServiceImpl.java @@ -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; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-03-08 + */ +@Service +public class ProvincialGovBusinessStripServiceImpl extends ServiceImpl + implements IProvincialGovBusinessStripService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java index 56697ce..59c2f3f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java @@ -61,9 +61,8 @@ public class OrgSelfAppraisalManage { //当前登录用户 单位code String empPosUnitCode = user.getEmpPosUnitCode(); - projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getBuildOrgCode,empPosUnitCode)); - + List projectLists = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getBuildOrgCode, empPosUnitCode)); Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java index 7ce4b42..73e60f5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java @@ -73,6 +73,9 @@ public class ProjectCollectionSaveDTO implements Serializable { @ApiModelProperty("建设类型 1软件,2硬件,3服务") private Integer constructionType; + @ApiModelProperty("预算来源") + private Integer budgetSource; + @ApiModelProperty("是否首次新建 0:否 1:是") private Integer isFirst; @@ -142,6 +145,12 @@ public class ProjectCollectionSaveDTO implements Serializable { @ApiModelProperty("主管部门Code") private String superOrgCode; + @ApiModelProperty("上级条线主管部门") + private String higherSuperOrg; + + @ApiModelProperty("上级主管部门Code") + private String higherSuperOrgCode; + private String projectTypeName; public String getProjectTypeName() { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java index fa281d9..8167f62 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java @@ -73,6 +73,9 @@ public class ProjectCollection implements Serializable { @ApiModelProperty("建设类型 1软件,2硬件,3服务") private Integer constructionType; + @ApiModelProperty("预算来源") + private Integer budgetSource; + @ApiModelProperty("是否首次新建 0:否 1:是") private Integer isFirst; @@ -141,9 +144,15 @@ public class ProjectCollection implements Serializable { @ApiModelProperty("监理单位统一信用编码") private String supervisorOrgCreditCode; - @ApiModelProperty("主管部门名称") + @ApiModelProperty("本级主管部门名称") private String superOrg; - @ApiModelProperty("主管部门Code") + @ApiModelProperty("本级主管部门Code") private String superOrgCode; + + @ApiModelProperty("上级条线主管部门") + private String higherSuperOrg; + + @ApiModelProperty("上级主管部门Code") + private String higherSuperOrgCode; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java index 73daabd..e6d7eed 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java @@ -73,6 +73,9 @@ public class ProjectCollectionVO implements Serializable { @ApiModelProperty("建设类型 1软件,2硬件,3服务") private Integer constructionType; + @ApiModelProperty("预算来源") + private Integer budgetSource; + @ApiModelProperty("是否首次新建 0:否 1:是") private Integer isFirst; @@ -147,6 +150,12 @@ public class ProjectCollectionVO implements Serializable { @ApiModelProperty("主管部门Code") private String superOrgCode; + @ApiModelProperty("上级条线主管部门") + private String higherSuperOrg; + + @ApiModelProperty("上级主管部门Code") + private String higherSuperOrgCode; + private String projectTypeName; public String getProjectTypeName() { From 4d9c7b8a6109c90f08c716fe3e19b6a990cc759a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Mon, 26 Jun 2023 09:47:47 +0800 Subject: [PATCH 28/44] =?UTF-8?q?fix=20=E4=B8=93=E5=AE=B6=E6=89=80?= =?UTF-8?q?=E5=A1=AB=E4=BF=A1=E6=81=AF=E6=B6=88=E5=A4=B1=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java index e531869..b7e6a73 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java @@ -103,6 +103,9 @@ public class ExpertAdminExpertManageAssembler { } public List assembleDictionaryName(List 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 assembleTagName(List collect) { + if (CollectionUtil.isEmpty(collect)){ + return new ArrayList<>(); + } return collect.stream().peek(r -> { TagDTO tagDTO = tagCache.getByTagCode(r.getTagCode()); if (Objects.nonNull(tagDTO)) { From dcb1a766a3faf9e50203283023bf089677c7ffd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Mon, 26 Jun 2023 14:03:58 +0800 Subject: [PATCH 29/44] =?UTF-8?q?fix=20=E4=B8=93=E5=AE=B6=E5=BA=93?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=86=85=E5=A4=96=E5=9B=B4=E4=B8=93=E5=AE=B6?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../expert/mapper/ExpertAdminManageMapper.java | 6 +++++ .../expert/mapper/ExpertAdminManageMapper.xml | 26 +++++++++++++++------- .../service/impl/ExpertAdminManageServiceImpl.java | 23 +++++++++++++++++-- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java index a98abf7..a2dd01b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java @@ -18,4 +18,10 @@ public interface ExpertAdminManageMapper { * @return */ List listExpertUserId(@Param("query") ListExpertQuery query); + + List listExpertDictionaryUserId(@Param("query") ListExpertQuery query); + + List listExpertTagUserId(@Param("query") ListExpertQuery query); + + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml index 425f052..5e7aefa 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml @@ -103,14 +103,24 @@ + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java index cd10d39..842aa36 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java @@ -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 listExpertUserId(ListExpertQuery listExpertQuery) { + List userIdList = expertAdminManageMapper.listExpertUserId(listExpertQuery); + + List expertTagQueryList = listExpertQuery.getExpertTagQueryList(); + if (CollectionUtils.isNotEmpty(expertTagQueryList)) { + List tagUserIdList = expertAdminManageMapper.listExpertTagUserId(listExpertQuery); + userIdList.retainAll(tagUserIdList); + } + + List expertDictionaryQueryList = listExpertQuery.getExpertDictionaryQueryList(); + if (CollectionUtils.isNotEmpty(expertDictionaryQueryList)) { + List dictionaryUserIdList = expertAdminManageMapper.listExpertDictionaryUserId(listExpertQuery); + userIdList.retainAll(dictionaryUserIdList); + } + return userIdList; + } + @Override public CommonPage getExpertLibraryList(ExpertAdminExpertManageQueryCmd req) { ListExpertQuery listExpertQuery = buildListExpertQuery(req); - List userIdList = expertAdminManageMapper.listExpertUserId(listExpertQuery); + List userIdList = listExpertUserId(listExpertQuery); List 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 filterExpertUserIdList(ExpertAdminExpertManageQueryCmd queryCmd) { ListExpertQuery listExpertQuery = buildListExpertQuery(queryCmd); - return expertAdminManageMapper.listExpertUserId(listExpertQuery); + return listExpertUserId(listExpertQuery); } } From a99741c7e1d9c618002108c5daf3ded75fad8574 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 26 Jun 2023 15:35:16 +0800 Subject: [PATCH 30/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BD=92=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OrgSelfAppraisalController.java | 15 +- .../PerformanceIndicatorTemplateController.java | 40 +++++ .../manage/IndicatorTemplateManage.java | 89 +++++++++++ .../performance/manage/OrgSelfAppraisalManage.java | 162 +++++++++------------ .../manage/PerformanceAppraisalPlanManage.java | 2 +- .../PerformanceIndicatorProjectTemplateMapper.java | 16 ++ .../PerformanceIndicatorProjectTemplateMapper.xml | 5 + ...PerformanceIndicatorProjectTemplateSaveDTO.java | 35 +++++ .../PerformanceIndicatorProjectTemplate.java | 46 ++++++ .../model/req/PerformanceAppraisalListReq.java | 11 +- .../model/vo/PerformanceAppraisalProjectVO.java | 3 + .../vo/PerformanceIndicatorProjectTemplateVO.java | 41 ++++++ ...PerformanceIndicatorProjectTemplateService.java | 16 ++ ...ormanceIndicatorProjectTemplateServiceImpl.java | 21 +++ .../manage/DeclaredProjectManage.java | 2 - .../utils/GenerateProjectCodeUtil.java | 38 +++++ .../projectlib/manage/ProjectCollectionManage.java | 6 +- .../model/dto/ProjectCollectionSaveDTO.java | 6 +- .../projectlib/model/entity/ProjectCollection.java | 2 +- .../projectlib/model/vo/ProjectCollectionVO.java | 2 +- 20 files changed, 451 insertions(+), 107 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java index 7b9b218..d9c16d0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java @@ -3,6 +3,7 @@ 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; @@ -29,9 +30,15 @@ public class OrgSelfAppraisalController { return selfAppraisalManage.list(req); } - @GetMapping("/detail/{id}") - @ApiOperation("当前用户的绩效评价计划详情") - public PerformanceAppraisalVO detail(@PathVariable Long id) { - return selfAppraisalManage.detail(id); + @GetMapping("/pending-list/{planId}") + @ApiOperation("当前绩效评价待自评列表") + public PageVo pendingList(@PathVariable Long planId, PerformanceAppraisalListReq req) { + return selfAppraisalManage.pendingList(planId,req); + } + + @GetMapping("/appraisaled-list/{planId}") + @ApiOperation("当前绩效评价已自评列表") + public PageVo appraisaledList(@PathVariable Long planId,PerformanceAppraisalListReq req) { + return selfAppraisalManage.appraisaledList(planId); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java new file mode 100644 index 0000000..95161dc --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java @@ -0,0 +1,40 @@ +package com.ningdatech.pmapi.performance.controller; + +import com.ningdatech.basic.model.PageVo; +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 projectList(PerformanceAppraisalListReq req) { + return indicatorTemplateManage.projectList(req); + } + + @PostMapping("/project/save") + @ApiOperation("项目指标配置模板保存") + public String projectTemplateSave(@Valid @RequestBody PerformanceIndicatorProjectTemplateSaveDTO dto) { + return indicatorTemplateManage.projectTemplateSave(dto); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java new file mode 100644 index 0000000..7893860 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java @@ -0,0 +1,89 @@ +package com.ningdatech.pmapi.performance.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; +import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; +import com.ningdatech.pmapi.performance.model.vo.PerformanceIndicatorProjectTemplateVO; +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 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 indicatorTemplateService; + + /** + * 模板列表 + * @param req + * @return + */ + public PageVo projectList(PerformanceAppraisalListReq req) { + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) + .like(StringUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName()) + .eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceIndicatorProjectTemplate::getRegionCode,req.getRegionCode()); + indicatorTemplateService.page(page,wrapper); + + if(0L == page.getTotal()){ + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(p -> BeanUtil.copyProperties(p, PerformanceIndicatorProjectTemplateVO.class)) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 项目指标 模板保存 + * @param dto + * @return + */ + public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class); + + if(Objects.nonNull(dto.getId())){ + PerformanceIndicatorProjectTemplate old = indicatorTemplateService.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(indicatorTemplateService.saveOrUpdate(template)){ + return "保存成功"; + } + + throw new BizException("保存失败!"); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java index 59c2f3f..35b1c59 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java @@ -3,30 +3,29 @@ 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.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.performance.convert.PerformanceAppraisalConveter; 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.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.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.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; @@ -64,116 +63,93 @@ public class OrgSelfAppraisalManage { List projectLists = projectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getBuildOrgCode, empPosUnitCode)); - Page page = req.page(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) - .like(StringUtils.isNotBlank(req.getName()),PerformanceAppraisal::getName,req.getName()) - .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()){ + if(CollUtil.isEmpty(projectLists)){ return PageVo.empty(); } - List paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList()); + List projectIds = projectLists.stream().map(Project::getId).collect(Collectors.toList()); + List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .in(PerformanceAppraisalProject::getAppraisalId, paIds)); - - Map projectMap = Maps.newHashMap(); - Map> papsGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paps)){ - papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); - - List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); - List 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)); - } + .in(PerformanceAppraisalProject::getProjectId, projectIds)); + if(CollUtil.isEmpty(paps)){ + return PageVo.empty(); } - List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .in(PerformanceAppraisalApplication::getAppraisalId, paIds)); - Map applicationMap = Maps.newHashMap(); - Map> paasGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paas)){ - paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); - - List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - List 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)); - } + Set paIds = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet()); + + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) + .in(PerformanceAppraisal::getId,paIds) + .orderByDesc(PerformanceAppraisal::getUpdateOn); + performanceAppraisalService.page(page,wrapper); + if(0L == page.getTotal()){ + return PageVo.empty(); } - Map> finalPapsGroupMap = papsGroupMap; - Map> finalPaasGroupMap = paasGroupMap; - Map finalProjectMap = projectMap; - Map finalApplicationMap = applicationMap; List 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) { + public PageVo pendingList(Long planId, PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); - PerformanceAppraisal pa = performanceAppraisalService.getById(id); - VUtils.isTrue(Objects.isNull(pa)).throwMessage("该计划不存在"); + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该计划不存在!"); - PerformanceAppraisalVO vo = BeanUtil.copyProperties(pa,PerformanceAppraisalVO.class); - //绩效关联的项目 List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId, id)); - Map projectMap = Maps.newHashMap(); - Map> papsGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paps)){ - papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); - - List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); - List 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)); - } - } + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())); - //绩效关联的应用 - List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId, id)); - Map applicationMap = Maps.newHashMap(); - Map> paasGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paas)){ - paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); - - List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); - List 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)); - } + if(CollUtil.isEmpty(paps)){ + return PageVo.empty(); } + Set projectIds = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); - Map> finalPapsGroupMap = papsGroupMap; - Map> finalPaasGroupMap = paasGroupMap; - Map finalProjectMap = projectMap; - Map finalApplicationMap = applicationMap; - if(finalPapsGroupMap.containsKey(vo.getId())){ - vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(vo.getId()),finalProjectMap)); + Page page = req.page(); + LambdaQueryWrapper 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(); } - if(finalPaasGroupMap.containsKey(vo.getId())){ - vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(vo.getId()),finalApplicationMap)); + + List 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 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 vo; + return Boolean.FALSE; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java index d6dd8f3..a47a31f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java @@ -80,7 +80,7 @@ public class PerformanceAppraisalPlanManage { public PageVo list(PerformanceAppraisalListReq req) { Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) - .like(StringUtils.isNotBlank(req.getName()),PerformanceAppraisal::getName,req.getName()) + .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); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java new file mode 100644 index 0000000..5604e52 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.java @@ -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; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceIndicatorProjectTemplateMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml new file mode 100644 index 0000000..eec7ce7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java new file mode 100644 index 0000000..25106fb --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java @@ -0,0 +1,35 @@ +package com.ningdatech.pmapi.performance.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @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("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") + private Integer amountRange; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java new file mode 100644 index 0000000..dda9e60 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java @@ -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 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("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") + private Integer amountRange; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java index 064add0..5e81877 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java @@ -17,11 +17,20 @@ import java.time.LocalDateTime; public class PerformanceAppraisalListReq extends PagePo { @ApiModelProperty("计划名称") - private String name; + private String planName; @ApiModelProperty("开始时间") private String start; @ApiModelProperty("结束时间") private String end; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("模板名称") + private String templateName; + + @ApiModelProperty("区域code") + private String regionCode; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java index 57a3828..af24f9a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java @@ -48,4 +48,7 @@ public class PerformanceAppraisalProjectVO implements Serializable { @ApiModelProperty("预算年度") private Integer projectYear; + + @ApiModelProperty("是否可自评") + private Boolean canSelfAppraisal = Boolean.FALSE; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java new file mode 100644 index 0000000..d8c61f1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java @@ -0,0 +1,41 @@ +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; + +/** + * @Classname PerformanceIndicatorTemplateVO + * @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("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") + private Integer amountRange; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateService.java new file mode 100644 index 0000000..2c2b125 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateService.java @@ -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; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceIndicatorProjectTemplateService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java new file mode 100644 index 0000000..551d24a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateServiceImpl.java @@ -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; + +/** + *

+ * 绩效评价 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceIndicatorProjectTemplateServiceImpl extends ServiceImpl + implements IPerformanceIndicatorProjectTemplateService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index 26e3bf2..497dfa8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -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) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java index b65fa87..93788b4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java @@ -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 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; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java index e6c3cba..dd94550 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; +import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; import com.ningdatech.pmapi.projectlib.model.dto.ProjectCollectionSaveDTO; import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; @@ -40,6 +41,8 @@ public class ProjectCollectionManage { private final RegionCacheHelper regionCacheHelper; + private final GenerateProjectCodeUtil generateProjectCodeUtil; + /** * 项目归集 * @param req @@ -57,7 +60,7 @@ public class ProjectCollectionManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectCollection.class) .like(StringUtils.isNotBlank(req.getProjectName()), ProjectCollection::getProjectName, req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectCollection::getBuildOrgName, req.getBuildOrgName()) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectCollection::getBuildOrg, req.getBuildOrgName()) .eq(Objects.nonNull(buildOrgCode), ProjectCollection::getBuildOrgCode, buildOrgCode); //处理 行政区域 if(StringUtils.isNotBlank(req.getRegionCode())){ @@ -106,6 +109,7 @@ public class ProjectCollectionManage { VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目归集不存在!"); projectCollection.setId(dto.getId()); }else{ + projectCollection.setProjectCode(generateProjectCodeUtil.generateProjectCode(projectCollection)); projectCollection.setCreateBy(user.getUsername()); projectCollection.setCreateOn(LocalDateTime.now()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java index 73e60f5..1b89116 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectCollectionSaveDTO.java @@ -58,12 +58,12 @@ public class ProjectCollectionSaveDTO implements Serializable { @ApiModelProperty("项目联系人手机号码") private String contactPhone; - @ApiModelProperty("建设单位名称") - private String buildOrgName; - @ApiModelProperty("建设单位统一社会信用代码") private String orgCreditCode; + @ApiModelProperty("建设单位名称") + private String buildOrg; + @ApiModelProperty("公司编码code") private String buildOrgCode; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java index 8167f62..1da0bcb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectCollection.java @@ -59,7 +59,7 @@ public class ProjectCollection implements Serializable { private String contactPhone; @ApiModelProperty("建设单位名称") - private String buildOrgName; + private String buildOrg; @ApiModelProperty("建设单位统一社会信用代码") private String orgCreditCode; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java index e6d7eed..929cfdc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectCollectionVO.java @@ -59,7 +59,7 @@ public class ProjectCollectionVO implements Serializable { private String contactPhone; @ApiModelProperty("建设单位名称") - private String buildOrgName; + private String buildOrg; @ApiModelProperty("建设单位统一社会信用代码") private String orgCreditCode; From 2e24ec16059a0218dd3b1b502cf5162ca115f825 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 26 Jun 2023 15:40:03 +0800 Subject: [PATCH 31/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BD=92=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/manage/ProjectCollectionManage.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java index dd94550..d6728fa 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java @@ -7,6 +7,7 @@ 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.common.constant.RegionConst; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; import com.ningdatech.pmapi.projectlib.model.dto.ProjectCollectionSaveDTO; @@ -78,7 +79,11 @@ public class ProjectCollectionManage { } List res = page.getRecords().stream() - .map(record -> BeanUtil.copyProperties(record,ProjectCollectionVO.class)) + .map(record -> { + ProjectCollectionVO vo = BeanUtil.copyProperties(record, ProjectCollectionVO.class); + vo.setArea(regionCacheHelper.getDisplayName(record.getAreaCode(), RegionConst.RL_COUNTY)); + return vo; + }) .collect(Collectors.toList()); return PageVo.of(res,page.getTotal()); From 6ec0ced095edd975841608055f2d72103fa74e74 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 26 Jun 2023 17:23:02 +0800 Subject: [PATCH 32/44] =?UTF-8?q?=E8=AE=BE=E7=BD=AEsession=E8=BF=87?= =?UTF-8?q?=E6=9C=9Fhttp=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/security/auth/handler/DefaultExpiredSessionStrategy.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultExpiredSessionStrategy.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultExpiredSessionStrategy.java index 5024ae8..ecbb68a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultExpiredSessionStrategy.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/handler/DefaultExpiredSessionStrategy.java @@ -6,11 +6,11 @@ import com.ningdatech.pmapi.user.security.auth.errorcode.AuthErrorCodeEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; import org.springframework.security.web.session.SessionInformationExpiredEvent; import org.springframework.security.web.session.SessionInformationExpiredStrategy; import org.springframework.stereotype.Component; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @@ -29,11 +29,9 @@ public class DefaultExpiredSessionStrategy implements SessionInformationExpiredS @Override public void onExpiredSessionDetected(SessionInformationExpiredEvent sessionInformationExpiredEvent) - throws IOException, ServletException { - if (LOG.isInfoEnabled()) { - LOG.info("session is expired"); - } + throws IOException { HttpServletResponse response = sessionInformationExpiredEvent.getResponse(); + response.setStatus(HttpStatus.UNAUTHORIZED.value()); response.setContentType("application/json;charset=UTF-8"); response.getWriter().write(objectMapper.writeValueAsString( ApiResponse.of(AuthErrorCodeEnum.SESSION_EXPIRED.getCode(), AuthErrorCodeEnum.SESSION_EXPIRED.getMsg(), null))); From f72e5979e714f16be84e035d1ae2d86d8d182f64 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Tue, 27 Jun 2023 09:35:11 +0800 Subject: [PATCH 33/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/filemanage/manage/ProjectFileManage.java | 25 ++++++++++++++++++++-- .../pmapi/filemanage/model/vo/ProjectFileVO.java | 9 ++++++++ .../pmapi/projectlib/manage/ProjectLibManage.java | 11 ---------- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index 6134969..5e47aa2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -54,6 +54,7 @@ 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; @@ -184,9 +185,29 @@ public class ProjectFileManage { } public ProjectFileVO file(Long projectId) { - ProjectDetailVO projectDetailVo = projectLibManage.getProjectDetail(projectId); - return null; + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); + + // 判断该项目是否为本单位或下属单位的项目或者已经申请借阅成功的项目 + Project project = projectService.getById(projectId); + Set subOrgList = getSubOrgList(empPosUnitCode); + + if (!checkCanRead(subOrgList,project)){ + throw new BizException("您没有权限查看此项目档案!"); + } + ProjectFileVO projectFileVo = new ProjectFileVO(); + ProjectDetailVO projectDetailVo = projectLibManage.getProjectDetail(projectId); + List processDetailVos = projectLibManage.processScheduleDetail(projectId); + projectFileVo.setProjectDetailVo(projectDetailVo); + projectFileVo.setProcessDetailVos(processDetailVos); + projectFileVo.setProjectName(project.getProjectName()); + projectFileVo.setCanRead(Boolean.TRUE); + projectFileVo.setPojectCode(project.getProjectCode()); + projectFileVo.setId(projectId); + projectFileVo.setBuildOrgName(project.getBuildOrgName()); + projectFileVo.setUpdateOn(project.getUpdateOn()); + return projectFileVo; } public String wantRead(Long projectId) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java index c49c8cf..4c51371 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java @@ -1,10 +1,13 @@ package com.ningdatech.pmapi.filemanage.model.vo; +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 @@ -33,4 +36,10 @@ public class ProjectFileVO { @ApiModelProperty("最后修改时间") private LocalDateTime updateOn; + + @ApiModelProperty("项目档案详情") + private ProjectDetailVO projectDetailVo; + + @ApiModelProperty("流程进度详情") + private List processDetailVos; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index c32281b..05999dc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -551,18 +551,7 @@ public class ProjectLibManage { } public List processScheduleDetail(Long projectId) { - - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); - List processDetailVOS = new ArrayList<>(); - // 判断该项目是否为本单位或下属单位的项目或者已经申请借阅成功的项目 - Project project = projectService.getById(projectId); - Set subOrgList = getSubOrgList(empPosUnitCode); - - if (!checkCanRead(subOrgList,project)){ - throw new BizException("您没有权限查看此项目档案!"); - } return processExecuteHandle.handle(projectId, processDetailVOS); } From 1be22ab0b6378790b2035fa6e321ca4b2d554e16 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Tue, 27 Jun 2023 11:03:09 +0800 Subject: [PATCH 34/44] =?UTF-8?q?=E6=A1=A3=E6=A1=88=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/filemanage/manage/ProjectFileManage.java | 78 +++++++++++++++------- .../pmapi/filemanage/model/vo/ProjectFileVO.java | 37 +++++----- 2 files changed, 73 insertions(+), 42 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index 5e47aa2..91387f4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -28,9 +28,16 @@ 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; @@ -103,6 +110,9 @@ public class ProjectFileManage { 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 list(ProjectFileListParam param) { @@ -197,16 +207,23 @@ public class ProjectFileManage { throw new BizException("您没有权限查看此项目档案!"); } ProjectFileVO projectFileVo = new ProjectFileVO(); + String projectCode = project.getProjectCode(); ProjectDetailVO projectDetailVo = projectLibManage.getProjectDetail(projectId); List 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.setProjectName(project.getProjectName()); - projectFileVo.setCanRead(Boolean.TRUE); - projectFileVo.setPojectCode(project.getProjectCode()); - projectFileVo.setId(projectId); - projectFileVo.setBuildOrgName(project.getBuildOrgName()); - projectFileVo.setUpdateOn(project.getUpdateOn()); + projectFileVo.setProjectReviewDetailVo(projectReviewDetailVo); + projectFileVo.setPurchaseVo(purchaseVo); + projectFileVo.setContractVo(contractVo); + projectFileVo.setPreInsVo(preInsVo); + projectFileVo.setFinalAcceptanceVo(finalAcceptanceVo); + return projectFileVo; } @@ -378,41 +395,52 @@ public class ProjectFileManage { // 方案申报阶段 // 获取建设方案文件 String constructionPlanFile = project.getConstructionPlanFile(); - JSONObject jsonObject = JSON.parseObject(constructionPlanFile, JSONObject.class); - Long constructFileId = jsonObject.getLong(CommonConst.FILE_ID_STR); - fileIdList.add(constructFileId); + 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(); - fileIdList.add(Long.valueOf(approvedFile)); + if (Objects.nonNull(approvedFile)) { + fileIdList.add(Long.valueOf(approvedFile)); + } // 获取建设方案文件 String approvedConstructionPlanFile = project.getApprovedConstructionPlanFile(); - fileIdList.add(Long.valueOf(approvedConstructionPlanFile)); + 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)); // 获取投标文件 - String biddingDoc = purchase.getBiddingDoc(); - List biddingFileIdList = getFileIdList(biddingDoc); - fileIdList.addAll(biddingFileIdList); - // 获取招标文件 - String bidDoc = purchase.getBidDoc(); - List bidFileIdList = getFileIdList(bidDoc); - fileIdList.addAll(bidFileIdList); - // 获取中标通知书 - String acceptanceLetter = purchase.getAcceptanceLetter(); - List acceptFileIdList = getFileIdList(acceptanceLetter); - fileIdList.addAll(acceptFileIdList); + if (Objects.nonNull(purchase)) { + String biddingDoc = purchase.getBiddingDoc(); + List biddingFileIdList = getFileIdList(biddingDoc); + fileIdList.addAll(biddingFileIdList); + // 获取招标文件 + String bidDoc = purchase.getBidDoc(); + List bidFileIdList = getFileIdList(bidDoc); + fileIdList.addAll(bidFileIdList); + // 获取中标通知书 + String acceptanceLetter = purchase.getAcceptanceLetter(); + List acceptFileIdList = getFileIdList(acceptanceLetter); + fileIdList.addAll(acceptFileIdList); + } // 合同备案阶段 Contract contract = contractService .getOne(Wrappers.lambdaQuery(Contract.class).eq(Contract::getProjectId, projectId).last(BizConst.LIMIT_1)); // 获取合同附件 - String attachment = contract.getAttachment(); - List contractFileIdList = getFileIdList(attachment); - fileIdList.addAll(contractFileIdList); + if (Objects.nonNull(contract)) { + String attachment = contract.getAttachment(); + List contractFileIdList = getFileIdList(attachment); + fileIdList.addAll(contractFileIdList); + } // 初验备案阶段 // 获取初验材料 String preliminaryInspectionMaterials = project.getPreliminaryInspectionMaterials(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java index 4c51371..4408614 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java @@ -1,5 +1,11 @@ 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; @@ -19,27 +25,24 @@ import java.util.List; @ApiModel(value = "ProjectFileVO", description = "项目档案") public class ProjectFileVO { - @ApiModelProperty("项目ID") - private Long id; + @ApiModelProperty("项目档案详情") + private ProjectDetailVO projectDetailVo; - @ApiModelProperty("项目名称") - private String projectName; + @ApiModelProperty("流程进度详情") + private List 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 ProjectDetailVO projectDetailVo; - - @ApiModelProperty("流程进度详情") - private List processDetailVos; + @ApiModelProperty("终验信息详情") + private FinalAcceptanceVO finalAcceptanceVo; } From 68f35af57944c14d8c7a333147eb5abd39703969 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Tue, 27 Jun 2023 11:56:56 +0800 Subject: [PATCH 35/44] =?UTF-8?q?=E7=9B=96=E7=AB=A0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java | 12 +++++++++++- .../ningdatech/pmapi/todocenter/manage/TodoCenterManage.java | 4 +--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java index 41acf08..fcdae3e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java @@ -1,5 +1,6 @@ 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; @@ -74,7 +75,16 @@ 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"); + if (Objects.nonNull(signFileB64)){ + return signFileB64.getBytes(); + }else { + return null; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index ba3f283..69ec8c0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -494,9 +494,7 @@ public class TodoCenterManage { Integer signType = req.getSignType(); signReq.setSignType(signType); // 调用盖章接口,获取盖章后返回的pdf文件字符数组 - byte[] signPdf = new byte[0]; - - signPdf = IRSAPIRequest.createSignPdf(signReq); + byte[] signPdf = IRSAPIRequest.createSignPdf(signReq); // 转换成MultipartFile MultipartFile multipartFile = new MockMultipartFile("file", originalFileName, "application/pdf", signPdf); From 6fa3dada3da68dd791dc6b093dc403becd849c21 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 27 Jun 2023 11:57:17 +0800 Subject: [PATCH 36/44] =?UTF-8?q?=E5=BA=94=E7=94=A8=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/common/util/CryptUtils.java | 68 +++++++ .../ningdatech/pmapi/common/util/HmacAuthUtil.java | 82 ++++++++ .../com/ningdatech/pmapi/common/util/HttpUtil.java | 217 +++++++++++++++++++++ .../com/ningdatech/pmapi/common/util/Md5Utils.java | 46 +++++ .../pmapi/common/util/RefreshKeyUtil.java | 34 ++++ .../manage/IndicatorTemplateManage.java | 1 + ...PerformanceIndicatorProjectTemplateSaveDTO.java | 3 + .../model/dto/ProjectTemplateDetailDTO.java | 45 +++++ .../PerformanceIndicatorProjectTemplateDetail.java | 53 +++++ .../controller/ProjectApplicationController.java | 41 ++++ .../pmapi/projectlib/manage/ApplicationManage.java | 53 +++++ .../model/dto/ApplicationAppCodeSaveDTO.java | 32 +++ .../model/entity/ProjectApplication.java | 3 + .../projectlib/model/vo/ProjectApplicationVO.java | 3 + 14 files changed, 681 insertions(+) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/util/CryptUtils.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/util/HmacAuthUtil.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/util/HttpUtil.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/util/Md5Utils.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/util/RefreshKeyUtil.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ApplicationAppCodeSaveDTO.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CryptUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CryptUtils.java new file mode 100644 index 0000000..2a2c0f7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/CryptUtils.java @@ -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")); + } +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/HmacAuthUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/HmacAuthUtil.java new file mode 100644 index 0000000..e58447d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/HmacAuthUtil.java @@ -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 generateHeader(String url, String requestMethod, String accessKey, String secretKey) { + Map 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> queryParamList = new ArrayList<>(); + String[] params = query.split("&"); + for (String param : params) { + String[] keyValue = param.split("="); + Pair pair = new Pair(keyValue[0], keyValue.length > 1 ? keyValue[1] : ""); + queryParamList.add(pair); + } + List> sortedParamList = queryParamList.stream().sorted(Comparator.comparing(param -> param.getKey() + "=" + Optional.ofNullable(param.getValue()).orElse(""))).collect(Collectors.toList()); + List> 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 encodeParam : encodeParamList) { + queryParamString.append(encodeParam.getKey()).append("=").append(Optional.ofNullable(encodeParam.getValue()).orElse("")); + queryParamString.append("&"); + } + return queryParamString.substring(0, queryParamString.length() - 1); + } +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/HttpUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/HttpUtil.java new file mode 100644 index 0000000..fcc5333 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/HttpUtil.java @@ -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 maps) { + HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost + // 创建参数队列 + List nameValuePairs = new ArrayList(); + 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; + } +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/Md5Utils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/Md5Utils.java new file mode 100644 index 0000000..6254ec3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/Md5Utils.java @@ -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; + } + } +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/RefreshKeyUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/RefreshKeyUtil.java new file mode 100644 index 0000000..7d76d4d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/RefreshKeyUtil.java @@ -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; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java index 7893860..a0465f6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java @@ -81,6 +81,7 @@ public class IndicatorTemplateManage { template.setUpdateOn(LocalDateTime.now()); template.setUpdateBy(user.getUsername()); if(indicatorTemplateService.saveOrUpdate(template)){ + //保存 模板的详情 return "保存成功"; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java index 25106fb..36dcba5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java @@ -32,4 +32,7 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") private Integer amountRange; + + @ApiModelProperty("绩效指标详情") + private ProjectTemplateDetailDTO templateDetail; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java new file mode 100644 index 0000000..843220a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java @@ -0,0 +1,45 @@ +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; + +/** + * @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("子指标") + private ProjectTemplateDetailDTO children; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java new file mode 100644 index 0000000..006ff62 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java @@ -0,0 +1,53 @@ +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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java new file mode 100644 index 0000000..4658fc0 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java @@ -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") + @ApiOperation("获取应用 试运行报告") + @WebLog("获取应用 试运行报告") + public String getReport(@Valid @RequestBody ApplicationAppCodeSaveDTO dto) { + return applicationManage.getReport(dto); + } + + @PostMapping("/save-appcode") + @ApiOperation("保存应用注册的appCode") + @WebLog("保存应用注册的appCode") + public String saveAppCode(@Valid @RequestBody ApplicationAppCodeSaveDTO dto) { + return applicationManage.saveAppCode(dto); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java new file mode 100644 index 0000000..53de5f1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java @@ -0,0 +1,53 @@ +package com.ningdatech.pmapi.projectlib.manage; + +import com.ningdatech.basic.function.VUtils; +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.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.Objects; + +/** + *

+ * ApplicationManage + *

+ * + * @author ZPF + * @since 14:19 2023/2/1 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class ApplicationManage { + + 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 "保存失败"; + } + + public String getReport(ApplicationAppCodeSaveDTO dto) { + + return null; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ApplicationAppCodeSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ApplicationAppCodeSaveDTO.java new file mode 100644 index 0000000..d2fe905 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ApplicationAppCodeSaveDTO.java @@ -0,0 +1,32 @@ +package com.ningdatech.pmapi.projectlib.model.dto; + +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; + +/** + *

+ * 项目应用保存appCode + *

+ * + * @author ZPF + * @since 2023-06-21 + */ +@Data +@ApiModel(value = "ProjectApplicationSaveDTO", description = "项目应用保存appCode") +public class ApplicationAppCodeSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用的id") + @NotNull(message = "应用id必填") + private Long id; + + @ApiModelProperty("应用编码") + @NotBlank(message = "请输入应用编码") + private String appCode; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java index d053af0..cb476e9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java @@ -31,6 +31,9 @@ public class ProjectApplication implements Serializable { @ApiModelProperty("项目ID") private Long projectId; + @ApiModelProperty("应用编码") + private String appCode; + @ApiModelProperty("是否初次建设 0否 1是") private Integer isFirst; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java index feb42b4..c26a88b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java @@ -27,6 +27,9 @@ public class ProjectApplicationVO implements Serializable { @ApiModelProperty("项目ID") private Long projectId; + @ApiModelProperty("应用编码") + private String appCode; + @ApiModelProperty("是否初次建设 0否 1是") private Integer isFirst; From 473081421a88bc7e07fafb3fc9b0c9345fbae0e7 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Tue, 27 Jun 2023 13:24:05 +0800 Subject: [PATCH 37/44] =?UTF-8?q?=E7=9B=96=E7=AB=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java | 6 +++--- .../pmapi/todocenter/manage/TodoCenterManage.java | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java index fcdae3e..d98be0e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java @@ -6,7 +6,6 @@ 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; @@ -81,7 +80,8 @@ public class IRSAPIRequest { // 获取盖好章的PDF文件内容Base64字符串 String signFileB64 = object.getString("signFileB64"); if (Objects.nonNull(signFileB64)){ - return signFileB64.getBytes(); + Base64.getDecoder().decode(signFileB64); + return Base64.getDecoder().decode(signFileB64); }else { return null; } @@ -245,7 +245,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) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 69ec8c0..ab6f75c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.todocenter.manage; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; @@ -495,9 +496,17 @@ public class TodoCenterManage { signReq.setSignType(signType); // 调用盖章接口,获取盖章后返回的pdf文件字符数组 byte[] signPdf = IRSAPIRequest.createSignPdf(signReq); - + ByteArrayInputStream inputStream = null; + if (Objects.nonNull(signPdf)) { + inputStream = new ByteArrayInputStream(signPdf); + } // 转换成MultipartFile - MultipartFile multipartFile = new MockMultipartFile("file", originalFileName, "application/pdf", signPdf); + MultipartFile multipartFile; + try { + multipartFile = new MockMultipartFile("file", originalFileName, "application/pdf", inputStream); + } catch (IOException e) { + throw new BizException("生成盖章pdf文件失败!"); + } // 上传OSS FileResultVO resultVo = fileService.upload(multipartFile, "default"); // 将返回的文件ID更新到项目库中对应的项目下 From c3cec254edb44ad292684b6fdff1eeb70ecbb680 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Tue, 27 Jun 2023 13:55:58 +0800 Subject: [PATCH 38/44] =?UTF-8?q?=E7=9B=96=E7=AB=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java index d98be0e..c14f828 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java @@ -80,7 +80,6 @@ public class IRSAPIRequest { // 获取盖好章的PDF文件内容Base64字符串 String signFileB64 = object.getString("signFileB64"); if (Objects.nonNull(signFileB64)){ - Base64.getDecoder().decode(signFileB64); return Base64.getDecoder().decode(signFileB64); }else { return null; From 134e6736eeda29fde2f42d5d310b960f8b4d0a6f Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 27 Jun 2023 14:20:56 +0800 Subject: [PATCH 39/44] pdf --- .../ningdatech/pmapi/irs/sign/IRSAPIRequest.java | 8 +-- .../controller/ProjectApplicationController.java | 4 +- .../pmapi/projectlib/manage/ApplicationManage.java | 44 +++++++++++- .../pmapi/todocenter/manage/TodoCenterManage.java | 17 ++++- pmapi/src/main/resources/application-dev.yml | 6 +- pmapi/src/main/resources/application-prod.yml | 5 +- .../java/com/ningdatech/pmapi/irs/IrsTest.java | 81 ++++++++++++++++++++++ 7 files changed, 152 insertions(+), 13 deletions(-) create mode 100644 pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java index c14f828..4393846 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java @@ -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(); @@ -79,11 +79,7 @@ public class IRSAPIRequest { JSONObject object = JSON.parseObject(data, JSONObject.class); // 获取盖好章的PDF文件内容Base64字符串 String signFileB64 = object.getString("signFileB64"); - if (Objects.nonNull(signFileB64)){ - return Base64.getDecoder().decode(signFileB64); - }else { - return null; - } + return signFileB64; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java index 4658fc0..edba6bf 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java @@ -27,8 +27,8 @@ public class ProjectApplicationController { @GetMapping("/get-report") @ApiOperation("获取应用 试运行报告") @WebLog("获取应用 试运行报告") - public String getReport(@Valid @RequestBody ApplicationAppCodeSaveDTO dto) { - return applicationManage.getReport(dto); + public String getReport(@RequestParam(required = false) String appCode) { + return applicationManage.getReport(appCode); } @PostMapping("/save-appcode") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java index 53de5f1..1497136 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java @@ -1,15 +1,25 @@ package com.ningdatech.pmapi.projectlib.manage; +import com.alibaba.fastjson.JSON; import com.ningdatech.basic.function.VUtils; +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.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; 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; /** @@ -25,6 +35,15 @@ import java.util.Objects; @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; /** @@ -46,7 +65,30 @@ public class ApplicationManage { return "保存失败"; } - public String getReport(ApplicationAppCodeSaveDTO dto) { + /** + * 获取试运行报告 + * @param appCode + * @return + */ + public String getReport(String appCode) { + String method = HttpMethod.GET.name(); + String appUrl = url + "?appCode=" + appCode; + + Map header = HmacAuthUtil.generateHeader(appUrl, method, appKey, appScret); + //请求头 + HttpHeaders headers = new HttpHeaders(); + + for(Map.Entry entry : header.entrySet()){ + headers.add(entry.getKey(), entry.getValue()); + } + //封装请求头 + HttpEntity> formEntity = new HttpEntity>(headers); + + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.exchange(url, HttpMethod.GET,formEntity, String.class); + + log.info("body:",forEntity.getBody()); + String body = forEntity.getBody(); return null; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index ab6f75c..ca4f85b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -105,6 +105,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import sun.misc.BASE64Decoder; /** * @author ZPF @@ -495,10 +496,22 @@ public class TodoCenterManage { Integer signType = req.getSignType(); signReq.setSignType(signType); // 调用盖章接口,获取盖章后返回的pdf文件字符数组 - byte[] signPdf = IRSAPIRequest.createSignPdf(signReq); + String signPdf = IRSAPIRequest.createSignPdf(signReq); ByteArrayInputStream inputStream = null; if (Objects.nonNull(signPdf)) { - inputStream = new ByteArrayInputStream(signPdf); + BASE64Decoder decoder = new BASE64Decoder(); + try { + //转码 + byte[] b = decoder.decodeBuffer(signPdf); + for (int i = 0; i < b.length; ++i) { + if (b[i] < 0) {//调整异常数据 + b[i] += 256; + } + } + inputStream = new ByteArrayInputStream(b); + }catch (Exception e){ + + } } // 转换成MultipartFile MultipartFile multipartFile; diff --git a/pmapi/src/main/resources/application-dev.yml b/pmapi/src/main/resources/application-dev.yml index 6820c94..ccc0776 100644 --- a/pmapi/src/main/resources/application-dev.yml +++ b/pmapi/src/main/resources/application-dev.yml @@ -209,10 +209,14 @@ irs: access-key: 42bcb49bea174986a3bfdfba7d005566 secret-key: bebff29877d4443abd67fc4f8fb335d8 api-url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf - + app-report: + url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl + appScret: BCDSGS_4ab4235d26a9a357170a39f3a13fd68c + appKey: BCDSGA_d874c8e46b541eb4e8aac6510fd3351b hostname: iZbp13nwyvib53j4j1p2xoZ login: phone-verify-code: skip: true + diff --git a/pmapi/src/main/resources/application-prod.yml b/pmapi/src/main/resources/application-prod.yml index 27c5e85..cb0d660 100644 --- a/pmapi/src/main/resources/application-prod.yml +++ b/pmapi/src/main/resources/application-prod.yml @@ -208,7 +208,10 @@ irs: access-key: 42bcb49bea174986a3bfdfba7d005566 secret-key: bebff29877d4443abd67fc4f8fb335d8 api-url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf - + app-report: + url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl + appScret: BCDSGS_4ab4235d26a9a357170a39f3a13fd68c + appKey: BCDSGA_d874c8e46b541eb4e8aac6510fd3351b hostname: iZ6mx01gyeodd80imxd2gbZ login: phone-verify-code: diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java new file mode 100644 index 0000000..7843725 --- /dev/null +++ b/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java @@ -0,0 +1,81 @@ +package com.ningdatech.pmapi.irs; + +import com.alibaba.fastjson.JSON; +import com.google.common.collect.Maps; +import com.ningdatech.pmapi.common.util.CryptUtils; +import com.ningdatech.pmapi.common.util.HmacAuthUtil; +import com.ningdatech.pmapi.common.util.RefreshKeyUtil; +import org.junit.Test; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import java.security.NoSuchAlgorithmException; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @Classname IrsTest + * @Description + * @Date 2023/6/26 17:42 + * @Author PoffyZhang + */ +public class IrsTest { + + @Test + public void test1(){ + String method = "GET"; + String url = "https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl?appCode=A330000100000202105005790"; + String appScret = "BCDSGS_4ab4235d26a9a357170a39f3a13fd68c"; + String appKey = "BCDSGA_d874c8e46b541eb4e8aac6510fd3351b"; + + Map header = HmacAuthUtil.generateHeader(url, method, appKey, appScret); + //请求头 + HttpHeaders headers = new HttpHeaders(); + + for(Map.Entry entry : header.entrySet()){ + headers.add(entry.getKey(), entry.getValue()); + } + //封装请求头 + HttpEntity> formEntity = new HttpEntity>(headers); + + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.exchange(url, HttpMethod.GET,formEntity, String.class); + + System.out.println(JSON.toJSONString(forEntity)); + } + + @Test + public void test2() throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String areaCode = "331121"; + String appKey = "A331101453557202109017383"; + String appScret = "496f0f2a19994f76b4fd9dae087366c7"; + + String requestSecret = RefreshKeyUtil.getRequestSecret(appKey, appScret); + String capCode = CryptUtils.MD5Encode(timestamp + areaCode); + String capTime = String.valueOf(timestamp); + String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm?requestTime=" + timestamp + + "&sign=" + sign + "&appKey=" + appKey + "&capCode=" + capCode + "&capTime=" + capTime + + "&baseProjSys=测试应用&areaCode=331121&baseProjName=nsl-丽水演示项目&baseProjId=331100230130112233001" + + "&isEffective=1&baseProjSysCode=25083657"; + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + + System.out.println(JSON.toJSONString(forEntity)); + } + + @Test + public void test3() throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String areaCode = "331121"; + System.out.println(CryptUtils.MD5Encode(timestamp + areaCode)); + } +} From a096a984aee2f3d8ba44418916a3187947e5fe8e Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Tue, 27 Jun 2023 14:44:13 +0800 Subject: [PATCH 40/44] =?UTF-8?q?=E9=A2=84=E5=AE=A1=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E9=A9=B3=E5=9B=9E,=E9=A2=84=E5=AE=A1=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/todocenter/manage/HandlerManage.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index 615f648..cf89a03 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -263,7 +263,7 @@ public class HandlerManage { // 审批流程不是申请延期和申请借阅,需调用状态机 if (!InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && !InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { // 更新项目状态和流程状态 - updateRejectProjectStatus(userId, declaredProject); + updateRejectProjectStatus(userId, declaredProject, instType); } //发送消息 noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), @@ -373,14 +373,20 @@ public class HandlerManage { * * @param userId * @param declaredProject + * @param instType * @return void * @author CMM * @since 2023/02/08 */ - private void updateRejectProjectStatus(Long userId, Project declaredProject) { + private void updateRejectProjectStatus(Long userId, Project declaredProject, Integer instType) { stateMachineUtils.reject(declaredProject); declaredProject.setUpdateOn(LocalDateTime.now()); declaredProject.setUpdateBy(userId); + // 如果是预审审批驳回,需要重新盖章,原来盖过章的文件要清空 + if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)){ + declaredProject.setPretrialFileId(null); + declaredProject.setPretrialFileName(null); + } projectService.updateById(declaredProject); } From b902a510a9802f5a711f07f73d9c2fb3faf25dcb Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 27 Jun 2023 15:10:09 +0800 Subject: [PATCH 41/44] =?UTF-8?q?=E5=BA=94=E7=94=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ProjectApplicationController.java | 4 +-- .../pmapi/projectlib/manage/ApplicationManage.java | 35 +++++++++++++++++----- .../pmapi/projectlib/manage/ProjectLibManage.java | 2 +- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java index edba6bf..4378fcf 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java @@ -24,10 +24,10 @@ public class ProjectApplicationController { private final ApplicationManage applicationManage; - @GetMapping("/get-report") + @GetMapping("/get-report/{appCode}") @ApiOperation("获取应用 试运行报告") @WebLog("获取应用 试运行报告") - public String getReport(@RequestParam(required = false) String appCode) { + public String getReport(@PathVariable String appCode) { return applicationManage.getReport(appCode); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java index 1497136..b80a1e0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java @@ -1,7 +1,12 @@ 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; @@ -9,11 +14,9 @@ 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.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; +import org.springframework.http.*; import org.springframework.stereotype.Component; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; @@ -85,11 +88,29 @@ public class ApplicationManage { HttpEntity> formEntity = new HttpEntity>(headers); RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.exchange(url, HttpMethod.GET,formEntity, String.class); + ResponseEntity forEntity = restTemplate.exchange(appUrl, HttpMethod.GET,formEntity, ApiResponse.class); log.info("body:",forEntity.getBody()); - String body = forEntity.getBody(); + ApiResponse body = forEntity.getBody(); - return null; + 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("获取报告失败!"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 05999dc..a0c13a9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -731,7 +731,7 @@ public class ProjectLibManage { if(StringUtils.isNotBlank(req.getApplicationName())){ wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName,req.getApplicationName()) - .or(q2 -> q2.like(ProjectApplication::getAccountAppName,req.getApplicationName()))); + .or(q2 -> q2.like(ProjectApplication::getRelatedExistsApplication,req.getApplicationName()))); } wrapper.orderByDesc(ProjectApplication::getUpdateOn); projectApplicationService.page(page,wrapper); From c4662828585a3bb13ac8ac8d4aa2e19217f387cf Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 27 Jun 2023 17:37:35 +0800 Subject: [PATCH 42/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=BB=A9=E6=95=88?= =?UTF-8?q?=E6=8C=87=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/constant/RegionConst.java | 2 + .../PerformanceIndicatorTemplateController.java | 8 ++ .../enumration/PerformanceTemplateTypeEnum.java | 44 ++++++++ .../manage/IndicatorTemplateManage.java | 123 ++++++++++++++++++++- ...rmanceIndicatorProjectTemplateDetailMapper.java | 16 +++ ...ormanceIndicatorProjectTemplateDetailMapper.xml | 5 + ...PerformanceIndicatorProjectTemplateSaveDTO.java | 6 +- .../model/dto/ProjectTemplateDetailDTO.java | 3 +- .../PerformanceIndicatorProjectTemplate.java | 3 + .../vo/PerformanceIndicatorProjectTemplateVO.java | 9 +- .../model/vo/ProjectTemplateDetailVO.java | 42 +++++++ ...manceIndicatorProjectTemplateDetailService.java | 16 +++ ...eIndicatorProjectTemplateDetailServiceImpl.java | 21 ++++ .../projectdeclared/manage/PurchaseManage.java | 32 ++++-- .../projectdeclared/model/dto/PurchaseSaveDTO.java | 2 + 15 files changed, 316 insertions(+), 16 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java index 014a1d9..84f1c9b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java @@ -24,6 +24,8 @@ public interface RegionConst { * 丽水行政区划编码 */ String RC_LS = "331100"; + //遂昌县 + String RC_SC = "331123"; /** * 中国行政区划编码 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java index 95161dc..d5951ed 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java @@ -1,6 +1,7 @@ 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; @@ -32,8 +33,15 @@ public class PerformanceIndicatorTemplateController { 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); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java new file mode 100644 index 0000000..51f7bfc --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java @@ -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; + +/** + *

+ * PerformanceTemplateTypeEnum + *

+ * + * @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; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java index a0465f6..8865874 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java @@ -1,16 +1,23 @@ 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.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; @@ -20,6 +27,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import java.time.LocalDateTime; +import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -36,6 +44,8 @@ import java.util.stream.Collectors; public class IndicatorTemplateManage { private final IPerformanceIndicatorProjectTemplateService indicatorTemplateService; + private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; + /** * 模板列表 * @param req @@ -60,6 +70,26 @@ public class IndicatorTemplateManage { } /** + * 查询项目模板详情 + * @param id + * @return + */ + public PerformanceIndicatorProjectTemplateVO projectDetail(Long id) { + PerformanceIndicatorProjectTemplate template = indicatorTemplateService.getById(id); + if(Objects.isNull(template)){ + return null; + } + PerformanceIndicatorProjectTemplateVO vo = BeanUtil.copyProperties(template, + PerformanceIndicatorProjectTemplateVO.class); + List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); + if(CollUtil.isNotEmpty(templateDetails)){ + vo.setTemplateDetails(buildTemplateDetail(templateDetails)); + } + return vo; + } + + /** * 项目指标 模板保存 * @param dto * @return @@ -67,7 +97,6 @@ public class IndicatorTemplateManage { public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class); - if(Objects.nonNull(dto.getId())){ PerformanceIndicatorProjectTemplate old = indicatorTemplateService.getById(dto.getId()); VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!"); @@ -77,14 +106,100 @@ public class IndicatorTemplateManage { template.setCreateOn(LocalDateTime.now()); template.setCreateBy(user.getUsername()); } - template.setUpdateOn(LocalDateTime.now()); template.setUpdateBy(user.getUsername()); if(indicatorTemplateService.saveOrUpdate(template)){ //保存 模板的详情 - return "保存成功"; + if(CollUtil.isNotEmpty(dto.getTemplateDetails())){ + //先删除 + indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId())); + analysisTemplateDetails(dto.getTemplateDetails(),template.getId()); + } + return "保存成功"; } - throw new BizException("保存失败!"); } + + /** + * 解析 项目考核指标 + * @param templateDetails + * @return + */ + private void analysisTemplateDetails( + List templateDetails,Long templateId) { + List details = Lists.newArrayList(); + if(CollUtil.isEmpty(templateDetails)){ + return; + } + + analysisTemplateDetailsInner(templateDetails,templateId,null); + } + + private void analysisTemplateDetailsInner(List templateDetails, + Long templateId,Long parentId) { + 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); + indicatorProjectTemplateDetailService.save(templateDetail); + + if(CollUtil.isNotEmpty(detail.getChildren())){ + analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); + } + } + } + + /** + * 装配 模板详情 + * @param templateDetails + * @return + */ + private List buildTemplateDetail(List templateDetails) { + List res = Lists.newArrayList(); + //第一层是 一级的 + for(PerformanceIndicatorProjectTemplateDetail templateDetail : templateDetails){ + if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){ + ProjectTemplateDetailVO detailVo = BeanUtil.copyProperties(templateDetail, ProjectTemplateDetailVO.class); + List 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 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 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; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java new file mode 100644 index 0000000..d0e9a73 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java @@ -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; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Zpf + * @since 2023-06-03 + */ +public interface PerformanceIndicatorProjectTemplateDetailMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml new file mode 100644 index 0000000..16a746b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java index 36dcba5..56503b4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java @@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * @Classname PerformanceIndicatorProjectTemplateSaveDTO @@ -30,9 +31,12 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable @ApiModelProperty("项目年度") private Integer projectYear; + @ApiModelProperty("项目类型 ") + private Integer projectType; + @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") private Integer amountRange; @ApiModelProperty("绩效指标详情") - private ProjectTemplateDetailDTO templateDetail; + private List templateDetails; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java index 843220a..2f0afab 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java @@ -9,6 +9,7 @@ import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; +import java.util.List; /** * @Classname PerformanceIndicatorProjectTemplateDetail @@ -41,5 +42,5 @@ public class ProjectTemplateDetailDTO implements Serializable { private String scoreRubric; @ApiModelProperty("子指标") - private ProjectTemplateDetailDTO children; + private List children; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java index dda9e60..338195e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java @@ -41,6 +41,9 @@ public class PerformanceIndicatorProjectTemplate implements Serializable { @ApiModelProperty("项目年度") private Integer projectYear; + @ApiModelProperty("项目类型") + private Integer projectType; + @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") private Integer amountRange; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java index d8c61f1..81b7416 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java @@ -6,9 +6,10 @@ import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; +import java.util.List; /** - * @Classname PerformanceIndicatorTemplateVO + * @Classname PerformanceIndicatorProjectTemplateVO * @Description 绩效评价考核项目指标模板 * @Date 2023/6/19 14:02 * @Author PoffyZhang @@ -36,6 +37,12 @@ public class PerformanceIndicatorProjectTemplateVO implements Serializable { @ApiModelProperty("项目年度") private Integer projectYear; + @ApiModelProperty("项目类型") + private Integer projectType; + @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") private Integer amountRange; + + @ApiModelProperty("绩效指标详情") + private List templateDetails; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java new file mode 100644 index 0000000..7ee7ad6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java @@ -0,0 +1,42 @@ +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("子指标") + private List children; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java new file mode 100644 index 0000000..ff9d7a1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java @@ -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; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2023-06-03 + */ +public interface IPerformanceIndicatorProjectTemplateDetailService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java new file mode 100644 index 0000000..660c459 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java @@ -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; + +/** + *

+ * 绩效评价详情 服务实现类 + *

+ * + * @author ZPF + * @since 2023-06-15 + */ +@Service +public class PerformanceIndicatorProjectTemplateDetailServiceImpl extends ServiceImpl + implements IPerformanceIndicatorProjectTemplateDetailService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java index e7b9583..21d3e78 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java @@ -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 "保存失败"; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java index 784c639..9ea6aa3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java @@ -56,4 +56,6 @@ public class PurchaseSaveDTO { @ApiModelProperty("中标通知书") private String acceptanceLetter; + @ApiModelProperty("应用编码") + private String appCode; } From 05f777e58c9c5372739890568045469789a1cc53 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Wed, 28 Jun 2023 10:39:51 +0800 Subject: [PATCH 43/44] =?UTF-8?q?=E9=A2=84=E5=AE=A1=E9=A9=B3=E5=9B=9E?= =?UTF-8?q?=E9=80=80=E5=9B=9E=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/model/entity/Project.java | 1 + .../pmapi/todocenter/manage/HandlerManage.java | 23 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java index 596003e..f151df2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java @@ -311,6 +311,7 @@ public class Project implements Serializable { private Long updateBy; @ApiModelProperty("项目预审申请单文件ID") + private Long pretrialFileId; @ApiModelProperty("项目预审申请单文件名") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index cf89a03..07e15a2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -8,6 +8,7 @@ import java.util.*; import java.util.stream.Collectors; import cn.hutool.core.date.DatePattern; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.google.common.collect.Lists; import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.file.service.FileService; @@ -340,6 +341,19 @@ public class HandlerManage { */ public void afterBackTodo(Project declaredProject, HistoricProcessInstance instance) { Long userId = LoginUserUtil.getUserId(); + // 获取当前流程实例类型 + String instanceId = declaredProject.getInstCode(); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId)); + Integer instType = projectInst.getInstType(); + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(); + // 如果是预审审批退回,需要重新盖章,原来盖过章的文件要清空 + if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)){ + updateWrapper.set(Project::getPretrialFileId,null) + .set(Project::getPretrialFileName,null) + .eq(Project::getId,declaredProject.getId()); + } + projectService.update(updateWrapper); // 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 //发送消息 noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), @@ -380,14 +394,17 @@ public class HandlerManage { */ private void updateRejectProjectStatus(Long userId, Project declaredProject, Integer instType) { stateMachineUtils.reject(declaredProject); + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(); declaredProject.setUpdateOn(LocalDateTime.now()); declaredProject.setUpdateBy(userId); + projectService.updateById(declaredProject); // 如果是预审审批驳回,需要重新盖章,原来盖过章的文件要清空 if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)){ - declaredProject.setPretrialFileId(null); - declaredProject.setPretrialFileName(null); + updateWrapper.set(Project::getPretrialFileId,null) + .set(Project::getPretrialFileName,null) + .eq(Project::getId,declaredProject.getId()); } - projectService.updateById(declaredProject); + projectService.update(updateWrapper); } /** From c8ba0f1055c1e9c9a6346a17ff1f8cb4ac8c7b49 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 28 Jun 2023 15:11:45 +0800 Subject: [PATCH 44/44] =?UTF-8?q?=E7=BB=A9=E6=95=88=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PerformanceIndicatorTemplateController.java | 7 ++ .../PerformanceTemplateStageNameEnum.java | 44 ++++++++++ .../manage/IndicatorTemplateManage.java | 95 ++++++++++++++++++---- .../PerformanceAppraisalProjectGroupSaveDTO.java | 3 + ...PerformanceIndicatorProjectTemplateSaveDTO.java | 3 + .../model/dto/ProjectTemplateDetailDTO.java | 11 +-- .../PerformanceIndicatorProjectTemplate.java | 3 + .../PerformanceIndicatorProjectTemplateDetail.java | 6 ++ .../vo/PerformanceIndicatorProjectTemplateVO.java | 3 + .../model/vo/ProjectTemplateDetailVO.java | 6 ++ 10 files changed, 162 insertions(+), 19 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateStageNameEnum.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java index d5951ed..7876d71 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java @@ -45,4 +45,11 @@ public class PerformanceIndicatorTemplateController { 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); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateStageNameEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateStageNameEnum.java new file mode 100644 index 0000000..e5958f8 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateStageNameEnum.java @@ -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; + +/** + *

+ * PerformanceTemplateStageNameEnum + *

+ * + * @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; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java index 8865874..6fa97a8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java @@ -9,6 +9,8 @@ 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; @@ -25,9 +27,9 @@ 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.Collections; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -42,7 +44,7 @@ import java.util.stream.Collectors; @Component @AllArgsConstructor public class IndicatorTemplateManage { - private final IPerformanceIndicatorProjectTemplateService indicatorTemplateService; + private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; @@ -56,7 +58,7 @@ public class IndicatorTemplateManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) .like(StringUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName()) .eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceIndicatorProjectTemplate::getRegionCode,req.getRegionCode()); - indicatorTemplateService.page(page,wrapper); + indicatorProjectTemplateService.page(page,wrapper); if(0L == page.getTotal()){ return PageVo.empty(); @@ -75,7 +77,7 @@ public class IndicatorTemplateManage { * @return */ public PerformanceIndicatorProjectTemplateVO projectDetail(Long id) { - PerformanceIndicatorProjectTemplate template = indicatorTemplateService.getById(id); + PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getById(id); if(Objects.isNull(template)){ return null; } @@ -94,11 +96,12 @@ public class IndicatorTemplateManage { * @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 = indicatorTemplateService.getById(dto.getId()); + PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId()); VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!"); template.setId(old.getId()); }else{ @@ -108,13 +111,24 @@ public class IndicatorTemplateManage { } template.setUpdateOn(LocalDateTime.now()); template.setUpdateBy(user.getUsername()); - if(indicatorTemplateService.saveOrUpdate(template)){ + 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 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 "保存成功"; } @@ -126,23 +140,22 @@ public class IndicatorTemplateManage { * @param templateDetails * @return */ - private void analysisTemplateDetails( + public void analysisTemplateDetails( List templateDetails,Long templateId) { - List details = Lists.newArrayList(); if(CollUtil.isEmpty(templateDetails)){ return; } - - analysisTemplateDetailsInner(templateDetails,templateId,null); + analysisTemplateDetailsInner(templateDetails,templateId,null,null); } - private void analysisTemplateDetailsInner(List templateDetails, - Long templateId,Long parentId) { + public void analysisTemplateDetailsInner(List 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()); @@ -150,12 +163,46 @@ public class IndicatorTemplateManage { 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()); + 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 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; } /** @@ -199,7 +246,27 @@ public class IndicatorTemplateManage { 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 "操作失败"; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java index b5bc523..e78b1be 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java @@ -32,6 +32,9 @@ public class PerformanceAppraisalProjectGroupSaveDTO implements Serializable { @ApiModelProperty("计划id") private Long appraisalId; + @ApiModelProperty("状态 0关闭 1开启") + private Integer status = 0; + @ApiModelProperty("分组内的所有项目code") private List projectCodes; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java index 56503b4..72cf09d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java @@ -37,6 +37,9 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") private Integer amountRange; + @ApiModelProperty("状态 0 1") + private Integer status; + @ApiModelProperty("绩效指标详情") private List templateDetails; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java index 2f0afab..412db14 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java @@ -1,14 +1,9 @@ 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; /** @@ -41,6 +36,12 @@ public class ProjectTemplateDetailDTO implements Serializable { @ApiModelProperty("分数细则 3级指标才有") private String scoreRubric; + @ApiModelProperty("评分pdf") + private String pdf; + + @ApiModelProperty("阶段id") + private Long stageId; + @ApiModelProperty("子指标") private List children; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java index 338195e..98c95d5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java @@ -44,6 +44,9 @@ public class PerformanceIndicatorProjectTemplate implements Serializable { @ApiModelProperty("项目类型") private Integer projectType; + @ApiModelProperty("状态 0关闭 1开启") + private Integer status; + @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") private Integer amountRange; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java index 006ff62..6890d1e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplateDetail.java @@ -50,4 +50,10 @@ public class PerformanceIndicatorProjectTemplateDetail implements Serializable { @ApiModelProperty("分数细则 3级指标才有") private String scoreRubric; + + @ApiModelProperty("评分pdf") + private String pdf; + + @ApiModelProperty("阶段id") + private Long stageId; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java index 81b7416..6ac7ff2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java @@ -43,6 +43,9 @@ public class PerformanceIndicatorProjectTemplateVO implements Serializable { @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") private Integer amountRange; + @ApiModelProperty("状态 0关闭 1开启") + private Integer status; + @ApiModelProperty("绩效指标详情") private List templateDetails; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java index 7ee7ad6..bd32eb8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java @@ -37,6 +37,12 @@ public class ProjectTemplateDetailVO implements Serializable { @ApiModelProperty("分数细则 3级指标才有") private String scoreRubric; + @ApiModelProperty("评分pdf") + private String pdf; + + @ApiModelProperty("阶段id") + private Long stageId; + @ApiModelProperty("子指标") private List children; }